variable:maxprofit=0;
variable:win=0;
variable:win2=0;
IF holding>0 and enterbars>0 THEN BEGIN
win:=high-enterprice;
IF win>maxprofit THEN maxprofit:=win;
win2:=maxprofit-win;
END
盈利大于50,小于100时,回撤30%平多 win2>=0.3*maxprofit then sell();
盈利大于50,小于100,这个条件描述是用 maxprofit>50 and maxprofit<100,还是 win>50 AND win<100 呢?
我之前用的maxprofit,但空头(enterprice-L)止盈结果不对,用win反而对了,但是多头止盈又不正常了。
maxprofit_duo:=hhv(h-enterprice,enterbars+1);
maxprofit_kong:=llv(enterprice-l,enterbars+1);
if maxprofit_duo>100 and maxprofit_duo<50 and holding>0 and c-enterpcie<=0.3*maxprofit_duo then sell;
if maxprofit_kong>100 and maxprofit_kong<50 and holding<0 and enterpcie-c<=0.3*maxprofit_kong then sell;
maxprofit_duo:=hhv(h-enterprice,enterbars+1);
maxprofit_kong:=llv(enterprice-l,enterbars+1);
if maxprofit_duo>100 and maxprofit_duo<50 and holding>0 and c-enterpcie<=0.3*maxprofit_duo then sell;
if maxprofit_kong>100 and maxprofit_kong<50 and holding<0 and enterpcie-c<=0.3*maxprofit_kong then sell;
c-enterpcie<=0.3*maxprofit_duo then sell
回撤超过30%,应该是 c-enterpcie <= (1-0.3)*maxprofit_duo 吧?
if maxprofit_kong>100 and maxprofit_kong<50 and holding<0 and enterpcie-c<=0.3*maxprofit_kong then sell;
多头没问题,空头仍然不对,不出信号,空头如果去掉“maxprofit_kong>100 and maxprofit_kong<50” 这个条件就正常了
这也太怪了吧,为啥呢
maxprofit_duo:=hhv(h-enterprice,enterbars+1);
maxprofit_kong:=llv(enterprice-l,enterbars+1);
这个要改一改
maxprofit_duo:=hhv(henterbars+1)-enterprice,;
maxprofit_kong:=enterprice-llv(l,enterbars+1);
maxprofit_duo:=hhv(h-enterprice,enterbars+1);
maxprofit_kong:=llv(enterprice-l,enterbars+1);
这个要改一改
maxprofit_duo:=hhv(henterbars+1)-enterprice,;
maxprofit_kong:=enterprice-llv(l,enterbars+1);
信号是有了,但是后面“enterpcie-c<=0.3*maxprofit_kong ” 不对,用>=或<=都不对
maxprofit_kong:=llv(enterprice-l,enterbars+1);
if maxprofit_kong>100 and holding<0 and enterprice-c<=0.3*maxprofit_kong then sell;
这两行平空的代码,有的地方是回撤参数不管填多少都不变,有的是回撤比例完全和参数不对,有的是开仓后第二根就平掉但没有回撤
之前的代码只是空头有问题,多头没问题,这是什么原因呢,和我最开始的写法一样,都是空头没信号