输出RUNMODE:0
输出INPUT:周期
输出INPUT:INITIALSTOP(2,0,3,1),COSTSTOP(2,1,3,1),TRAILINGSTOP(3,1,6,1)
输出INPUT:MONEY(0,0,10,1)
输出INPUT:SLIPPAGE(1,0,1,1)
输出INPUT:DEBUG(1,0,1,1)
输出VARIABLE:MYASSET=500000
输出VARIABLE:COSTPRICE=0,STOPLINE=0
COMMISSION赋值:0.001
STAMPTAX赋值:0.001
TRANSFERFEE赋值:0.001
COMMISSION赋值:0.001
STAMPTAX赋值:0.001
TRANSFERFEE赋值:0
输出 END MA1:收盘价的60日简单移动平均
BUYCOND赋值:昨日收盘价上穿MA1
TOPBAND赋值:昨日周期日内最高价的最高值+MINDIFF
ATR赋值:昨日真实波幅的10日简单移动平均
INITIALSTOPNUM赋值:TRIMPRICE(INITIALSTOP*ATR)
COSTSTOPNUM赋值:TRIMPRICE(COSTSTOP*ATR)
赋值:TRIMPRICE(TRAILINGSTOP*ATR)
SLIPPAGENUM赋值:SLIPPAGE*MINDIFF
PRICE赋值:0
LOTS赋值:0
PRICE赋值:收盘价+SLIPPAGENUM
MYCASH赋值:CASH(0)
LOTS1赋值:MYCASH/(PRICE*VOLUNIT)的整数部分*VOLUNIT
LOTS赋值:LOTS1
LOTS2赋值:MYCASH*0.01*MONEY/(INITIALSTOPNUM*VOLUNIT)的整数部分*VOLUNIT
LOTS赋值:LOTS1和LOTS2的较小值
END END 逻辑判断 LOTS>=1 THEN BEGIN BUY(1,LOTS,LIMITR,PRICE)
逻辑判断 WORKMODE=1 THEN TBUY(1,LOTS,LIMITR,PRICE)
PRICE赋值:0
LOTS赋值:HOLDING
PRICE赋值:收盘价-SLIPPAGENUM
COSTPRICE赋值:TRIMPRICE((ENTERPRICE*(1+COMMISSION)+2*TRANSFERFEE)/(1-COMMISSION-STAMPTAX))+MINDIFF
STOPLINE赋值:COSTPRICE-INITIALSTOPNUM
STOPLINE赋值:COSTPRICE
STOPLINE赋值:最高价-TRAILINGSTOPNUM
END 逻辑判断 PRICE>0 THEN BEGIN SELL(1,LOTS,LIMITR,PRICE)
COSTPRICE赋值:0
STOPLINE赋值:0
MYASSET赋值:ASSET
逻辑判断 WORKMODE=1 THEN TSELL(1,LOTS,LIMITR,PRICE)
END ENDPARTLINE(DEBUG=1 AND HOLDING=0,TOPBAND,画红色,1)
逻辑判断 INITIALSTOP>0 THEN BEGIN 逻辑判断 HOLDING>0 THEN BEGIN 当满足条件STOPLINE<COSTPRICE时,在STOPLINE位置画11号图标
当满足条件STOPLINE=COSTPRICE时,在STOPLINE位置画12号图标
当满足条件STOPLINE>COSTPRICE时,在STOPLINE位置画10号图标
输出 ENDENDIF DEBUG=1 THEN BEGIN 盈亏:MYASSET,NOAXIS,画洋红色
输出 收益:(MYASSET-500000)/500000,线宽为0
输出 次数:TOTALTRADE,线宽为0
输出 成功率:PERCENTWIN,线宽为0
输出 连亏:MAXSEQLOSS,线宽为0
输出 连赢:MAXSEQWIN,线宽为0
END