Plot volume in candle shape

hi all,

For the sake of better visual effect, I use the following code to plot volume in a "fat" way:

VolColor = IIf(C >= O, colorGreen, colorRed);
PlotOHLC(0, V, 0, V, "V", VolColor , styleOwnScale|styleCandle, 10 ) ;

The problem is, down volume candles are hollow and I want them solid. Any help is appreciated.

Cheers,
Scott

@zenforker There are many other ways of plotting thick volume bars, for example using regular Plot() with StyleHistogram|StyleThick and/or selecting a specific width parameter (for example "-80"):

width - defines pixel or percent width of given plot. The default is 1 pixel. Positive values specify PIXEL width, negative values specify width in percent of current bar width. So for example -20 will give you dynamic width that is 20% of bar width. Example: Plot( C, "Close", colorBlack, styleBar, Null, Null, 0, 1, -20 /* line width as percent of bar */ );

https://www.amibroker.com/guide/afl/plot.html

... but if you want to use your PlotOHLC code, just add one additional line to fill bars with solid color:

VolColor = IIf(C >= O, colorGreen, colorRed);
SetBarFillColor(VolColor);
PlotOHLC(0, V, 0, V, "V", VolColor , styleOwnScale|styleCandle, 10 ) ;

Regards

2 Likes

Thanks heaps Milosz, your tip has solved my problem:

VolColor = IIf(C >= O, colorGreen, colorRed);
SetBarFillColor(IIf(C < O, VolColor, GetChartBkColor()));
PlotOHLC(0, V, 0, V, "V", VolColor , styleOwnScale|styleCandle, 10 ) ;

Cheers,
Scott

1 Like

@zenforker Just a question here. What the last number 10 means, and why you use it Scott.?

hi Panos,

That number is the minimum height of volume bars. The reason I use it here is to make sure the volume plots are not too high up into chart area and nor too low to be hard for eyes. you can refer to the manual for details:

minvalue and maxvalue - (used by styleOwnScale plots ONLY) define plot minimum and maximum values (lower and upper boundary for Y axis)

Cheers,
Scott

Scott. So that means you are insert this Volume code, in the same chart with the price.
i bet thats why you need it.
Otherwise if it on its own chart you do not need it

PlotOHLC(0, V, 0, V, "V", VolColor , styleCandle ) ;

Edit:
I think this conversation will be useful for the new users. thanks

2 Likes

Exactly. If it is in a separate pane, one probably does not need it.

1 Like

Hi @Milosz
Hav been searching for candles which represents the strength within volume candles. Need the candles to widen or thin down with respect to the strength of the candle as shown in the picture. I didnt use equivolume as it omits the open and close of the candleScreenshot_20200513-010155__01__01

hello @sahav

Τhe afl that you are searching "CandleVolume and EquiVolume charts" is already available in the members library.
http://www.amibroker.com/members/library/detail.php?id=1433
Thanks to @aron :heart:

I kindly invite you to get the "Verified" badge so you can continue to post in this section of the Forum

4 Likes