Orders delayed after generated in strategy!?  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
QGroup

Orders delayed after generated in strategy!?

Postby QGroup » 23 Apr 2015

I'm programming a strategy that uses market orders once a certain condition is met. The strategy uses IOG, and are based on the order type "MarketNextBar". It's my understanding that the order is send right away once generated with these settings. However, this is not the case. Sometimes the order is delayed many seconds.

I added logging to the strategy to identify exactly what time the order send function is called, which in one scenario was 19:36:32. The order was not sent however, which can be confirmed in the Order and Position Tracker window showing an entry 19:36:37 that it will be "routed as an odd lot order" and then confirmed as a position 19:36:38. Checking the log files for IB, also shows that the order isn't sent until the 36th second:

[0x0528](23.04.2015 - 19:36:36.918)openOrder nOrderId=1008 , rContract.localSymbol=, rOrder.clientId=0, rOrder.orderId=1008, rOrder.permId=0, state=Sent
[0x0528](23.04.2015 - 19:36:36.919)PLACED ORDER: ID=[1008], Symbol name: , Category: CASH, Exchange: IDEALPRO, Expiry: , Currency: USD Order Action: BUY, Order Type: MKT, Contracts: 42, StopPrice: 0.77215, LimitPrice: 0, Multiplier: 1, TIF=
[0x0528](23.04.2015 - 19:36:36.919)==========New Order ClientID[0], BrokerID[1008] = MCID[26]

It's possible that there was no new incoming tick between second 32 and second 36, so this would mean that the order is not sent until the next tick after it was generated? Is there anyway I can force this to send earlier, such as using ExecControl.ReCalculate() or similar?

The alternative would be to use stop orders - are these held within MC and converted to a market order once hit, or are they sent as a proper stop order to the broker (IB)?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Orders delayed after generated in strategy!?

Postby Henry MultiСharts » 24 Apr 2015

Hello QGroup,

Please refer to How Signals are Calculated:
Realtime. Intra-Bar Order Generation (IOG) enabled. The script is calculated tick by tick. An order is placed on the next tick. An order is filled on any tick price within the bar.

The only way to speed it up is to use more liquid instrument with more tick updates or ExecControl.ReCalculate() + IOG.

QGroup

Re: Orders delayed after generated in strategy!?

Postby QGroup » 26 Apr 2015

Thanks Henry,

what's the difference between ReCalculate and RecalcLastBarAfter (except for the time input)?

One of the problems I'm having with this is that the market orders are significantly delayed. I've narrowed it down to that Multicharts send a market order as an order with a set price to IB, rather than just a normal market order to buy at what ever price is available. In the IB logs the MC order is being updated as the price moves away leaving the order unfilled.

How can I ensure that MC doesn't assign a price to a market order?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Orders delayed after generated in strategy!?  [SOLVED]

Postby Henry MultiСharts » 27 Apr 2015

Hello QGroup,

ReCalculate - recalculates the study on all bars of the data series.
RecalcLastBarAfter - recalculates the study on the most recent bar of the data series only.

QGroup

Re: Orders delayed after generated in strategy!?

Postby QGroup » 27 Apr 2015

Thanks Henry,

the main issue wasn't the recalculation though but the fact that orders are extremely delay:

"One of the problems I'm having with this is that the market orders are significantly delayed. I've narrowed it down to that Multicharts send a market order as an order with a set price to IB, rather than just a normal market order to buy at what ever price is available. In the IB logs the MC order is being updated as the price moves away leaving the order unfilled.

How can I ensure that MC doesn't assign a price to a market order?"

These delays can be as long as 30 seconds in fast markets since a price is attached with the market order, while the IB TWS fills it instantly...

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Orders delayed after generated in strategy!?

Postby Henry MultiСharts » 29 Apr 2015

Thanks Henry,

the main issue wasn't the recalculation though but the fact that orders are extremely delay:

"One of the problems I'm having with this is that the market orders are significantly delayed. I've narrowed it down to that Multicharts send a market order as an order with a set price to IB, rather than just a normal market order to buy at what ever price is available. In the IB logs the MC order is being updated as the price moves away leaving the order unfilled.

How can I ensure that MC doesn't assign a price to a market order?"

These delays can be as long as 30 seconds in fast markets since a price is attached with the market order, while the IB TWS fills it instantly...
Hello QGroup,

In order to analyze this case please send us (support@multicharts.com) the following information:
1) MultiCharts logs (if you have not restarted the platform. Logs from the previous run are erased when you start MC).
In MultiCharts go to Help->Feedback->Send logs. Please let me know that you have uploaded the logs.
If you want to send the logs manually please follow this guide: https://www.multicharts.com/trading-sof ... harts_Logs
2) In MultiCharts go to File->New->Open Order and position tracker window-> Orders tab->make sure you are not filtering the information in columns, then go to File->Export to excel.
Highlight the orders in question.


Return to “MultiCharts .NET”