Mainly there are three things I'm interested in: Let's say we are allowing a maximum of 2 trades at a point in time.
• If the 2nd trade has a different size, how would you recommend we account for that? Eg. I am risking 2% per trade. Trade 1 fired 100 shares of Roku. Trade 2 fired 102 shares of Roku.
• If we store this info in memory and the script crashes. How do we get this info back on the reboot?
• Is there a way for the script to auto-reboot after a crash or must we manually do it?
On a side note: If I use the "if self.Portfolio["ROKU"].Quantity == 0" for tracking orders, does the script interfere with another script that is trading the same currency?
I'm new to QT and I'm not sure about all the workings so I appreciate any help.
Derek Melchin
Hi Igor,
> If the 2nd trade has a different size, how would you recommend we account for that? Eg. I am risking 2% per trade. Trade 1 fired 100 shares of Roku. Trade 2 fired 102 shares of Roku.
Instead of placing trades (using `MarketOrder` and `Liquidate`) at multiple places throughout the OnData method, determine the order size throughout the OnData method and place the trades at the end of OnData. Part 4 of the Value and Momentum Everywhere algorithm demonstrates this process.
> If we store this info in memory and the script crashes. How do we get this info back on the reboot?
We recommend using the ObjectStore to save data between deployments.
> Is there a way for the script to auto-reboot after a crash or must we manually do it?
When deploying an algorithm live, we can toggle the new feature called "Automatically restart algorithm".
> does the script interfere with another script that is trading the same currency?
Live trading accounts can currently only handle 1 live trading connection at a time.
Continuing the development of this algorithm, we recommend removing the History methods called in OnData. Instead, replace them with some RollingWindows that are updated with consolidators.
Best,
Derek Melchin
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.
Igor Radovanovic
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!