Using a Separate Chart Axis for MACD and Price Data
Summary
This tutorial explains how to add a second vertical axis to a trading chart when plotting an indicator with a very different scale from market prices. Its example combines candlesticks for a futures instrument with MACD lines. Because the MACD values are small relative to contract prices, plotting both on one axis can make each series difficult to read.
The method creates a second axis, assigns the indicator series to it, and keeps the price bars on the original axis. The example initializes the chart, waits for enough records, plots the price and indicator series, then updates the lines as new records arrive. It also illustrates handling the latest and preceding bars. The document includes code and mentions a backtest screenshot, but supplies no trading-performance analysis; its contribution is chart presentation and data visualization rather than a signal strategy.
Key ideas
- A large scale difference between prices and an indicator can obscure both when they share one chart axis.
- A second vertical axis lets price bars and indicator lines use separate scales.
- The example places MACD components on the added axis while leaving candlesticks on the primary axis.
- The tutorial demonstrates ongoing chart updates but does not evaluate trading returns.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.