等级: 免费版
- 注册:
- 2021-9-12
- 曾用名:
|
input:p(26,20,100,8),s(12,5,40,4),m(9,2,60,6);
DIFF :=EMA(CLOSE,S) - EMA(CLOSE,P);
DEA :=EMA(DIFF,M);
MACD1 :=2*(DIFF-DEA), COLORSTICK;
macdjc:=cross(diff,dea),NODRAW;//macd金叉
macdsc:=cross(dea,diff),NODRAW;
开多:buy(macdjc and holding=0,1,market);
开空:buyshort(macdsc and holding=0,1,marketr);
//空 移动止盈,保本5跳
ll:=llv(l,ENTERBARS+1);
xx:=ll+10*mindiff;// and OPENPROFIT>=盈利浮度空*mindiff
if dp and c>=xx and OPENPROFIT>=5*mindiff and holding<0 then begin // hh and
移动空:sellshort(holding<0,0,limitr,o);//marketr);//LIMITR,(kdpkj+平加跳*mindiff)),IGNORECHECKPRICE;
DRAWSL(ISLASTBAR ,xx ,0 ,0,1 ,COLORGREEN,1,vtsolid);//colorred;
DRAWTEXT(ISLASTBAR,xx,'空移动'&NUMTOSTR(xx,2)),COLORGREEN;//colorred;
END
//多 移动止盈,保本5跳
hh:=hhv(h,enterbars+1);
xx:=hh-15*mindiff;// and OPENPROFIT>=盈利浮度多
if KP and c<=xx and OPENPROFIT>=5*mindiff and holding>0 then begin // ll and
移动多:sell(holding>0,0,limitr,o);//marketr);//LIMITR,c),IGNORECHECKPRICE;//(kkpdj-平减跳*mindiff)
DRAWSL(ISLASTBAR ,xx ,0 ,0,1 ,colorred,1,vtsolid);
DRAWTEXT(ISLASTBAR,xx,'移动'&NUMTOSTR(xx,2)),colorred;
end
tt:time>=closetime(1) and time<OPENTIME(2) or (time>=closetime(0));
if tt=1 and holding<0 then 清空:sellshort(holding<0,0,marketr);
//tt:time>=closetime(1) and time<OPENTIME(2) or (time>=closetime(0));
if tt=1 and holding>0 then 清多:sell(holding>0,0,marketr);
帮我改一下师傅,谢谢你,多空移动回测:没有问题,保本盈利没有起作用,平仓后是亏起的
最高价盈利,回测到,保本盈利5跳平仓,吏中有5跳盈利,:开仓后必须大于盈利5跳以上才起动移动回测止盈:平仓,比如,开多单1手,开仓后,捡测是否有最高盈利,大于5跳以上才起动,移动止盈,老师看我说清楚没有,见图
补充内容 (2021-11-3 09:16):
在吗,大师 ,帮我修改一下,也可以 |
|