I have been looking at the limit and stop orders and I am having trouble getting my algo to take profits at a certain percentage. Could any thoroughly explain how to do this, then provide the correct template code. Thanks!!!
QUANTCONNECT COMMUNITY
I have been looking at the limit and stop orders and I am having trouble getting my algo to take profits at a certain percentage. Could any thoroughly explain how to do this, then provide the correct template code. Thanks!!!
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.
Douglas Stridsberg
Hi, welcome to QuantConnect.
A good place to start if you're new to the framework is to complete the Bootcamps.
If that doesn't answer your question, you can move onto the Documentation, which has a section on Order Types.
Your question is very basic and has been answered countless times before on the forums. The forums have a search function which you should use before you post a new thread. Here's what I searched for and the first result that came up answers your question.
Link Liang
Hi Ez,
To take profits we need limit order.
Assuming you made an order by:
self.MarketOrder(symbol, quantity)
then we could take profit by
self.LimitOrder(symbol, -quantity, currentPrice * (1 + takeProfitPercent))
Similarly, if you short by
self.MarketOrder(symbol, -quantity)
then we could place
self.LimitOrder(symbol, quantity, currentPrice * (1 - takeProfitPercent))
There are many helpful posts in the forum. Besides, feel free to share you algorithm and we could discuss the implementation in details.
Ez Buckets
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!