- ago
Hi everyone,

I'm testing a test strategy with an Interactive Brokers paper account using the Strategy Monitor. Everything has been smooth with other strategies, but this one is acting strangely. The key difference here is that I’m using the "Sell Next Bar at Market Close" block. Here is the strategy:



Here's the setup in the Strategy Monitor:



Timing details:

Market opens: CST 17:00:00 (my local time: CET 00:00:00)
Strategy scheduled: CST 16:55:00 (my local time: CET 23:55:00)
At-Close run scheduled 1 hour (3600 sec.) before market close, CST 15:00:00 (my local time: CET 22:00:00)

Now, I’m encountering three strange issues:

1. Repeated Processing Before Market Open

Processing starts correctly at the scheduled time (05.01.2025 23:55:00), and the order is created and routed to TWS, as expected. However, processing then starts repeating every few seconds until the market opens at 00:00:00. After the market opens and the order is executed, the repetition stops.

I haven’t experienced this repeating behavior with other strategies. Is this normal?

05.01.2025 23:42:44: Status = LoadingData
05.01.2025 23:42:44: Start Polling Thread
05.01.2025 23:42:44: Populating Data
05.01.2025 23:42:44: Calling GetHistories Pass 1
05.01.2025 23:42:44: GetHistories returned with 1 symbols
05.01.2025 23:42:44: Calling GetHistories Pass 2
05.01.2025 23:42:44: GetHistories returned with 1 symbols
05.01.2025 23:42:44: ESH25:100 bars to 20250103 0000|Interactive Brokers
05.01.2025 23:42:44: NextRun set to 05.01.2025 23:55
05.01.2025 23:42:44: Status = Idle
05.01.2025 23:55:00: Status = Processing
05.01.2025 23:55:00: Pass 1 - Requesting updates for 1 symbols...
05.01.2025 23:55:00: Pass 1 - UpdateHistories returned 0 symbols
05.01.2025 23:55:01: Ran Strategy on ESH25: 1 Signals, Run Time=608ms
05.01.2025 23:55:01: NextRun set to 05.01.2025 22:00
05.01.2025 23:55:01: Status = Completed
05.01.2025 23:55:01: Processed all Symbols
05.01.2025 23:55:11: Status = Processing
05.01.2025 23:55:11: Pass 1 - Requesting updates for 1 symbols...
05.01.2025 23:55:11: Pass 1 - UpdateHistories returned 0 symbols
05.01.2025 23:55:12: Ran Strategy on ESH25: 1 Signals, Run Time=268ms
05.01.2025 23:55:12: NextRun set to 05.01.2025 22:00
05.01.2025 23:55:12: Status = Completed
05.01.2025 23:55:12: Processed all Symbols


2. Incorrect Scheduling for Next Run (Past Date)

During the repeated processing, the next run is scheduled for 05.01.2025 22:00:00, which is correct in terms of time but has the wrong date. It should be 06.01.2025 22:00:00.

You can see this in the log:

05.01.2025 23:55:11: Status = Processing
05.01.2025 23:55:11: Pass 1 - Requesting updates for 1 symbols...
05.01.2025 23:55:11: Pass 1 - UpdateHistories returned 0 symbols
05.01.2025 23:55:12: Ran Strategy on ESH25: 1 Signals, Run Time=268ms
05.01.2025 23:55:12: NextRun set to 05.01.2025 22:00
05.01.2025 23:55:12: Status = Completed
05.01.2025 23:55:12: Processed all Symbols



3. Wrong Time for Next Run After Execution

After the order is executed at market open, the processing runs one last time. This time, it correctly schedules the next run for 06.01.2025, but the time is wrong. Instead of the expected 22:00:00, it’s set to 23:55:00, which is the strategy's scheduled time, not the At-Close run.

Log for reference:

05.01.2025 23:59:56: Status = Processing
05.01.2025 23:59:56: Pass 1 - Requesting updates for 1 symbols...
05.01.2025 23:59:57: Pass 1 - UpdateHistories returned 0 symbols
05.01.2025 23:59:57: Ran Strategy on ESH25: 1 Signals, Run Time=283ms
05.01.2025 23:59:57: NextRun set to 05.01.2025 22:00
05.01.2025 23:59:57: Status = Completed
05.01.2025 23:59:57: Processed all Symbols
06.01.2025 00:00:07: Status = Processing
06.01.2025 00:00:07: Ran Strategy on ESH25: 0 Signals, Run Time=323ms
06.01.2025 00:00:07: NextRun set to 06.01.2025 23:55
06.01.2025 00:00:07: Status = Completed
06.01.2025 00:00:07: Processed all Symbols
06.01.2025 14:52:34: Status = Deactivated
06.01.2025 14:52:35: Leaving Polling Thread


Additional Info: I have the necessary trading permissions and market data for the paper account.

Does anyone know what might be causing this behavior? Any advice would be greatly appreciated!

Thanks in advance!
0
357
Solved
8 Replies

Reply

Bookmark

Sort
- ago
#1



0
Cone8
 ( 3.17% )
- ago
#2
Without reading all the details, let's agree that MarketClose orders don't exist for futures.
You simply shouldn't use this OrderType for futures, but if you do, they'll be converted to Market orders by the IB Provider.

Edit -
I see that you're using the AtClose signaling. This should work because that does place a Market order. I'll study the details now :)
0
- ago
#3
The repeated processing I described happens with the entry order (a normal market order), not the exit; it’s just that the strategy includes an at-close sell block.
0
Cone8
 ( 3.17% )
- ago
#4
You're right. Something is off. I'll look at this later today.
0
- ago
#5
Thanks for looking into it! Let me know if you need any additional details or logs to help troubleshoot. Appreciate your support!
0
Cone8
 ( 3.17% )
- ago
#6
I was able to duplicate these items. The problem seems to be the re-scheduling for the At-Close Signaling run earlier in the day which seems to be causing the whole mess. We'll have to figure this out for the Globex-type markets.

Stand by on this one.
0
Cone8
 ( 3.17% )
- ago
#7
These issues are fixed for Build 108.
0
Best Answer
- ago
#8
Thanks, Cone!
0

Reply

Bookmark

Sort