Right now if position is closed by a built-in risk management model, tag is empty and I don't know which model did that, if I have multiple (like maximum drawdown and maximum profit). Maybe if you have added tag parameter to model initializer and this tag would be used for orders, it would solve this problem.
E.g.:
self.AddRiskManagement(MaximumDrawdownPercentPerSecurity(0.05, "Stop-loss"))
Mia Alissi
Based on the information provided in the extracts, the
MaximumDrawdownPercentPerSecurity
andMaximumUnrealizedProfitPercentPerSecurity
risk management models in QuantConnect do not currently support a tag parameter in their initializers. These models are designed to monitor the unrealized profit percentage of each security in the portfolio and liquidate the position when certain conditions are met.However, you can modify the order tags when you update an order. Here is an example of how to do it:
In this example, the
UpdateOrderFields
object is used to update the quantity, limit price, and tag of the order. TheUpdate
method on theOrderTicket
is then called with this object, and the response is checked to see if the update was successful.For more information on how to use these models and update orders, please refer to the QuantConnect Documentation.
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.
Yuri Lopukhov
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!