Duplicate orders when TWS is restarted.

Questions about MultiCharts and user contributed studies.
Splint
Posts: 77
Joined: 25 Nov 2011
Has thanked: 4 times

Duplicate orders when TWS is restarted.

Postby Splint » 15 Jul 2012

I have noticed that when TWS restarts it duplicates some of the existing orders. I experimented with this for a while to try and understand what is going on with it. I got one instrument to duplicate it's stop 6 times while other instruments which went through the same number of restarts only duplicated their orders once. The duplicate orders are being executed resulting in a discrepancy between the broker position and the strategy position. Is Multicharts and TWS supposed to reference each other to correct such errors?

I also noticed that when the orders expired, the existing open positions stops weren't replaced for a few hours even when the instruments trading session was running. What is causing the delay in placing the new stops?

User avatar
Henry MultiСharts
Posts: 8509
Joined: 25 Aug 2011
Has thanked: 1213 times
Been thanked: 2733 times

Re: Duplicate orders when TWS is restarted.

Postby Henry MultiСharts » 17 Jul 2012

Hello Splint,

Does auto trading turn off when TWS restarts?
Do you restart the auto trading once the connection to TWS is re-established?

Splint
Posts: 77
Joined: 25 Nov 2011
Has thanked: 4 times

Re: Duplicate orders when TWS is restarted.

Postby Splint » 18 Jul 2012

Hi Henry,

From what I've seen auto trading remains on at all times and no, I have not restarted auto trading once the connection is re-established.

Here's a couple of screen shots. It looks like initial entry orders are not effected, just the stops, but some duplicate more than others. I got it to duplicate so many times by closing and re-opening TWS. I've lost track of when the orders duplicated without my input. I'll have to monitor the situation and take some notes. I've also attached a log file.

David
Attachments
api.jpg
api.jpg (167.89 KiB) Viewed 120 times
api 2.jpg
api 2.jpg (192.45 KiB) Viewed 118 times
Log 2012_07_18_10_47_34.xls
(262.5 KiB) Downloaded 47 times

User avatar
Henry MultiСharts
Posts: 8509
Joined: 25 Aug 2011
Has thanked: 1213 times
Been thanked: 2733 times

Re: Duplicate orders when TWS is restarted.

Postby Henry MultiСharts » 18 Jul 2012

Unfortunately the information you have provided is not sufficient for analysis. That is not clear what exactly the problem is.

In order to investigate the issue please provide additional information:
1) Detailed problem description. Highlight the problem on the screenshots or capture this behavior on a video.
2) MultiCharts logs (if you have not restarted the platform. Logs from the previous run are erased when you start MC).
In MultiCharts 8.0 Release go to Help->Feedback->Send logs. Please let me know that you have uploaded the logs.
If your MC version is lower than MC 8.0 Release Candidate please follow this guide: https://www.multicharts.com/trading-soft ... harts_Logs
3) 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.
Please also export the information from the Logs tab and send it to me for analysis.
Highlight the duplicated orders in the Orders tab export file.
4) Create a screenshot of Format->Strategy properties->Auto trading tab.

You can also come to our live chat Monday-Friday 6:30 am - 4 pm EST to demonstrate the issue remotely. The operator will be able to collect all information required for analysis.

Splint
Posts: 77
Joined: 25 Nov 2011
Has thanked: 4 times

Re: Duplicate orders when TWS is restarted.

Postby Splint » 25 Jul 2012

OK, I set snag-it to take screenshots at 30 second intervals and managed to capture the following behavior.

At 25/7/2012 2:00:48PM ZN switched form 1 long position to 1 short position. Instead of putting a stop to buy 2 contracts and go long again, MC interpreted the position as being closed even though it was actually short. The short position was then left without a stop.

I have uploaded the log for your perusal. Here are some screenshots I captured. I've yet to capture any of the stops being duplicated.

Thanks
Splint
Attachments
ZN orders.gif
ZN orders.gif (11.03 KiB) Viewed 125 times
ZN closed when short.gif
ZN closed when short.gif (12.14 KiB) Viewed 121 times
0009489.jpg
0009489.jpg (205.53 KiB) Viewed 116 times
0008948.jpg
0008948.jpg (210.68 KiB) Viewed 125 times
0008940.jpg
0008940.jpg (216.49 KiB) Viewed 120 times

Splint
Posts: 77
Joined: 25 Nov 2011
Has thanked: 4 times

Re: Duplicate orders when TWS is restarted.

Postby Splint » 25 Jul 2012

A screenshot of the strategy properties.
Attachments
Strategy Properties - Auto Trading.gif
Strategy Properties - Auto Trading.gif (27.21 KiB) Viewed 123 times

User avatar
Henry MultiСharts
Posts: 8509
Joined: 25 Aug 2011
Has thanked: 1213 times
Been thanked: 2733 times

Re: Duplicate orders when TWS is restarted.

Postby Henry MultiСharts » 25 Jul 2012

Hello Splint,

Please send me your strategy code and workspace to support@multicharts.com for further analysis.

In order to investigate the issue with orders we need to know the order IDs. Please provide information as described:
3) 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.
Please also export the information from the Logs tab and send it to me for analysis.


Return to “MultiCharts”