Hello,
I need to draw the MACD histogram of 30 minutes in a 5-minute chart. I also need that when the MACD histogram to rise, even when below zero, is of a color and if it is reduced, even if greater than zero is of a different color.
I managed to draw, but I can not succeed with the colors.
Can you help me?. Thank you very much,
Herewith the AFL I've written.
Regards,
_SECTION_BEGIN("MACD");
r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );
TimeFrameSet(in1Minute * 30);
ml30 = MACD (r1, r2);
sl30 = Signal(r1,r2,r3);
rl30= ml30 - sl30;
TimeFrameRestore ();
rl1 = TimeFrameExpand (rl30, in1Minute * 30);
Color13 = IIf (rl1 > Ref ( rl1, -1), colorWhite, colorBlack);
//Plot( ml = MACD(r1, r2), StrFormat(_SECTION_NAME()+"(%g,%g)", r1, r2), ParamColor("MACD color", colorRed ), ParamStyle("MACD style") );
//Plot( sl = Signal(r1,r2,r3), "Signal" + _PARAM_VALUES(), ParamColor("Signal color", colorBlue ), ParamStyle("Signal style") );
Plot( rl1, "MACD Histogram", Color13, styleNoTitle | ParamStyle("Histogram style", styleHistogram | styleNoLabel, maskHistogram ) );
Plot (100, "", IIf( rl1> Ref (rl1, -1), colorPaleGreen, colorPink), styleArea+styleOwnScale, 0, 1);
_SECTION_END();
I need to draw the MACD histogram of 30 minutes in a 5-minute chart. I also need that when the MACD histogram to rise, even when below zero, is of a color and if it is reduced, even if greater than zero is of a different color.
I managed to draw, but I can not succeed with the colors.
Can you help me?. Thank you very much,
Herewith the AFL I've written.
Regards,
_SECTION_BEGIN("MACD");
r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );
TimeFrameSet(in1Minute * 30);
ml30 = MACD (r1, r2);
sl30 = Signal(r1,r2,r3);
rl30= ml30 - sl30;
TimeFrameRestore ();
rl1 = TimeFrameExpand (rl30, in1Minute * 30);
Color13 = IIf (rl1 > Ref ( rl1, -1), colorWhite, colorBlack);
//Plot( ml = MACD(r1, r2), StrFormat(_SECTION_NAME()+"(%g,%g)", r1, r2), ParamColor("MACD color", colorRed ), ParamStyle("MACD style") );
//Plot( sl = Signal(r1,r2,r3), "Signal" + _PARAM_VALUES(), ParamColor("Signal color", colorBlue ), ParamStyle("Signal style") );
Plot( rl1, "MACD Histogram", Color13, styleNoTitle | ParamStyle("Histogram style", styleHistogram | styleNoLabel, maskHistogram ) );
Plot (100, "", IIf( rl1> Ref (rl1, -1), colorPaleGreen, colorPink), styleArea+styleOwnScale, 0, 1);
_SECTION_END();