Back

Plot Historic Data

I was wondering if there was a way to plot historic data. For example, I produce a ZigZag pattern for the previous 180 days of History for a symbol. I would like to chart this in order to visually confirm the data - but I don't see any overload for Plot that takes a DateTime. Is there a way to do this?

Update Backtest








Yes! Use the "Warming Your Algorithm" feature:

// In Initialize
// Warm up 180 days of data.
SetWarmUp(TimeSpan.FromDays(180));

// In OnData
if (IsWarmingUp)
{
// Plot the indicator with historic data
Plot("Plotter", "History", indicator);
return;
}

Please checkout the attached project where we plot the identity indicator in red with historic data and in blue after the warm up period.

0

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.


No there is no way to do this via the API. If you really want to do this you can inject the chart data directly into the series object but there's no guarentees this will work forever (if we update how the system works behind the scenes it will stop working).

var chart = new Chart("My Chart");
var mySeries = new Series("My Times", SeriesType.Line, 1);
chart.AddSeries(mySeries);
AddChart(avgCross);

//Save series object off and inject points directly.
mySeries.AddPoint(DateTime time, decimal value)

If you inject too much data your chart will hang and fail; or backtest loading will timeout and you'll be presented with a blank screen. Use at your own risk :)

1

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.


Update Backtest





0

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.


Loading...

This discussion is closed