if tholding2=0 then begin
extgbdataset('maxprofit',0);
//判断当前持仓状态下的最大盈利
win:=0;
win2:=0;
end
if tavgenterprice>0 then begin
debugout('最新开仓价tavgenterprice=%2.f',tavgenterprice);
maxprofit:=extgbdata('maxprofit');
if tholding2 > 0 then
begin
win:=(c-tavgenterprice)/tavgenterprice*100; //记录最大盈利
if win > maxprofit then extgbdataset('maxprofit',win);
win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度
end
if tholding2 < 0 then
begin
win:=(tavgenterprice-c)/tavgenterprice*100; //记录最大盈利
if win > maxprofit then extgbdataset('maxprofit',win);
win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度
end
end
//出现浮动亏损比如2%平仓
多止损:TSELL(win<=-1*止损,0);
空止损:TSELLshort(win<=-1*止损,0);
//出现最高盈利后,回落到盈利的40%平仓出场
多止赢:TSELL(maxprofit>止盈 and win2 >= 50 and topenprofit>0,0);
空止赢:TSELLshort(maxprofit>止盈 and win2 >= 50 and topenprofit>0,0);
管理器里有值,会不会是,因为比例的原因,小数位太小,系统反应不过来?
程序本身在全局变量的应用上有问题吗
Tsell参数不全~
跟踪了一下,那个maxprofitr 全局变量怎么还会缩小的?按程序要求是记录最大值的。