How to Refine Volume-at-Price Indicator in Amibroker

#1
Hello Seniors,

Like any beginner I am so much busy in watching the leaves (i.e., the charts) that I do not see the forest (the general market).

Now, I want some help with the volume-at-price indicator in Amibroker. Can the histogram be made to show the brought and sold strength in green and red?

Can the lines (currently 100-1000) be replaced by the no of bars as in QuoteTracker?

I would also be grateful for afls regarding volume based indicators.

Thanks.
 
#2
Hello Seniors,

Like any beginner I am so much busy in watching the leaves (i.e., the charts) that I do not see the forest (the general market).

Now, I want some help with the volume-at-price indicator in Amibroker. Can the histogram be made to show the brought and sold strength in green and red?

Can the lines (currently 100-1000) be replaced by the no of bars as in QuoteTracker?

I would also be grateful for afls regarding volume based indicators.

Thanks.
Hello,

In AmiBroker, you can see Volume-at-price indicator in well separated lines as in QuoteTracker. For this purpose, you will have to use PlotVAPOverlayA() function instead of normal PlotVAPOverlay() function.

_SECTION_BEGIN("Volume-at-Price");

MySegment = Interval();

PlotVAPOverlayA( MySegment, Param("Lines", 300, 100, 1000, 1 ), Param("Width", 50, 1, 100, 1 ), ParamColor("Color", colorGreen), ParamToggle("Side", "Left|Right" ) | 2 * ParamToggle("Style", "Fill|Lines", 0) | 4*ParamToggle("Z-order", "On top|Behind", 1 ) );

_SECTION_END();

Here you will see that the lines are well-separated, as in QuoteTracker. You can look at "lines" as the resolution of the Volume-at-Price chart. Thick bars actually will make separation of bars very difficult to spot the difference between adjacent prices. So in my opinion, lines provide a finer control over the look and feel of the chart than bars.

The advantage of PlotVAPOverlayA() is that you can divide Volume-at-Price in segments as per your choice. Say, if you want to see intraday charts with Volume-at-price for each day separately, you can re-write this code as :

_SECTION_BEGIN("Volume-at-Price");

MySegment = Day();
MySegment = MySegment != Ref( MySegment, -1 );

PlotVAPOverlayA( MySegment, Param("Lines", 300, 100, 1000, 1 ), Param("Width", 50, 1, 100, 1 ), ParamColor("Color", colorGreen), ParamToggle("Side", "Left|Right" ) | 2 * ParamToggle("Style", "Fill|Lines", 0) | 4*ParamToggle("Z-order", "On top|Behind", 1 ) );

_SECTION_END();

Now you will see that Volume-at-price is "grouped by" day. As usual, you can right click on the chart, go to Parameters and edit colour for the lines, no. of lines, width, display location, etc..

Also, because volumes are summed-up on particular price levels, there may be several candles summing up to a particular level - so having colour coded lines is not really possible.

Enclosed herewith is the screenshot for 2nd variation.

As regards to indicators, please visit online AFL library at http://www.amibroker.com/library/list.php where you will find AFL for lot of indicators and much more.

I hope this helps.

Best regards,

AmiBroker-India
 

Attachments

RSI

Well-Known Member
#3
Hello,

In AmiBroker, you can see Volume-at-price indicator in well separated lines as in QuoteTracker. For this purpose, you will have to use PlotVAPOverlayA() function instead of normal PlotVAPOverlay() function.

_SECTION_BEGIN("Volume-at-Price");

MySegment = Interval();

PlotVAPOverlayA( MySegment, Param("Lines", 300, 100, 1000, 1 ), Param("Width", 50, 1, 100, 1 ), ParamColor("Color", colorGreen), ParamToggle("Side", "Left|Right" ) | 2 * ParamToggle("Style", "Fill|Lines", 0) | 4*ParamToggle("Z-order", "On top|Behind", 1 ) );

_SECTION_END();

Here you will see that the lines are well-separated, as in QuoteTracker. You can look at "lines" as the resolution of the Volume-at-Price chart. Thick bars actually will make separation of bars very difficult to spot the difference between adjacent prices. So in my opinion, lines provide a finer control over the look and feel of the chart than bars.

