Back

MarginCallModel not working?

I applied this to an algo:

  1. self.Portfolio.MarginCallModel = MarginCallModel.Null 
Still get a bunch of margin calls...
Update Backtest







The line above is the correct way to set the null margin call model. In the algorithm below please see the NullMarginCallModel working as expected -- preventing the liquidation of trades. When the margin call model is set to null the OnMarginCallWarning and OnMarginCall events are never triggered, but when the margin call model is not set, both events and their debug messages are called. If the issue still persists after following the backtest below feel free to share the code here.

0

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.


I don't know what's going on, now testing for 2008 which threw all the margin errors is fine doesn't show them anymore, but when I turn on the the margincall it still doesn't show the margin calls, so something seems off. 

0


After cloning the algorithm I commented out the null assignment of the margin model and added the function def OnMarginCallWarning(self). During the backtest, the function was called numerous times along with margin call orders. This function is called when the margin model is not set to null. Try again and make sure that the project is built before running a backtest.

0

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.


Update Backtest





0

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.


Loading...

This discussion is closed