Here is the condition.
put an histogram behind the stochastic as similar as the MACD histogram, where the upside bars are only drawn if %K => 80 and %K =< 20
Here is the Code:
_SECTION_BEGIN("AFl by Debarghya Mukherjee");
periods = Param( "Periods", 8, 1, 200, 1 );
Ksmooth = Param( "%K avg", 3, 1, 200, 1 );
Dsmooth = Param( "%D avg", 4, 1, 200, 1 );
Plot( d1 = StochK( periods , Ksmooth ), "Stochastic (%K)", colorWhite, styleLine );
Plot( StochD( periods , Ksmooth, DSmooth ), "Stochastic (%D)", colorRed, styleLine );
Plot( IIf(d1 <= 80 AND d1 >= 20, d1-20, IIf(d1 > 80, 80-d1, d1-20)), "Histogram", IIf(d1 <= 80 AND d1 >= 20, colorRed, colorGreen) , styleHistogram );
PlotGrid( 80 );
PlotGrid( 20 );
_SECTION_END();
Debarghya Mukherjee
Mobile: (+91)-9038787021
Email: debarghya_mkr@yahoo.com
No comments:
Post a Comment