Click here to Login

                                                   Limiting the scale of a candlestick chart with volume?


Josh McCormick
2020-07-07 16:36:10

I've got a pane that combines a candlestick chart with a volume chart (and a couple of info boxes).
I'm having problems controlling the scale of the volume chart. It wants to fill 100% of the pane.
How can I position the volume chart to be at the bottom of the pane and still consume no more than 20% of the vertical space?

FORMULA ===============================================
PrintChart(Name()." STOCK CHART", "", BottomCenter, colorBlack, colorBlack, colorWhite, 200);
p = SymbolInformation();

PlotCandleStick("Quotes", colorBrown|255|colorViolet|255|0, StyleSymbolVdash);
plot(volume, "Volume", colorLightGreen|100, ChartBar, StyleOwnScale|StyleHideValues|StyleHideYAxisValue);
UpdateSettings("Top-Bottom Chart Margin", 0);

SCREENSHOT =============================================

2020-07-09 12:10:45


I see a volume bar going to the "Date" text at the top. I don't see any issue here.
If that bar has a volume of say 100 and the other ones have 10 as volume then it is normal that the other bars will only take 10% of the chart height.

Josh McCormick
2020-07-09 13:24:04


The chart is not flawed, it just isn't what I'm after.

If instead, I want the largest volume bar to only reach a height of 20% (of the available space in the pane), how do I code that limitation?

My preference is to limit how much the volume chart can overlap with the stock chart. (See: Yahoo Finance stock charts)

2020-07-13 12:50:43


Best Answer
After the plot volume and updatecolor lines, add this:

Plot(volume * 5, "Volume", colorTransparent, ChartNone, StyleOwnScale);
UpdateSettings("MergeWithPreviousOwnScale", 1);

Other solutions:
You can put the volume on the lower pane or make it more transparent.

Josh McCormick
2020-07-13 20:50:57


MergeWithPreviousOwnScale? Awesome!
That fixed things up just *perfect*. Thank you, sir!

No more messages


No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"


Trading Items
Enhanced Candlestick Chart with Volume Variation
Stocks with an EPS Several Times Higher than the Industry Average...
Stocks with the highest Volume Increase
Trading Rules to use with the Trading System Optimizer
Update the Stock Exchange Associated With U.S. Stocks - Market Fi...

How-to Lessons
How to plot a time-series that do not update the chart scale
How to scale and move the chart Y-axis
How to plot a stock using different periods in the same chart
How to display the bar index of a stock on a chart
How to create a chart with a black background

Related Forum Threads
TO SHARE: Candlestick chart with a few interesting features
Locks up when market is open while using the *daily* chart with I...
Horizontal line on the intraday chart with the day's opening pric...
Basic features and some issues with the background
Is it possible to make a spread chart with futures contracts?

Blog Posts
How to Use the Percentage Scale
Chart Layouts Explained - With Custom Scripts
Custom Shortcuts - Move a Chart to Display the Last Quotes/Data
Backtesting chart patterns using the auto support and resistance ...
Detect chart patterns using the auto support/resistance indicator

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2023
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Follow us on Google+
RSS Trading Items

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.