I am new to QuantConnect's Lean engine and I am backtesting a strategy locally.
On the website IDE platform I am able to chart custom charts - the price chart, indicators, etc. - but when I run it locally, it does not work and only appears the strategy performance.
If I open the backtesting data file (locally), there is nothing there regarding the custom charts.
I've created the charts with this info:
https://www.quantconnect.com/docs/algorithm-reference/charting
It works on the online platform, but not locally. I tried searching for info here (but to no avail):
https://www.quantconnect.com/tutorials/open-source/lean-report-creator
Is there a way of accomplishing this?
Or do I need to create my own frontend to display this data?
Here's an example:
public class Strategy : QCAlgorithm
{
public override void Initialize()
{
Chart stockPlot = new Chart( "Trade Plot" );
Series assetPrice = new Series( "Price", SeriesType.Line, "$", Color.Blue );
stockPlot.AddSeries( assetPrice );
Series buyOrders = new Series( "Buy", SeriesType.Scatter, "$", Color.Green, ScatterMarkerSymbol.Triangle );
stockPlot.AddSeries( buyOrders );
Series sellOrders = new Series( "Sell", SeriesType.Scatter, "$", Color.Red, ScatterMarkerSymbol.TriangleDown );
stockPlot.AddSeries( sellOrders );
AddChart( stockPlot );
// (...)
}
public void OneHourHandler(object sender, TradeBar tradeBar)
{
Plot( "Trade Plot", "Price", tradeBar.Close );
Plot( "Trade Plot", "Buy", tradeBar.Close );
// (...)
}
}
Rahul Chowdhury
Hey JOÃO,
The custom chart data can be found in the result json file, which is located at Lean/Launcher/bin/Debug/Strategy.json. You can retrieve the chart information from the file and plot it using matplotlib or another charting library.
Best
Rahul
JOÃO NEVES
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!