//判断当前持仓状态下的亏损
variable1:minloss=0;//有仓位时亏损幅度
win0:=0;
win02:=0;
if holding > 0 and enterbars > 0 then
begin
win0:=(c-enterprice)/enterprice*100; //记录亏损
minloss:=win0;
win02:=5*MINDIFF; //亏损
end
if holding < 0 and enterbars > 0 then
begin
win0:=(enterprice-c)/enterprice*100; //记录亏损
if win0 > minloss then
minloss:=win0;
WIN02:=5*MINDIFF;
end
//出现亏损win0=win02=5*MINDIFF后平仓出场
止损1:SELL(win>=win02 and openprofit > 0, 0);
系统提示:没有定义minloss。有可能请金老师帮忙写一下记录亏损和亏损达到5*MINDIFF平仓!
谢谢
谢谢
问题在哪里啊?
//判断当前持仓状态下的亏损
variable:maxloss=0;//有仓位时亏损幅度
win0:=0;
win02:=0;
if holding > 0 and enterbars > 0 then
begin
win0:=(enterprice-c)/enterprice*100; //记录亏损
if win0<minloss then
maxloss:=win0;
win02:=20*MINDIFF; //亏损
end
if holding < 0 and enterbars > 0 then
begin
win0:=(c-enterprice)/enterprice*100; //记录亏损
if win0<minloss then
maxloss:=win0;
WIN02:=20*MINDIFF;
end
//出现亏损win0=win02=20*MINDIFF后平仓出场
止损:SELL(win>=win02 and openprofit > 0, 0);