Hello all,
I have checked out the sample code for creating tradebars with custom sizes e.g. 5 mins, 4 hours etc. However I have not been able to figure out how to use these custom sized tradebars with Quantconnect's built in MACD and SMA rolling indicators.
Basically I want the equivalent of:
_sma200 = SMA(_symbol, 200, Resolution.FiveMinute);
_MACD = MACD(_symbol, 12, 26, 9, MovingAverageType.Simple, Resolution.FourHour);
And I want to be able to process these indicators in my main algorithm loop. The main loop would update once per minute but it's okay if the indicators themselves only get updated as often as their tradebar widths permit.
Can anyone offer a solution for this?
Thank you
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.
Joseph Jones
Michael Handschuh
_macd = new MovingAverageConvergenceDivergence(12, 26, 9); RegisterIndicator("SPY", _macd, TimeSpan.FromMinutes(5));
You can also specify different fields other than close:_macd = new MovingAverageConvergenceDivergence(12, 26, 9); RegisterIndicator("SPY", _macd, TimeSpan.FromMinutes(5), Fields.Open);
You can see what fields are available here. The technique displayed by Jared is used under the hood in the RegisterIndicator method, but provides the ultimate flexibility.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.
Joseph Jones
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!