The advantage of PlotVAPOverlayA() is that you can divide Volume-at-Price in segments as per your choice. Say, if you want to see intraday charts with Volume-at-price for each day separately, you can re-write this code as :

_SECTION_BEGIN("Volume-at-Price");

MySegment = Day();
MySegment = MySegment != Ref( MySegment, -1 );

PlotVAPOverlayA( MySegment, Param("Lines", 300, 100, 1000, 1 ), Param("Width", 50, 1, 100, 1 ), ParamColor("Color", colorGreen), ParamToggle("Side", "Left|Right" ) | 2 * ParamToggle("Style", "Fill|Lines", 0) | 4*ParamToggle("Z-order", "On top|Behind", 1 ) );

_SECTION_END();

Now you will see that Volume-at-price is "grouped by" day. As usual, you can right click on the chart, go to Parameters and edit colour for the lines, no. of lines, width, display location, etc..

Also, because volumes are summed-up on particular price levels, there may be several candles summing up to a particular level - so having colour coded lines is not really possible.

Enclosed herewith is the screenshot for 2nd variation.

As regards to indicators, please visit online AFL library at http://www.amibroker.com/library/list.php where you will find AFL for lot of indicators and much more.

I hope this helps.

Best regards,

AmiBroker-India
Hello,

I wanted one clarification.

There is an in built indicator by name "volume at price multi" in amibroker 5.2 version. What is the difference between that in built indicator and the afl code posted by you?
 
#4
Hello,

I wanted one clarification.

There is an in built indicator by name "volume at price multi" in amibroker 5.2 version. What is the difference between that in built indicator and the afl code posted by you?
Hello,

The built-in indicator adds one more possibility than the one I have given. For example purpose, I have just considered Day() as the segment so that whenever you are seeing intraday charts, volume-at-price will be "grouped by" day. Whereas built-in indicator goes one step higher and lets you group by months also when you are viewing daily charts.

For those who want this functionality, just replace the previous code

MySegment = Day();

to :

MySegment = IIf(Interval() < inDaily, Day(), Month());


Best regards,

AmiBroker-India
 
#5
Hello,

Sorry in being late to thank you all for your replies, I was away. I shall try your suggestions.

Thanks for now, shall get back for more.
 

kkseal

Well-Known Member
#6
Is it possible to group the VAP by (last) 5/10/15/20 days? (not discrete week, month etc. but a continuous no. of days)

The plot would be a daily plot as the 'Segment' would change each day.

Regards
 
Last edited:
#7
Is it possible to group the VAP by (last) 5/10/15/20 days? (not discrete week, month etc. but a continuous no. of days)

The plot would be a daily plot as the 'Segment' would change each day.

Regards
Hello,

Yes it is possible. To do this, key will be to define your own interval in your code, as we have Day(), Month(), etc..

Code is enclosed below.

_SECTION_BEGIN("Customized VAP");
segment = Param("Enter the segment value in days", 2,2,100,1);
MyInterval = Null;

// Now we will have to create group of candles as per the segment value entered above
// and keep them under one segment

for(i=0;i<BarCount;i++)
{
MyInterval= ceil(i/segment);
}


MyInterval= IIf( Interval() < inDaily, Day(),MyInterval);
MyInterval = MyInterval!= Ref(MyInterval, -1);

PlotVAPOverlayA( MyInterval, Param("Lines", 100, 100, 1000, 1 ), Param("Width", 50, 1, 100, 1 ), ParamColor("Color", colorGold ), ParamToggle("Side", "Left|Right" ) | 2 * ParamToggle("Style", "Fill|Lines", 1) | 4*ParamToggle("Z-order", "On top|Behind", 1 ) );
_SECTION_END();

When you run the code above, enter the number of days as per which you want VAP to be grouped under "Enter the segment Value in Days" in Parameters. It then displays VAP as per your choice when in Daily mode. If you go to intraday mode, it ignores your segment and displays VAP grouped by Day.

AFL file in text is enclosed herewith to avoid copy-paste mistakes.

I hope this helps.

With regards,

AmiBroker-India
 
#9
Hello Amibroker-india/All,

Can anyone please code an AFL that can plot the Quotetracker Volume lines that appear when we choose the Volume by Price indicator with the settings as indicated in the screen shot.

- Raghu
 

Attachments

Similar threads