Back

Custom Orders

Hi, I'm new to Quantconnect.

1. I've looked at the documentation and am still a little confused as how to (for forex) buy at a certain price. Would I do this by submitting a StopMarketOrder or LimitOrder? What is the difference between StopMarketOrder and LimitOrder for quantconnect? They both Submit/fill when teh price is reached but a limit order will fill if the current price is better than the one we set. How does it consider what is better? If my number was the close *.999m is beter less than or greater than, or does that depend on whether my quantity is positive or negative?

2. If I wanted to cancle an order after a certain amount of days, lets say 3 days or something, from when it was placed how would I go about doing that? Do order tickets hold the date that they were placed/filled or do I have to manually manage that?

Thank you!

Update Backtest








Maybe i can help you at 2 with this link where you can find an example of time + orders:

https://www.quantconnect.com/forum/discussion/1506/how-to-issue-a-sell-order-a-set-amount-of-time-after-the-security-is-purchased

More enhanced stuff:

https://www.quantconnect.com/forum/discussion/959/canceling-an-order

And you may need 3 trading days not usual days:

https://www.quantconnect.com/forum/discussion/891/trading-days-vs-days

Properties of Orderevent:

OrderEvent.cs

Differenced between stopmarket order and marketordner are explained by millions of people on youtube and every broker :) 

https://www.interactivebrokers.com/en/index.php?f=609

https://www.interactivebrokers.com/de/index.php?f=602

0

1. Short answer: Limit orders are what you want to use most of the time. Their logic is BUY IF PRICE BELOW X and SELL IF PRICE ABOVE X conversely.

StopMarketOrder (and StopLimitOrder) typically aren't suited to enter and regularly exit positions. To consider why that is, consider that the trigger logic for such an order is SELL IF PRICE BELOW X (or conversely BUY IF PRICE ABOVE X). Basically, this logic makes you suspectible to mean reversion movements. Why is it even there then? It's there to act as a stoploss (hence the name), placing a bound on your losses. However, beware the order may be filled at a worse price than the trigger price. Particularly, market (and stop market) orders are problematic in this respect.

There's no silver bullet. Intraday, Limit orders have a tendency to fill at the limit price when the market moves through it, resulting in an immediate small loss (or big, if market is volatile).

2. The OrdetTicket returned from an order call holds an order identifier number. I would recommend storing the OrderTicket (although it is possible to only store the number and find the order via other methods).

1

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