文华财经macd多空买卖点交易幅图指标公式源码:
DIFF:EMA(CLOSE,12) – EMA(CLOSE,26);
DEA:EMA(DIFF,9);
MACD:2*(DIFF-DEA),COLORSTICK;
JC:=CROSS(DIFF,DEA);
SC:=CROSSDOWN(DIFF,DEA);
N1:=BARSLAST(JC)+1;
N2:=BARSLAST(SC)+1;
HH:=VALUEWHEN(CROSSDOWN(DIFF,DEA),HHV(H,N1));//上次MACD红柱期间合约最大值
HH2:=VALUEWHEN(CROSSDOWN(DIFF,DEA),REF(HH,1));//上上次MACD红柱期间合约最大值
LL:=VALUEWHEN(CROSS(DIFF,DEA),LLV(L,N2));//上次MACD绿柱期间合约最小值
LL2:=VALUEWHEN(CROSS(DIFF,DEA),REF(LL,1));//上上次MACD绿柱期间合约最小值
A:=CROSSDOWN(DIFF,DEA)&&HH<=HH2;
B:=CROSS(DIFF,DEA)&&LL>=LL2;
DRAWTEXT(A&&DIFF<0,MACD,’空’);
DRAWTEXT(B&&DIFF>0,MACD,’多’);