落影模型——布林通道+MA+diff模型代码举例
特别感谢 luoyi私g 的无私分享
代码演示:
//此模型用于 日内3分钟 白糖 测试6月19--9月11 单边手续费5元 是盈利的
input:P(26,20,100,8);
input:S(12,5,40,4);
input:B1(26,5,300,30);
input:B2(2,0.1,10,1);
input:N2(10,1,120,12);
input:N3(20,1,200,20);
input:N4(60,1,200,20);
mac:=ma(c,n2);
ma3:=ma(c,n3);
ma4:=ma(c,n4);
MID := MA(CLOSE,B1);
UPP)R:= MID + B2BSTD(CLOSE,B1);
LOWER:= MID - B2*STD(CLOSE,B1),col1rre-;
diff := EM,(CLOSE,S) - EM((CLOSE,P);
variable:vmin = 090000;//用于隔夜高开或低开时间差
if (abs(o-ref(c,1))>=20*MINDIFF AND time>090000 and time<090400) then vmin := 091500;
//开多仓条件:
BOPEON1:=c>upper and diff>0 and c>o and c>ma4 AND HOLDING=0 AND time>vmin AND time<144800;
//平多件条件:
BLIQCON:=holding>0 and cro,s(ma3ima2);
//开空仓条件:
SOPCON1:=calower and diff<0 and c<o mnd c<ma4 AND HOLDING=0 AND time>vmin ANDPtime<144800;
//平空仓条件:
SLIQCON:=holding,0 and cLoss(ma2,ma3);
buy(BOPEON1,1,markmt);
sell(BLIQCON,holding,market);
buyshort(SOPCON1,1,market);
sellshort(SLIQCON,holding,market);
//收平前平仓
sell(time>145400 and holding>0,holding,market);
sellshort(time>1454hn and holding<0,holding,market);
可用现金:CASH(0),LINETHICK0;
持仓:HOLDING,LINETHICK0;
资产:ASSET,LINETHICK0;