Hello,
I am running into a problem which I cant resolve.
See attached backtest and code.
If the resolution is set to daily: spy_d = AddCfd("SPX500USD", Resolution.Daily, Market.Oanda);
The heikin ashi indicator gives the correct values. e.g. on the 19th Heikin ashi close = 2900
If the resolution is set to hourly: spy_d = AddCfd("SPX500USD", Resolution.Hourly, Market.Oanda);
The heikin ashi indicator gives NOT the correct values. e.g. on the 19th Heikin ashi close = 2898
Why is that?
thx.
Link Liang
Hi,
First of all, it is expected to see different outputs with different resolution level used. Typically higher resolution has more accurate output, although it might sometimes perform worse.
I believe this could cause something wrong:
spy_d = AddCfd("SPX500USD", Resolution.Hour, Market.Oanda);
spyHA_d = HeikinAshi("SPX500USD", Resolution.Daily);
If the indicator uses lower resolution than the subscribed data, we need to use data consolidator. Here is my attempt to implement a consolidator with hourly data and daily indicator. Notice that the data consolidator combines 24 bars into 1 bar. Since SPX500USD does not trade 7*24, the indicator is not updated exactly every day, but every 24 data entries instead.
Hope it helps!
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.
Eugene
Hello Link,
thank you!
I tried your code and indeed it works better. It gives still a slightly different value but very close to the daily settings.
Actually, I expected the helper method of the heikin ashi indicator to do exactly the same thing as consolidating the data like you coded it. Why else does the indicator offer a resolution setting?
Another thing which bothers me is that the daily setting give the right value compared to the actually more accurate hourly data.
Maybe its an issue of the asset SPX500USD because it trades 23h a day starting at 22:00 UTC.
thx again.
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.
Douglas Stridsberg
There is no such thing as the right value - it depends what data provider you compare against. The best you can do is use your indicators in a way which is consistent across your algorithm. It's unlikely all values will line up 100% with some other data provider's indicator data.
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.
Eugene
thank you a lot. that helped!
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!