February 9, 2020

Magnified close AFL

Edit: this code was first posted in 03/2015 and is now modified to change color depending on whether the bar close is in positive or negative.

Green vertical line is currently selected bar.

Modified code is highlighted.

Close in positive:



Close in negative:





Code is pretty simple - use low level graphics functions. The AFL is:



_SECTION_BEGIN("Magnified close");
//Copyright: Kamalesh Langote http://www.vfmdirect.com Email: kpl@vfmdirect.com
Param_Color=ParamColor( "Color", colorCycle );
toggle_mclose = ParamToggle("Magnified Close","Show|Hide",1);
if( toggle_mclose )  {
x = Status( "pxchartwidth");
y = Status( "pxchartheight" ) ;
GfxSetOverlayMode(1);
GfxSelectFont( "arial",0.1*y,800);
GfxSetTextColor(IIf(SelectedValue(ROC(C,1))>0,colorBlue,colorRed));
GfxTextOut(""+WriteVal(C,1.2)+"",0.8*x,0.05*y);} else {}
_SECTION_END();


No comments:

Post a Comment

Share this...