So in my backtest here, Ive been trying to wrap my head around looping through my SymbolData objects, which point to continuous futures, which are then mapped to the current front month, but it seems to be trading multiple months at the same time. It seems like I'm not actually looping through the symbols that get traded, so it isn't detecting,
The algo will get a signal from ‘GC X5NNSA8F63Z1’ but then the orders show me trading GC26M19 and then two days later it signals GC29N19, when the goal of the .Invested check is to perform certain logic based on if I am in that asset already.
Maybe I'm missing something simple here, I just feel like maybe I'm looping through the self.Data.items incorrectly, since without this section
if breakoutUp == 0.0 or breakoutDown == 0.0 or price == 0.0:
return
the code loops through contracts that have no indicators registered
Apologies for the rookie question, Im just trying to keep a handle on what exactly is happening within the algorithm
Sean Tiffen
Basically, I just don't know how to say “I'm at my max position for GC, so don't add more, regardless of which month we're looking at” with my current code.
Louis Szeto
Hi Sean
Sorry for the delay. Please refer to the Documentation\Tracking Contract Changes section of the futures security master dataset page. By that, you can reference both old and new mapped symbols, with their combined quantities, for your trading logic.
Best
Louis
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.
Sean Tiffen
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!