- ago
I'm using strategy monitor "Streaming Bars" update mode using IB. I'm seeing that SM takes consistently 7 secs to complete even though it reports strategy runtime of only 1.5-2.2 secs.



I'm using TD to place the orders, there I see "TO CLOSE" orders at 7th sec and "TO OPEN" orders at 11th sec consistently. The "TO OPEN" orders take additional time to fill by TD but overall, I expected both TO CLOSE/TO OPEN orders to have happened few secs before.



My local time is set to +3.8 secs ahead of TWS time. Even with this, it takes 3.8+7 = 10.8 secs to place the order despite strategy only taking under 2 secs to run. Ideally, alerts should be placed right after strategy has been finish running in 2 secs. I would expect orders in Order Manager at 1st or 2nd sec rather than 7th sec given that local time is +3.8 sec ahead. The delay is causing reduced profits everyday Vs back testing.
0
604
Solved
6 Replies

Reply

Bookmark

Sort
Cone8
 ( 26.99% )
- ago
#1
First thing, you can't make the strategy run sooner by advancing your clock. The strategy runs when the bars are served.

Second, the time shown is your local clock. If you advance your clock by 3.8 seconds vs TWS Time, then it's going to make it look like the run occurred about 4 seconds after the actual time that the bar was served.

With about 1 second transmission delay, 2 seconds to run the script, and 4 seconds of an advanced clock, there's your 7 seconds - but really it's only 3.

Re: TDA
TD takes its own time with activating orders. I don't have data on it, but in my limited experience and compared to IB, TD is very slow to make an order active.
0
Cone8
 ( 26.99% )
- ago
#2
About 3 seconds is what I'm seeing (and, this computer is running 4 real-time streaming programs, which is more overhead.)

This was a test I just ran again Light Crude futures. My local clock is 1.1 seconds ahead of TWS (calculated on connection and entered in the Log Viewer), so subtracting 1.1 sec from the local time printed first shows that the strategy is completing 2.5 to 4 seconds after the end of bar.

CODE:
501   05:32:05.437   20220331 0532   101.69   101.99   101.69   101.88   382.0 502   05:33:04.436   20220331 0533   101.88   101.95   101.80   101.90   164.0 503   05:34:03.476   20220331 0534   101.91   102.04   101.87   102.02   134.0 504   05:35:04.261   20220331 0535   102.03   102.14   101.94   102.01   226.0 505   05:36:04.384   20220331 0536   101.99   102.00   101.74   101.76   145.0 506   05:37:03.526   20220331 0537   101.78   102.02   101.77   101.93   131.0 507   05:38:04.786   20220331 0538   101.93   101.95   101.80   101.87   97.0 508   05:39:04.983   20220331 0539   101.90   101.90   101.76   101.80   90.0
0
- ago
#3
QUOTE:
With about 1 second transmission delay, 2 seconds to run the script, and 4 seconds of an advanced clock, there's your 7 seconds - but really it's only 3.


The 7th sec is reported in TD's transaction page:
03/30/2022 15:43:07 Bought to Cover 43 ARKK @ 68.595
03/30/2022 15:43:11 Bought 43 ARKK @ 68.5599
03/30/2022 15:51:06 Sold 43 ARKK @ 68.6202
03/30/2022 15:51:11 Sold Short 43 ARKK @ 68.6301
03/30/2022 15:57:07 Bought to Cover 43 ARKK @ 68.555

So it is not my local time but actual time. Even though SM finishes processing strategy at 7th sec my local time and I see signal in order manager at 7th sec. It is actually 3rd sec in real time given my local time was 3.8 secs ahead. But the order get's reflected at TD side in 7th sec real time. I'm not sure where are the 4 secs being used. I was expecting transaction at 3rd or 4th sec on TD side.
0
Cone8
 ( 26.99% )
- ago
#4
QUOTE:
Re: TDA
TD takes its own time with activating orders. I don't have data on it, but in my limited experience and compared to IB, TD is very slow to make an order active.


Here are your 4 seconds -

0
Cone8
 ( 26.99% )
- ago
#5
Now compare that to IB's response -

0
Best Answer
- ago
#6
Thank you for the very insightful videos clearly showing the difference between TD and IB. I guess that's where the lag is.
1

Reply

Bookmark

Sort