Unfilled Limit Orders

Questions about MultiCharts and user contributed studies.
johnchan
Posts: 22
Joined: 07 Sep 2006

Unfilled Limit Orders

Postby johnchan » 30 Apr 2008

If a buy limit order is sent to TWS and it is not filled is "marketposition" correctly recorded as 0 and not 1. That is does marketposition take account of filled and unfilled orders, by way of feedback from TWS.

User avatar
Marina Pashkova
Posts: 2758
Joined: 27 Jul 2007

Postby Marina Pashkova » 02 May 2008

Hi jonchan,

As it is there is no real synchronization with TWS.

Here's what happens to price orders:
----
I. No price order has been plotted on the chart. This order has been sent to TWS in advance but couldn't be filled before the bar closed. In this case this order will be cancelled on bar close. The market position won't change.

II. No price order has been plotted on the chart. This order has been sent to TWS in advance and filled there when the conditions were met. The market position will:
a) remain the same in the code (i.e. on the chart) and
b) change in autotrading

III. A price order has been plotted on the chart. However, it hasn't been filled before the bar closed. In this case the order will be cancelled on bar close. The market postion will:
a) change in the code (i.e. in the chart) and
b) remain the same in autotrading
----
To counteract the above effects, we have implemented the conversion of price orders into market orders. The conversion takes place in scenario III: when an arrow was plotted on the chart but the price order could not be filled. In this case the order is filled as a market order.

Hope the above makes sense. If not or if you need further clarifications, please let me know.

johnchan
Posts: 22
Joined: 07 Sep 2006

Postby johnchan » 05 May 2008

Hi Marina,

Thank you for your explanation. I now understand the circumstances where scenario 1 and 3 could occur. But scenario 2:
"II. No price order has been plotted on the chart. This order has been sent to TWS in advance and filled there when the conditions were met. The market position will:
a) remain the same in the code (i.e. on the chart) and
b) change in autotrading ".

Under what circumstances could this occur, and does it occur? If the market price (last trade) does not reach the limit price then the price order will not be printed on the chart. If such a situation does occur it would be extremely unlikely that IB would fill the order at the limit price or better, particularly as the order is cancelled on completion of the bar. Could you please explain the circumstances where this might happen.
Regards,
johnchan.

User avatar
Marina Pashkova
Posts: 2758
Joined: 27 Jul 2007

Postby Marina Pashkova » 06 May 2008

Hi johnchan,

The scenario 2 can occur if, say, you plot one symbol and trade a different one (in the symbol dictionary).


Return to “MultiCharts”