Thursday, June 12, 2014

Learn AFL code: How to make a Price band using AFL code


Here is the Code for above image

_SECTION_BEGIN("Debarghya: AFL Coding");

SetBarFillColor( IIf( Close > Open, colorWhite, colorBlack ) );
Plot(C, "Price", colorRed, styleCandle );

Title = " {{NAME}} {{DATE}} {{INTERVAL}} "+"Debarghya: AFL Coding";

Plot(EMA(C,3),"EMA(3)",colorGreen,styleLine);
Plot(EMA(C,13),"EMA(13)",colorYellow,styleLine);

//PlotOHLC( Open,High,Low,Close, "MA", colorRed, styleCandle);
PlotOHLC( EMA(C,3),EMA(C,3),EMA(C,13),EMA(C,13), "EMA BAND", IIf( EMA(C,3)>EMA(C,13) , colorDarkBlue , colorRed ), styleCloud);
_SECTION_END();


Well this a humble band of EMA(3) and EMA(13) along with the price. Entire band is easy to visualize. PlotOHLC() function is making this band.
PlotOHLC( open, high, low, close, name, color/barcolor, style = styleCandle | styleOwnScale, minvalue = {empty}, maxvalue = {empty}, XShift = 0, ZOrder = 0 )


Debarghya Mukherjee
Mobile: (+91)-9038787021
Email: debarghya_mkr@yahoo.com

No comments:

Post a Comment