if c>ref(c,1) then buy(holding=0,1,market);
一句代码就行了。
如果一根比一根收盘大, 只开三次,每次一手。等到收盘小于前一根时,全部平仓,并且开空一手,最多也是连续开三次。反复如此。谢谢好老师再帮下
if ref(c,1)<c then
begin
sellshort(holding<0,holding,market);
buy(holding<3 and holding>=0,1,market);
end
if c<ref(c,1) then
begin
sell(holding>0,holding,market);
buyshort(holding<=0 and abs(holding)<3,1,market);
end
持仓:holding;