<\/a><\/p>\nHere is the code that produced the above image:<\/p>\n
GraphXSpace <\/span>= <\/span>5<\/span>; <\/span>\/\/ See the AmiBroker help on how to init these variables\r<\/span>GfxSetBkMode<\/span>( <\/span>bkmode <\/span>= <\/span>2 <\/span>);\r<\/span>GfxSetOverlayMode<\/span>( <\/span>mode <\/span>= <\/span>0 <\/span>);\r<\/span>GfxSelectPen<\/span>( <\/span>colorRed <\/span>);\r \r<\/span>Plot<\/span>( <\/span>C<\/span>, <\/span>""<\/span>, <\/span>colorBlack<\/span>, <\/span>styleLine <\/span>); <\/span>\/\/ To define miny and maxy\r#include <GFXInclude-001.afl> \/\/ Located in your default Include folder\r \r\/\/ Example to draw cross-hair cursor\r<\/span>Yprice <\/span>= <\/span>GetCursorYPosition<\/span>(<\/span>0<\/span>);\r<\/span>XIndex <\/span>= <\/span>SelectedValue<\/span>(<\/span>GetVisualBarIndex<\/span>( ));\r<\/span>gfxPlotHLine<\/span>( <\/span>GetYPixels<\/span>( <\/span>YPrice <\/span>), <\/span>colorRed <\/span>);\r<\/span>gfxPlotVLine<\/span>( <\/span>GetXPixels<\/span>( <\/span>XIndex <\/span>), <\/span>colorRed <\/span>);<\/span><\/pre>\nThe include file listed below defines the following variables:<\/p>\n
<\/span>\/\/ pxwidth, pxheight, Miny, MinX, YRange, VisBarIndex, NumBarsVisible, pxPaneWidth, pxPaneheight, PixelsPerBar, PixelsPerPrice<\/span><\/pre>\nYou may want to copy the above comment line below the #include statement in your code to refresh your memory. You should copy the Include file to your default AmiBroker Include folder.<\/p>\n
<\/span>\/\/ GFXInclude-001.afl copy to default include folder\r\r<\/span>function <\/span>gfxPlotHLine<\/span>( <\/span>YPixels<\/span>, <\/span>Color <\/span>)\r{\r global <\/span>pxwidth<\/span>;\r <\/span>GfxSelectPen<\/span>( <\/span>Color <\/span>) ;\r <\/span>GfxMoveTo<\/span>( <\/span>0<\/span>, <\/span>YPixels <\/span>);\r <\/span>GfxLineTo<\/span>( <\/span>pxwidth<\/span>, <\/span>YPixels <\/span>);\r}\r \rfunction <\/span>gfxPlotVLine<\/span>( <\/span>XPixels<\/span>, <\/span>Color <\/span>)\r{\r global <\/span>pxheight<\/span>;\r <\/span>GfxSelectPen<\/span>( <\/span>Color <\/span>) ;\r <\/span>GfxMoveTo<\/span>( <\/span>XPixels<\/span>, <\/span>0 <\/span>);\r <\/span>GfxLineTo<\/span>( <\/span>XPixels<\/span>, <\/span>pxheight <\/span>);\r}\r \rfunction <\/span>GetVisualBarIndex<\/span>( )\r{\r <\/span>lvb <\/span>= <\/span>Status<\/span>( <\/span>"lastvisiblebar" <\/span>);\r <\/span>fvb <\/span>= <\/span>Status<\/span>( <\/span>"firstvisiblebar" <\/span>);\r <\/span>bi <\/span>= <\/span>BarIndex<\/span>();\r <\/span>StaticVarSet<\/span>( <\/span>"NumberbarsVisible"<\/span>, <\/span>Lvb <\/span>- <\/span>fvb <\/span>+ <\/span>1 <\/span>);\r return <\/span>bi <\/span>- <\/span>bi<\/span>[ <\/span>0 <\/span>] - <\/span>fvb<\/span>;\r}\r\rfunction <\/span>GetYPixels<\/span>( <\/span>Y <\/span>)\r {\r global <\/span>PixelsPerPrice<\/span>, <\/span>pxTopArea<\/span>, <\/span>MaxY<\/span>; \r return (<\/span>MaxY <\/span>- <\/span>Y<\/span>) * <\/span>PixelsPerPrice <\/span>+ <\/span>pxTopArea<\/span>;\r }\r\rfunction <\/span>GetXPixels<\/span>( <\/span>X <\/span>)\r {\r global <\/span>PixelsPerBar<\/span>, <\/span>pxLeftArea<\/span>;\r return <\/span>X <\/span>* <\/span>PixelsPerBar <\/span>+ <\/span>pxLeftArea<\/span>;\r }\r\r<\/span>_SECTION_BEGIN<\/span>(<\/span>"GFX INITIALIZATION"<\/span>);\r<\/span>\/\/ These Parameters will change depending on screen layout\/fonts\r<\/span>pxRightArea <\/span>= <\/span>Param<\/span>( <\/span>"Right Axis Area"<\/span>, <\/span>93<\/span>, <\/span>0<\/span>, <\/span>200<\/span>, <\/span>1 <\/span>); <\/span>\/\/ Depends on font\r<\/span>pxDateArea <\/span>= <\/span>Param<\/span>( <\/span>"Date Axis Area"<\/span>, <\/span>11<\/span>, <\/span>0<\/span>, <\/span>100<\/span>, <\/span>1 <\/span>); <\/span>