这里以3分钟图表为例
开仓条件
开盘5个周期后,价格突破前5个周期的最高价,并且5个周期内价格的最高减最低超过10个点,并且5日均线向上,则做多
开盘5个周期后,价格突破前5个周期的最低价,并且5个周期内价格的最高减最低超过10个点,并且5日均线向下,则做空
平仓条件
价格突破前5个周期的最高价,则平掉空单
价格突破前5个周期的最低价,则平掉多单
开盘最后第二个周期全部平仓,并且不再开单
要求能在免费版情况下使用
请问怎么解决,我是菜鸟,求指教,感激不尽
当前K线的均线值比上一周期的均线值大,就是向上,反之向下
ma5:ma(c,5);
n1:=barslast(date<>ref(date,1))+1;
timet:= time>090300 and time<145700;
cond1:=c>ref(hhv(h,5),1) ;
cond2:=c<ref(llv(l,5),1);
cond3:=c>ref(hhv(h,5),1) and ref(hhv(h,5),1)-ref(llv(l,5),1)>=10*mindiff and ma5>ref(ma5,1);
cond4:=c<ref(llv(l,5),1) and ref(hhv(h,5),1)-ref(llv(l,5),1)>=10*mindiff and ma5<ref(ma5,1);
if n1>=5 and timet then begin
if cond1 then sellshort(holding<0,0,market);
if cond2 then sell(holding>0,0,market);
if cond3 then buy(holding=0,1,market);
if cond4 then buyshort(holding=0,1,market);
end
if time>=145700 and time<=150000 then begin
sell(1,0,market);
sellshort(1,0,market);
end