PlotVAPOverlayA
- plot multiple-segment Volume-At-Price chart

Indicators
(AmiBroker 5.20)


SYNTAX PlotVAPOverlayA( segments, lines = 300, width = 80, color = colorLightGrey, vapstyle = 4);
RETURNS NOTHING
FUNCTION Plots multiple Volume At Price charts at user-defined points.

Parameters:

segments - is an array which holds 0 and 1 (False/True) values, where 1 indicates starting/ending point of each VAP segment

AmiBroker will draw as many segments as there are '1' in the array. Note that minimum segment length is 2, so if entire array is filled with 1-s only, it won't draw anything. In other words, there must be zeros (at least one) between 1's.

lines - number of vertical lines (resolution)

width - percentage width of the VAP overlay relatative to segment length (0..100)

color - the color of VAP chart

vapstyle

  • vapstyle = 0 - left side, area fill, on top of all plots
  • vapstyle = 1 - right side, area fill, on top of all plots
  • vapstyle = 2 - left side, lines only, on top of all plots
  • vapstyle = 3 - right side, lines only, on top of all plots
  • vapstyle = 4 - left side, area fill, behind all plots
  • vapstyle = 5 - right side, area fill, behind all plots
  • vapstyle = 6 - left side, lines only, behind all plots
  • vapstyle = 7 - right side, lines only, behind all plots
EXAMPLE

Simplest example:

Plot(C, "Close", colorBlack, styleCandle );
segments =
IIf( Interval() < inDaily, Day(), Month() ); // draw daily or monthly VAP segments depending on display interval
segments = segments !=
Ref( segments , -1 );

PlotVAPOverlayA( segments );


More complex example:
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("VAP");
segments =
IIf( Interval() < inDaily, Day(), Month() );
segments = segments !=
Ref( segments , -1 );

PlotVAPOverlayA( segments ,
Param("Lines", 300, 100, 1000, 1 ), Param("Width", 80, 1, 100, 1 ), ParamColor("Color", colorGold ), ParamToggle("Side", "Left|Right" ) | 2 * ParamToggle("Style", "Fill|Lines", 0) | 4*ParamToggle("Z-order", "On top|Behind", 1 ) );
Plot(segments, "", colorLightGrey, styleHistogram | styleOwnScale );
_SECTION_END();

SEE ALSO PLOTVAPOVERLAY() function

References:

The PlotVAPOverlayA function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.