-- [求助]老师请问下这个问题在哪?
MID := MA(ref(CLOSE,1),26);
UPPER:= MID + 2*STD(ref(CLOSE,1),26);
LOWER:= MID - 2*STD(ref(CLOSE,1),26);
lc:=ref(CLOSE,1);
high1:=ref(high,1);
low1:=ref(low,1);
if holding=0 then BEGIN
if lc>UPPER then
sell(holding>0,0,LIMITr,open);
BUYSHORT(holding=0,1,limitr,open);
if lc<LOWER then
sellshort(holding<0,0,LIMITR,open);
buy(holding=0,1,LIMITR,open);
end
if
(enterbars=1) then begin
highafterentry:=enterprice;
lowafterentry:=enterprice;
end else if (enterbars>1) then begin
highafterentry:=max(highafterentry,high1);
lowafterentry:=min(lowafterentry,low1);
end
if (holding>0 and enterbars>0 ) Then Begin
stopline:=enterprice*0.98;
if max(h,highafterentry)-enterprice>0.02*open then
stopline:=enterprice+0.02*open;
if h>stopline then
sell(holding>0,0,LIMITr,stopline);
end
if (holding<0 and enterbars>0 ) Then Begin
stopline:=enterprice*1.02;
if enterprice-min(l,lowafterentry)>0.02*open then
stopline:=enterprice-0.02*open;
if l<stopline then
sellshort(holding<0,0,LIMITR,stopline);
end
老师请问下 这个代码 哪里有问题 就是价格高于 boll上轨做空 低于下轨最多
然后最大亏损2% 如果触发最大盈利2% 就主动止盈