Hi team,
What's the best way to plot indicator with a price chart in Backtest, like MA inside SPY chart or RSI below SPY chart?
Is there any existing that I can follow?
Thank you.
jianwei
QUANTCONNECT COMMUNITY
Hi team,
What's the best way to plot indicator with a price chart in Backtest, like MA inside SPY chart or RSI below SPY chart?
Is there any existing that I can follow?
Thank you.
jianwei
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Michael Handschuh
var close = Identity("SPY"); var ema = EMA("SPY", 14); var rsi = RSI("SPY", 14); PlotIndicator("SPY", ema, close);
Placing the code above in Initialize will cause the EMA indicator to automatically plot. The identity indicator just returns the current price, so you'll get both your EMA and the closing prices on the same plot. If you want to do a stacked chart you'll need to create your own chart objectvar chart = new Chart("SPY", ChartType.Stacked); chart.AddSeries(new Series(close.Name, SeriesType.Line)); chart.AddSeries(new Series(rsi.Name, SeriesType.Line)); AddChart(chart);
This will define the chart as a stacked type (vs overlay default). You could then plot your indicators using:PlotIndicator("SPY", close, rsi);
One thing to mention, you currently can't combine stacked and overlayed charts on a single chart. So it will either stack them all or overlay them all. Hope this helps!Jianwei Wang
Michael Handschuh
Jianwei Wang
Jared Broad
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Jianwei Wang
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!