Hello,
There is small problem with PriceVolDistribution example given in read me.
The formula itself works fine if it is already in the chart.
Problem is with the fact that FirstVisibleValue / LastVisibleValue give some negative values
at the moment when formula is applied and chart is not yet visible at all.
To prevent the problem, check fvb / lvb values prior to passing them to PriceVolDistribution
fvb = Max( 0, fvb );
lvb = Max( 0, lvb );
Whole fixed formula:
// a demo showing
Best regards,
// re-implementation of VAP overlay using
// PriceVolDistribution and low-level graphics
bi = BarIndex();
fvb = FirstVisibleValue( bi );
lvb = LastVisibleValue( bi );
fvb = Max( 0, fvb );
lvb = Max( 0, lvb );
mx = PriceVolDistribution( H, L, V, 100, False, fvb, lvb );
GfxSetCoordsMode( 2 );
GfxSelectPen( colorRed );
width = Status("pxwidth");
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( 0, price );
GfxLineTo( width * relvolume, price );
}
Plot( C, "Price", colorDefault, styleBar );
if( ParamToggle("BuildinVAP", "No|Yes") ) PlotVAPOverlay( 100, 100, colorGreen, 2 );
Tomasz Janeczko
amibroker.com
Hello, AmiBroker 6.13.0 BETA is released now http://www.amibroker.com/devlog/2016/04/24/amibroker-6-13-0-beta-released/ Enjoy. Best regards, Tomasz Janeczko amibroker.com ------------------------------------ ------------------------------------ **** IMPORTANT PLEASE READ **** This group is for the discussion between users only. This is *NOT* technical support channel. TO GET TECHNICAL SUPPORT send an e-mail directly to SUPPORT {at} amibroker.com TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at http://www.amibroker.com/feedback/ (submissions sent via other channels won't be considered) For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: http://www.amibroker.com/devlog/ ------------------------------------ Yahoo Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/amibroker/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/amibroker/join (Yahoo! ID required) <*> To change settings via email: amibroker-digest@yahoogroups.com amibroker-fullfeatured@yahoogroups.com <*> To unsubscribe from this group, send an email to: amibroker-unsubscribe@yahoogroups.com <*> Your use of Yahoo Groups is subject to: https://info.yahoo.com/legal/us/yahoo/utos/terms/
Posted by: Tomasz Janeczko <groups@amibroker.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (7) |
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
EmoticonEmoticon