//MACD - Moving Average Convergence Divergence v1 //adapted from code by Tomasz Janeczko //ideas by Graham Kavanagh and Terry Magic //1 in the code is numeric one and not alpha "l" r1 = Param( "Fast avg", 12, 2, 200, 1 ); r2 = Param( "Slow avg", 26, 2, 200, 1 ); r3 = Param( "Signal avg", 9, 2, 200, 1 ); m1 = MACD(r1, r2); s1 = Signal(r1,r2,r3); difference = m1-s1; Plot( m1, StrFormat(_SECTION_NAME()+"(%g,%g)", r1, r2), ParamColor("MACD color", colorRed ), ParamStyle("MACD style") ); Plot( s1, "Signal" + _PARAM_VALUES(), ParamColor("Signal color", colorBlue ), ParamStyle("Signal style") ); Color=IIf(difference > 0,colorGreen,colorRed); Plot(difference, "MACD Histogram", Color, styleNoTitle | ParamStyle("Histogram style", styleHistogram | styleThick | styleNoLabel, maskHistogram ) );