AutoTrade Beta 4?

Questions about MultiCharts and user contributed studies.
SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

AutoTrade Beta 4?

Postby SUPER » 11 Mar 2009

I am testing out AutoTrade with IB simulated account on MCBeta 4 and have come accross a situation which does not make any sense, the order was generated and filled at the broker end as seen on the first line of the IB Account detail at 11.04 at 725.50 however the order is not seen on the chart at all-even on the next bar. It raises many question,

a) Was it a phantom order
b) bug in MC calculation
c) Bug in Chart display

Symbol: ES 24 hr session
Setting: Async Mode with conversion of Limit order time out=0
Order Type: Limit
Strategy: IOG enabled
Attachments
MC-12.JPG
(161.95 KiB) Downloaded 910 times
Last edited by SUPER on 12 Mar 2009, edited 1 time in total.

brodnicki steven
Posts: 407
Joined: 01 Jan 2008
Been thanked: 3 times

Postby brodnicki steven » 11 Mar 2009

I think you need to be in "sync" mode to sync the chart with the broker.

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

Postby SUPER » 11 Mar 2009

I think you need to be in "sync" mode to sync the chart with the broker.
Steven,

In a Async mode you can have a situation where order is seen on chart but not filled at broker end but here we have totally opposite situation where order is filled at broker end but not reflected on chart.

Regards
Super

User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times
Contact:

Postby Andrew Kirillov » 12 Mar 2009

Super,
This is a well-timed question. What you noticed is a bug. It is a bug of calculation. The order was place correctly, but our execution engine didn't see that the price exist to plot an arrow. At the same time the market executed the order, because the desired price existed. So this bug may lead to mismatch of trading engine and a broker position.

The bug happens very rare, but we could see it several times during our QA testing.
We fixed it a few days ago and the fix will available in the next beta.
Thank you for the report

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

Postby SUPER » 07 Apr 2009

Andrew,

I can accross similar situation today with beta 5 build 2199, it was my impression that it was fixed in this version.

It is a very serious bug and can adversely effect auto trading.

Regards
Super

User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times
Contact:

Postby Andrew Kirillov » 07 Apr 2009

Super,
We've fixed the problem I mentioned before and we made extensive testing.
It is oblivious I can't state that we fixed all possible issues. If you have the issues you can show it on helpdesk. Otherwise it is almost impossible to say something definite.

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

Postby SUPER » 07 Apr 2009

Andrew,

Here's image for varification of problem, I have e-mailed you trace file hope they should help in identifying problem.

Regards
Super
Attachments
MC 1.2.JPG
(96.2 KiB) Downloaded 890 times

User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times
Contact:

Postby Andrew Kirillov » 07 Apr 2009

Please attach the logs too or send it to me.

User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times
Contact:

Postby Andrew Kirillov » 07 Apr 2009

MultiCharts works properly.
1. It doesn't show the long trade, because buy orders are executed on asks. Since you run simulated account your trade will not be reflected in the list of real trades and this quote will not come to MultiCharts. IB just sees that there is ask for you your bid and considers it as a trade. Thus you will not see the arrow in MC.
2. The possible solution is to use extended backtesting mode. It is a unique feature. See Strategy->Properties->Backtesting.
It allow you to add bid and ask series into a chart and your trades will be plotted on real market prices, not trades.

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

Postby SUPER » 07 Apr 2009

Andrew,

The bar in question at 08.44 had following values:

O =4376.5
H = 4379
L = 4357
C= 4358

The system placed a "Buy Next bar at Open Stop" order and it was executed at broker end @4376.5. Now since it is a stop order and having such a large range on the bar why would it not show up on the chart which is some thing I am not able to understand, isn't the chart working independent of the broker position in Async mode.

Please can you explain so that I have better understanding of the Auto Trade engine.

Certainly, I will try out your suggestion of using bid/ask stream from now on.

Regards
Super

User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times
Contact:

Postby Andrew Kirillov » 08 Apr 2009

You should check a bar with 8:45 timestamp, because MultiCharts uses end of the bar as a timestamp. Please make a screenshot with data window that demonstrates prices for 8:45 bar.
Thank you.

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

Postby SUPER » 08 Apr 2009

Andrew,

Even with your suggestion with bid/ask data streams, I encountered same problem again today, attached find screen shot will all necessary details.

Regards
Super
Attachments
andrew 1.1.JPG
(278.1 KiB) Downloaded 892 times

User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times
Contact:

Postby Andrew Kirillov » 10 Apr 2009

Super,
We carefully analyzed your issue and here is our vision of the problem.
1. Your strategy logic sets and removes orders too often. According to your script it says true or false for signal on each tick.
2. You use IOG. It means your strategy does what I mentioned above many times in a second. Sometimes it could be 10 times a second or more. It means you send and remove orders every 100ms which is very intensive.
3. I can tell you for sure that considering latency and time that is need to process your command TWS and MultiCharts can’t guarantee that we will be able to place and timely remove the previous order. The order flow is huge, but we have less than 100ms to remove an old order and send a new one.
4. The nature of asynchronous mode doesn’t allow one to guarantee that order execution on broker’s side and the same emulation on the charts side will happen at the same time. Example: we send an order and it is not executed. New ticks come and we must send new orders. We send cancel command to the existing order and place a new one, but the old order is suddenly executed when a command just sent. However it is executed for the previous set of rules and not for the existing strategies conditions. It means that arrow will not be plotted on the chart, because it shouldn’t be plotted since conditions are changed. However the entry will be on the broker side.

How to avoid it:

1. Avoid strategies that change orders within a bar. For example, an order to buy 10 stop is good. An order to buy at current price+ 1 is not good. Since it is could be changed every tick. It is ok if the price level is relatively far from the existing price, but if it is close to the last it is a nightmare for TWS and MC since order are regenerated on each tick.

2. Avoid IOG until it is necessary. Otherwise your rules and set of orders will be changed each and every tick. We do control order placement and don’t replace the same orders, but if order prices are different we can do nothing.

3. Use Sync mode if you want to have guaranteed results on brokers and chart’s side, because we wait confirmation for each message from the broker side and plot based on its information.
4. We are introducing real broker’s market position in 5.1. Since you can’t remove all false trades due to async natue, you can at least minimize consequences. This function will allow you to see that you are in synch with broker and if not make automatic adjustments.

Does it make sense to you?

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

Postby SUPER » 11 Apr 2009

Andrew,

Many thanks for your detailed reply, it does make sence with regard number of orders MC has to process. I will take your suggestion and try out a new test code with restricted trades and will report my finding.

Thanks and regards
Super

User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times
Contact:

Postby Andrew Kirillov » 13 Apr 2009

Yes, please. Your contribution may help other traders to understand better how it works.


Return to “MultiCharts”