Hello, I have an issue with backtesting and stop orders. Stop orders triggered properly on time and value on a backtesting but every time when I try to buy some securities after that I have got "Insufficient buying power to complete order" error. Looks like the stop orders do not release cash back to the portfolio. Please advice.
Max Kovalev
Have more details and a backtest for that. Error happened only when I set cash account type for Brokerage model. "SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Cash);" Error dose not happened with Margin account type. Why?
Shile Wen
Hi Max,
The reason the Cash is not released back to the account when we use a Cash Account is due to the fact Cash Accounts require 3 days to settle funds. Margin accounts on the other hand don't face this problem as Margin is provided for cases like these.
Best,
Shile Wen
Max Kovalev
Thank you for the clarification Shile. Are 3 days configured? Can I change that setting for a Cash Account? Usually when you sell some stock money available the next morning. Please advise how to make the backtest more real.Â
Shile Wen
Hi Max,
The settlement period for IB Cash accounts is fixed for 3 days, and this rule is according to US trading laws.
Best,
Shile Wen
Max Kovalev
Hello Shile, If I understand properly there is a "free riding" rule when you can use funds for a next security purchase even if those funds are not cleared yet. Only you need to make sure that you do not "overspend" funds. Here is an explanation of the Interactive Brokers site.  https://ibkr.info/article/3101#:~:text=If%20an%20investor%20buys%20a,can%20only%20purchase%20securities%20using
Shile Wen
Hi Max,
At the moment, we do not model the free riding rule.
Best,
Shile Wen
Max Kovalev
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!