掉头向上怎么定义?
连续5日指的是macd的值一个比前一个小?
DIFF : EMA(CLOSE,12) - EMA(CLOSE,26);
DEA : EMA(DIFF,9);
MACD1 : 2*(DIFF-DEA), COLORSTICK;
a:ALL(ref(MACD1,1)>macd1 , 5);//连续5个周期macd减少
是的,连续5日指的是macd的值一个比前一个小。
掉头向上是指当天的macd上穿昨天的macd,就是比昨天的大。
老师,我对以上公式进行后台回测(所有股票的周K线),怎么就没有一个符合条件,有什么地方不对?
macd:=stkindi('','macd.macd1',0,7);
diff:=stkindi('','macd.diff',0,7);
dea:=stkindi('','macd.dea',0,7);
if ALL(ref(macd,1)>macd,5) and macd>ref(macd,1) and tbuyholding(1)=0 and TTOTALDAYTRADE<1 then tbuy(1,10000/close,mkt);
if CROSS(ref(macd,1),macd) and tbuyholding(0)>0 then tsell(1,0,mkt);
抱歉,ALL(ref(macd,1)>macd,5) and macd>ref(macd,1) 这个条件更改下,
ref(ALL(ref(macd,1)>macd,5),1) and macd>ref(macd,1)
因为掉头的判断应该是上根k线的连续5日指的是macd的值和当前的macd做比较。之前代码逻辑有问题
ref(ALL(ref(macd,1)>macd,5),1) and macd>ref(macd,1)还是没有结果。
怎么输出各个条件,帮忙写一下好吗?