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
AutoTrade Beta 4?
-
- Posts: 407
- Joined: 01 Jan 2008
- Been thanked: 3 times
Steven,I think you need to be in "sync" mode to sync the chart with the broker.
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
- Andrew Kirillov
- Posts: 1589
- Joined: 28 Jul 2005
- Has thanked: 2 times
- Been thanked: 31 times
- Contact:
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
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
- Andrew Kirillov
- Posts: 1589
- Joined: 28 Jul 2005
- Has thanked: 2 times
- Been thanked: 31 times
- Contact:
- Andrew Kirillov
- Posts: 1589
- Joined: 28 Jul 2005
- Has thanked: 2 times
- Been thanked: 31 times
- Contact:
- Andrew Kirillov
- Posts: 1589
- Joined: 28 Jul 2005
- Has thanked: 2 times
- Been thanked: 31 times
- Contact:
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.
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.
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
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
- Andrew Kirillov
- Posts: 1589
- Joined: 28 Jul 2005
- Has thanked: 2 times
- Been thanked: 31 times
- Contact:
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
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
- Andrew Kirillov
- Posts: 1589
- Joined: 28 Jul 2005
- Has thanked: 2 times
- Been thanked: 31 times
- Contact:
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?
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?
- Andrew Kirillov
- Posts: 1589
- Joined: 28 Jul 2005
- Has thanked: 2 times
- Been thanked: 31 times
- Contact: