Skip to content

Instantly share code, notes, and snippets.

@marketcalls
Created April 28, 2016 05:14
Show Gist options
  • Save marketcalls/03a19737048fec1b717ed972ad5f5144 to your computer and use it in GitHub Desktop.
Save marketcalls/03a19737048fec1b717ed972ad5f5144 to your computer and use it in GitHub Desktop.
VPOC in Amibroker 6.13
// a demo showing
// re-implementation of VAP overlay using
// PriceVolDistribution and low-level graphics
bi = BarIndex();
fvb = FirstVisibleValue( bi );
lvb = LastVisibleValue( bi );
mx = PriceVolDistribution( H, L, V, 100, False, fvb, lvb );
GfxSetCoordsMode( 1 );
GfxSelectPen( colorRed );
bins = MxGetSize( mx, 0 );
for( i = 0; i < bins; i++ )
{
price = mx[ i ][ 0 ]; // price level
relvolume = mx[ i ][ 1 ]; // relative volume 0..1
relbar = relvolume * (lvb-fvb+1);
GfxMoveTo( fvb, price );
GfxLineTo( fvb + relbar, price );
}
Plot( C, "Price", colorDefault, styleBar );
if( ParamToggle("BuildinVAP", "No|Yes") ) PlotVAPOverlay( 100, 100, colorGreen, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment