Back

Compare higher timeframe data

I use the 1 min bar and am trying to use consolidator bars to get daily bars. What happens to this data if i want to compare the daily bars. for eg I want to check if today's low <Yesterdays low. Is there any examples that i can refer to ?

Update Backtest







Hi Rakesh, please refer to this example. The algorithm saves yesterday close price in OnEndOfDay event handler and compares the current bar close with the yesterday close in ConsolidatedBarHandler method. Alternatively, you can also use RollingWindow to keep the recent two trade bars"_window = new RollingWindow<TradeBar>(2);" and update the rolling window in ConsolidatedBarHandler. Please see this example 

var currBar = _window[0];// Current bar had index zero.
var pastBar = _window[1];// Past bar has index one.

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.


thank you. is there a way to consolidate weekly bars?

0

To consolidate weekly bars, you need to expand the bars to be consolidated to a week.

var weeklyConsolidator = new TradeBarConsolidator(TimeSpan.FromDays(7));
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