input:P(26,20,100,8);
input:S(12,5,40,4);
input:M(9,2,60,6);
input:B1(26,5,300,30);
input:B2(2,0.1,10,1);
MID := MA(CLOSE,B1);
UPPER:= MID + B2*STD(CLOSE,B1);
LOWER:= MID - B2*STD(CLOSE,B1),colorred;
diff := EMA(CLOSE,S) - EMA(CLOSE,P);
dea := EMA(diff,M);
macd := 2*(diff-dea);
//开多仓条件:
BOPEON1:=cross(diff,dea) and c>upper and c>o AND HOLDING=0 AND time>091400 AND time<150000;
//平多仓条件:
BLIQCON:=holding>0 and cross(dea,diff);
//开空仓条件:
SOPCON1:=cross(dea,diff) and c<lower and c<o AND HOLDING=0 AND time>091400 AND time<150000;
//平空仓条件:
SLIQCON:=holding<0 and cross(diff,dea);
buy(BOPEON1,1,market);
sell(BLIQCON,holding,market);
buyshort(SOPCON1,1,market);
sellshort(SLIQCON,holding,market);
//收盘前平仓
sell(time>151000 and holding>0,holding,market);
sellshort(time>151000 and holding<0,holding,market);
可用现金:CASH(0),LINETHICK0;
持仓:HOLDING,LINETHICK0;
资产:ASSET,LINETHICK0;
一楼
我来了,努力学习