/#@Fname=MACD2
//#@comment=MACD指标说明
//#|MACD指数平滑异同移动平均线为两条长、短的平滑平均线。
//#|其买卖原则为:
//#|1.DIFF、DEA均为正,DIFF向上突破DEA,买入信号参考。
//#|2.DIFF、DEA均为负,DIFF向下跌破DEA,卖出信号参考。
//#|3.DEA线与K线发生背离,行情可能出现反转信号。
//#|4.分析MACD柱状线,由红变绿(正变负),卖出信号参考;由绿变红,买入信号参考。
//#|
//#@control=DIFF:收盘价的 Param#1 天(短期)平滑移动平均值减去 Param#2
//#|天(长期)平滑移动平均;
//#|DEA:DIFF的 Param#3 天平滑移动平均值;
//#|MACD:2倍的(DIFF-DEA)。
//#|
//#@FuncType=
//#@style=MACD:Line1027,技术指标,1,0,1,2,0;DIFF:Line2,技术指标,1,0,1,0,30059;DEA:Line2,技术指标,1,0,1,0,30063;ZERO:Line0,0;
//#@availperiod=2147430400
//#@param=SHORT=12.0000000001,5.0000000001,40.0000000001,1;LONG=26.0000000001,10.0000000001,200.0000000001,1;M=9.0000000001,2.0000000001,40.0000000001,1;
//#@isDrawCurve=1
//#@Fdesc=MACD
//#@defaultperiod=12293
//#@coord=D
//#@ordinate=0,0.000000;0,0.000000;4,0.000000;0,0.000000;0,0.000000;0;0,0.000000
//#@@FUNCSPEC@=source
rd:=IF(VOL,1,0);
DIFF : EMA(CLOSE,SHORT)*rd- EMA(CLOSE,LONG)*rd;
DEA : EMA(DIFF,M)*rd;
MACD : 2*(DIFF-DEA)*rd;
Zero : 0;