I'm trying to make an algorithm using forex tradebars, but I keep getting an error. the curious thing is that when I use the exact same algorithm for equities, it works perfectly.
The line that causes the error is:
self.window.Add(data[self.syl])
The error message is " Runtime Error: Trying to dynamically access a method that does not exist throws a TypeError exception. To prevent the exception, ensure each parameter type matches those required by the Add method. Please checkout the API documentation.
"
I can't attach the backtest with the error, so I am attaching the backtest that works. I have commented out the adding of the forex symbol and replaced it with SPY. But if you use the forex symbol you can reproduce the error.
self.aaa = self.AddSecurity(SecurityType.Equity, "SPY", Resolution.Minute)
#self.aaa = self.AddForex("EURUSD", Resolution.Minute)
Thank you in advance for the help.
Jared Broad
It works fine but likely the algos type declarations are mixed up
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.
Yujun Tang
Hi Jared,
Thanks for the reply. I cannot attach the backtest with the error for EURUSD because it does not get saved.
I have attached the working backtest in for SPY the first post. If you # the SPY line and remove # from the EURUSD line, you will get the error i described.
self.aaa = self.AddSecurity(SecurityType.Equity, "SPY", Resolution.Minute)
#self.aaa = self.AddForex("EURUSD", Resolution.Minute)
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.
Yujun Tang
Thank you for your assistance.
Yujun Tang
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!