三根K的收盘价,连续一根比一根大,中间若有相等的则跳过,看下一根,符合条件的开多;成交后,碰到收盘价低于前一根则平仓
有一个问题 如果连续超过3根K都满足你说的条件,比如连续五个K都满足,处理逻辑是怎样的?第四个K,第五个K都会满足连续三个K递增的条件。要连续开仓还是如何?
a:if(ref(c,1)>c,-1,if(ref(c,1)=c,0,1));
VARIABLE:m:=0;
if a=-1 then m:=0;
if a=0 then m:=m+0;
if a=1 then m:=m+1;
result:m;
if holding=0 and m>=3 then buy(holding=0,1,market);
if holding>0 and c<ref(c,1) then sell(holding>0,1,market);