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% 就主动止盈
老师请问下 这个代码 哪里有问题 就是价格高于 boll上轨做空 低于下轨做多
然后最大亏损2% 如果触发最大盈利2% 就主动止盈
麻烦老师指导下 要怎么写 改进
找了一台电脑重装 但是 范例里面 用了 if c-avgenterprice>50*mindiff then begin
sell(1,holding,market);
但是这样的止盈 测试下来 用了次周期开盘价 实际我是需要 当K线触发止盈 这样的话需要怎么写 ?
这样写是对的,market只表示价格不表示下时间,你要即时触发,在图表交易里面设置为固定轮询模式,轮询间隔1秒