Back

Stop loss and profit target limit

I would like to know when I enter stop limit price, does it get add to the brokerage account or when limit price is met then submit to brokerage account. For example, I want to enter the trade buying 1000 stocks of BOOTwith buy limit of $25.99 with profit target for first 500 stocks to $29.55 and remaining 500 stocks to $31.50. I also want to add stop loss for 500 stocks to be $24 for 500 stocks and 23.50 for remaining $500 stocks. Do you have any example with profit target and stop limit examples in QuantConnect platform ? Second question,  Do quantconnect submit both profit target limit and stop loss limit price to broker ? My experience tells me that when I add stop loss , I feel like some algo looks for those stop loss , because in my experience most of time i get stopped out and then price move away up which tell me that when I add stop loss , broker submit to exchange directly  (I will be using IB account for my live trading). Please advise. 

Thanks
DK

Update Backtest







The limit order is submitted to the brokerage once you place the limit order (not until the limit price is met).  Once the order is sent to the brokerage, it will get filled or not based on the limit price. After a fill, we get the message from their API and update the holdings in your portfolio. We have this example on Github

https://github.com/QuantConnect/Lean/blob/master/Algorithm.Python/OrderTicketDemoAlgorithm.py

For profit target limit, you can use self.LimitOrder(symbol, quantity, limit_price). For stop loss limit price, you can use self.StopMarketOrder(symbol, quantity, stop_price). When the stop price is reached, a stop order becomes a market order. You can submit limit order and stop market order together. Please see the attached algorithm.

Open orders can be canceled with self.Transactions.CancelOpenOrders(symbol).

0


Appreciated Jing for quick resdponse!! So want to make sure if I understood correctly. So stop order will not be submitted to broker until stop limit order price is met. Once stop limit order price is met, Quantconnect sends stop limit order price to the broker, correct ? 

0

MarketOrder/LimitOrder/StopMarketOrder/StopLimitOrder they are sent to the brokerage immediately in live trading once you place the order in your algorithm. The brokerage will decide if these orders get filled or not and send the current order state to QC.

0

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