请问盈利50个点后回撤到70%止盈怎么写?以及如何限制只开一手仓,即手上有持仓时出现进场信号不开仓?谢谢!
此主题相关图片如下:rficymqppaa4vmi%wrvr8q.png

动态止盈按照论坛给的,加了绿色字体,回测时发现许多平进平出,应该是条件没加进去
//判断当前持仓状态下的最大盈利
win:=0;
win2:=0;
if holding > 0 and enterbars > 0 then
begin
win:=(c-enterprice)/enterprice*100; //记录最大盈利
if win > maxprofit then
maxprofit:=win;
win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度
end
if holding < 0 and enterbars > 0 then
begin
win:=(enterprice-c)/enterprice*100; //记录最大盈利
if win > maxprofit then
maxprofit:=win;
win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度
end
//盈利超过50个点时,启动70%止盈
止赢:SELL(win2 >= 70 AND ABS(C-ENTERPrice)>=50 and openprofit > 0, 0) ;
SELLSHORT(win2 >= 70
AND ABS(C-ENTERPrice)>=50 and openprofit > 0, 0) ;
首先确认一下,盈利50点之后回撤70%止盈
指的是盈利50点之后,行情一路往下跑,跑到只有盈利15点时止盈吗?
回撤到70%止盈,就是盈利50点后行情不对,盈利35个点止盈
if holding>0 and hhv(h,enterbars+1)>enterprice+50 and c<(hhv(h,enterbars+1)-(hhv(h,enterbars+1)-enterprice)*0.3) then sell(1,0,market);
if holding<0 and llv(l,enterbars+1)<enterprice-50 and c>(llv(l,enterbars+1)+(enterprice-llv(l,enterprice))*0.3) then sellshort(1,0,market);