编写要求:
DIF大于0轴时,macd柱子正值 o轴上为粉色柱子,macd柱子负值,o轴下为白色柱子。 DIF小于0轴时,macd柱子正值 o轴上为红色柱子,macd柱子负值,o轴下为绿色柱子。
www.gszx.com.cn网解答:
SHORT:=12;LONG:=26;MID:=9;
DIF:EMA(CLOSE,SHORT)-EMA(CLOSE,LONG);
DEA:EMA(DIF,MID);
MACD:=(DIF-DEA)*2;
STICKLINE(DIF>0 AND MACD>0,0,MACD,1,0),COLORMAGENTA;
STICKLINE(DIF>0 AND MACD<0,0,MACD,1,0),COLORWHITE;
STICKLINE(DIF<0 AND MACD>0,0,MACD,1,0),COLORRED;
STICKLINE(DIF<0 AND MACD<0,0,MACD,1,0),COLORGREEN;