if TBUYHOLDINGEX('','',1)> 0 and tenterbars > 0 then begin win:=(c-tenterprice)/tenterprice*100; //记录最大盈利 if win > maxprofit then maxprofit:=win;
win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度 end //你代码里面没有空头开仓,这部分代码无论是原先的图表的还是现在改写的都是无效的。 if TSELLHOLDINGEX('','',1)>0 and tenterbars > 0 then begin win:=(tenterprice-c)/tenterprice*100; //记录最大盈利 if win > maxprofit then maxprofit:=win;
win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度 end
//出现浮动亏损比如2%平仓 止损:tSELL(win < -2,0);
//出现最高盈利后,回落到盈利的60%平仓出场 止赢:tSELL(win2 >= 60 and topenprofit > 0, 0);