Back

Understanding History/IndicatorWarmUp

Hi, my algorithm relies on an external source to deliver a list of securities for a certain day. The data is first vailable at around 9:15am on the trading day. When I have that data, I need all the premarket data from that day to warm up the indicators.
The problem is that the value of the indicator (say at 9:30am) is always different from the "correct" values that I'd get if I subscribed to the security at 12am that day.

Question:
Is this the correct way to warm up the indicator? If so, what am I doing wrong.

 

Thx!

 

AddEquity(symbol, resolution, Market.USA, true, 0M, true);
var consolidator = Consolidate(symbol, consolidateTo, x => OnConsolidatedData(x));
History(new List<Symbol> { symbol }, triggerDay.Date, Time, resolution, false, true)
.PushThroughConsolidators(c => consolidator);

if (!_vwap.ContainsKey(symbol))
{
var vwapPeriod = 240;
var vwapIndicator = new VolumeWeightedAveragePriceIndicator($"VWAP({symbol})", vwapPeriod);
RegisterIndicator(symbol, vwapIndicator, consolidator);

_vwap.Add(symbol, vwapIndicator);

// Warmup indicator
var h = History<TradeBar>(symbol, Convert.ToInt32((Time-Time.Date).TotalSeconds), resolution);
foreach (var item in h)
vwapIndicator.Update(item);
//WarmUpIndicator(symbol, vwapIndicator, resolution);
}

 

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.


Hi David,

Could you provide some reference values for the “correct” values, as well as how the “correct” values are calculated, such as the resolution of the data? Also, please attach a backtest (include the full code if runtime error), as it will greatly help in identifying the issue.

Best,
Shile Wen

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.


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