input:N(5,1,1000,1); 开盘价1:=CALLSTOCK('399006',vtOPEN,4,0); 收盘价1:=CALLSTOCK('399006',vtCLOSE,4,0); 最高价1:=CALLSTOCK('399006',VTHIGH,4,0); 最低价1:=CALLSTOCK('399006',VTLOW,4,0); 成交量1:=CALLSTOCK('399006',vtVOL,4,0); MA20:MA(C,20),COLORGREEN,LINETHICK3; MA60:MA(C,60),COLORRED,LINETHICK3; MTR1:=MAX(MAX((最高价1 - 最低价1),ABS((REF(收盘价1,1) - 最高价1))),ABS((REF(收盘价1,1) - 最低价1))); ATR:=REF(MTR1,1); MM:=((MA(MTR1,30) / REF(收盘价1,1)) * 100); MA2:=EMA(收盘价1,2); 上轨1:=(MA2 + (1.5 * ATR)); T2:=REF(上轨1,1); 开盘价2:=CALLSTOCK('SH000852',vtOPEN,4,0); 收盘价2:=CALLSTOCK('SH000852',vtCLOSE,4,0); 最高价2:=CALLSTOCK('SH000852',VTHIGH,4,0); 最低价2:=CALLSTOCK('SH000852',VTLOW,4,0); 成交量2:=CALLSTOCK('SH000852',vtVOL,4,0); MTR2:=MAX(MAX((最高价2 - 最低价2),ABS((REF(收盘价2,1) - 最高价2))),ABS((REF(收盘价2,1) - 最低价2))); ATR2:=REF(MTR2,1); NN:=((MA(MTR2,30) / REF(收盘价2,1)) * 100); MA3:=EMA(收盘价2,2); 上轨2:=(MA3 + (1.5 * ATR2)); T3:=REF(上轨2,1); 开盘价3:=CALLSTOCK('399905',vtOPEN,4,0); 收盘价3:=CALLSTOCK('399905',vtCLOSE,4,0); 最高价3:=CALLSTOCK('399905',VTHIGH,4,0); 最低价3:=CALLSTOCK('399905',VTLOW,4,0); 成交量3:=CALLSTOCK('399905',vtVOL,4,0); MTR3:=MAX(MAX((最高价3 - 最低价3),ABS((REF(收盘价3,1) - 最高价3))),ABS((REF(收盘价3,1) - 最低价3))); ATR3:=REF(MTR3,1); NN:=((MA(MTR3,30) / REF(收盘价3,1)) * 100); MA4:=EMA(收盘价3,2); 上轨3:=(MA4 + (1.5 * ATR3)); T4:=REF(上轨3,1); LB:=(成交量1 / MA(REF(成交量1,1),5)); PD:=(REF(MA3,1) > REF(收盘价2,1)); CJE:=AMOUNT; CW:=(INTPART(((((N * 10000) / CLOSE) / 100) * 0.98)) * 100); 可平:(HOLDING - DAYHOLDING),NODRAW,COLORRED; 买入1:BUY((((IF(((TIME < 100100) AND (LB > 2)),(收盘价1 > 100000),(收盘价1 > REF(上轨1,1))) AND (MA(收盘价1,20) < MA(收盘价1,60))) AND (HIGH > LOW)) AND (HOLDING = 0)),CW,LIMITR,CLOSE,1); 买入2:BUY((((IF(((TIME < 100100) AND (LB > 2)),(收盘价1 > 100000),(收盘价2 > REF(上轨2,1))) AND (MA(收盘价2,20) < MA(收盘价2,60))) AND (HIGH > LOW)) AND (HOLDING = 0)),CW,LIMITR,CLOSE,1); 买入3:BUY((((IF(((TIME < 100100) AND (LB > 2)),(收盘价1 > 100000),(收盘价3 > REF(上轨3,1))) AND (MA(收盘价3,20) < MA(收盘价3,60))) AND (HIGH > LOW)) AND (HOLDING = 0)),CW,LIMITR,CLOSE,1); 卖出1:SELL(((IF((TIME = 100000),(收盘价2 > 100000),(REF(MA2,1) > REF(收盘价1,1))) AND (可平 > 0)) AND (HIGH > LOW)),可平,LIMITR,CLOSE,1); 卖出2:SELL(((IF((TIME = 100000),(收盘价2 > 100000),(REF(MA4,1) > REF(收盘价3,1))) AND (可平 > 0)) AND (HIGH > LOW)),可平,LIMITR,CLOSE,1); 卖出3:SELL(((IF((TIME = 100000),(收盘价2 > 100000),(REF(MA3,1) > REF(收盘价2,1))) AND (可平 > 0)) AND (HIGH > LOW)),可平,LIMITR,CLOSE,1); 资产:ASSET,LINEDASHDOT,COLORRED,LINETHICK5; { KD:=; //开多条件 PD:=; //平多条件 KK:=; //开空条件 PK:=; //平空条件 平空:SELLSHORT(PK,1,THISCLOSE); //平空信号 开多:BUY(KD AND HOLDING=0,1,THISCLOSE); //开多信号 平多:SELL(PD,1,THISCLOSE); //平多信号 开空:BUYSHORT(KK AND HOLDING=0,1,THISCLOSE); //开空信号 } { 信号语句排列规则——先平后开 “费率设置”按钮——用于合理设置模型“费率”,以便在图形上正确输出如下帐户信息: 持仓:holding,linethick0; 资产:asset,noaxis; 可用现金:cash(0),linethick0;
|