本帖最后由 技术009 于 2022-11-18 14:14 编辑
[PEL] 复制代码
input:p(26,20,100,8),s(12,5,40,4),m(9,2,60,6);
diff :ema(close,s) - ema(close,p);
dea :ema(diff,m);
macd1 :2*(diff-dea), colorstick;
macdjc:cross(diff,dea),nodraw;//macd金叉
macdsc:cross(dea,diff),nodraw;
ma115:ma(c,115);
majc:cross(c,ma115);
masc:cross(ma115,c);
if majc and macdjc then
begin
buy(holding=0,1,market);
SPEAK(1,'开');
DRAWICON(1,h,4);
end
if masc and macdsc then
begin
sell(1,holding,market);
SPEAK(1,'平');
DRAWICON(1,l,5);
end
你这里 “MACD处于金叉状态时”如果是指macd大于0 就是红柱状态,那么上面条件里macd部分,你要改成 macd1>0 ,死叉状态同理。
否则这种 同时金叉的信号一般很少。
|