Back

Question about Limit Orders

Hello All,

I'm wiriting an algoritm that will trade an ETF that has reletivly low volume.

That means that there is a high risk of mid day gaps

I have found an example of using Limit Orders to buy stocks below a certian price, and I'm trying

to understand how it works:

 

// Purchase 10 SPY shares when its 1% below the current price
var close = Securities["SPY"].Close;
var limitTicket = LimitOrder("SPY", 10, close * .99m);Will the LimitOrder buy a stock only if it is under a certian price (1% lower than the close price?)or will it "Trigger" a Purchase at any price once the price is 1% lower than the close price?How can I make sure that the algoritm does not Purchase stocks at the "wrong" price becase of a mid-day gap that occuresafter a purchase order is triggerd?Thank you!
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.


Hey Maoz,

Limit orders will only fill at a price equal to or better than the limit price. That means if we set a limit order to buy shares of AAPL at $100, that order will purchase shares of AAPL at $100 or a better price. On the other hand, a stop market order triggers a market order once the stop price has been reached. This means that, for a stop market order, we are not guaranteed a fill at the stop price because there can be slippage. A good example of a stop market order is a stop loss, which liquidates the position once the price is below the stop price. Learn more about limit orders and stop market orders in the documentation.

Best
Rahul

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.


Hey Rahul,

 

Can you explain what you mean by "Better" price?

Let's say I set a limit order to BUY shares of AAPL at $100, will the limit order will enable to buy stockes only if the price is $100 or LOWER, and if i set a limit order to SOHRT shares of AAPL at $100 the limit order will enable to short stockes only if the price is $100 or HIGHER?

Thank you,

Maoz

0

Hey Maoz,

You're absolutely correct. When submitting BUY Limit Orders, the order will execute at the limit price or lower if possible. And when submitting SELL Limit Orders, the order will execute at the limit price or above if possible.

Best
Rahul

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