- ago
I was running a strategy in Strategy Monitor today. There is an active connection to T D Ameritrade. The backtest shows five signals today, however only one was received at T D Ameritrade. It was a closing order, which was rejected because an opening order was never received.

How to debug this issue ?

0
431
Solved
13 Replies

Reply

Bookmark

Sort
- ago
#1
I'd look into the Log Viewer first to see if it has recorded some issues coming from the broker provider.
0
Cone8
 ( 28.25% )
- ago
#2
We're sorry it didn't work as expected, but given almost no information about the tools used or how they're set up, I can list 3 or 4 reasons how this could happen. Next time, please add a screenshot of WL7 showing the Order Manager, the tool that's Auto-Placing the orders, and the Log Viewer if it's showing any messages from TDA.
0
- ago
#3
I already see the issue this morning. Here is what you requested, also shots showing that the data feed is good:



6/17/2021 06:27:35: Status = LoadingData
6/17/2021 06:27:35: Starting Streaming Bars Thread
6/17/2021 06:27:35: Populating Data
6/17/2021 06:27:35: Calling GetHistories Pass 1
6/17/2021 06:27:35: GetHistories returned with 2 symbols
6/17/2021 06:27:35: Calling GetHistories Pass 2
6/17/2021 06:27:35: GetHistories returned with 2 symbols
6/17/2021 06:27:35: UDOW has 312 bars from IQFeed
6/17/2021 06:27:35: SDOW has 312 bars from IQFeed
6/17/2021 06:27:35: NextRun set to 6/17/2021 9:45 AM
6/17/2021 06:27:35: Status = Idle
6/17/2021 06:45:00: Status = Processing
6/17/2021 06:45:03: Ran Strategy on SDOW: 0 Signals, Run Time=739ms
6/17/2021 06:45:04: Ran Strategy on UDOW: 0 Signals, Run Time=353ms
6/17/2021 06:45:05: NextRun set to 6/17/2021 10:00 AM
6/17/2021 06:45:05: Status = Completed
6/17/2021 06:45:05: Processed all Symbols
6/17/2021 07:00:00: Status = Processing
6/17/2021 07:00:05: Ran Strategy on UDOW,SDOW: 0 Signals, Run Time=355ms
6/17/2021 07:00:06: NextRun set to 6/17/2021 10:15 AM
6/17/2021 07:00:06: Status = Completed
6/17/2021 07:00:06: Processed all Symbols
6/17/2021 07:15:00: Status = Processing
6/17/2021 07:15:02: Ran Strategy on UDOW: 0 Signals, Run Time=484ms
6/17/2021 07:15:03: Ran Strategy on SDOW: 0 Signals, Run Time=362ms
6/17/2021 07:15:04: NextRun set to 6/17/2021 10:30 AM
6/17/2021 07:15:04: Status = Completed
6/17/2021 07:15:04: Processed all Symbols





0
- ago
#4
Hmm what issue are you seeing? The 3 strategies in the SM haven't generated any new signals. Neither did the Strategy window produce any signal.
0
- ago
#5
The backtest shows that there should have been a close position signal.
0
- ago
#6
Your strategy did not produce an exit signal. That's the point.
0
- ago
#7
What about the signal in the backtest: exit/close UDOW at 9:45 am (6:45)? If no open position, TOS gives a Rejected message "This order may result in an oversold/overbought position in your account."

I had a number of these yesterday because some signals were not getting to TOS:



The recent SOXS order I made manually because there was no signal from WL, but the backtest shows one.
0
- ago
#8
What UDOW signal on 06:45 do you mean? I'm having trouble finding one. Here's from the SM log:
QUOTE:
6/17/2021 06:45:04: Ran Strategy on UDOW: 0 Signals, Run Time=353ms
0
Cone8
 ( 28.25% )
- ago
#9
QUOTE:
What about the signal in the backtest: exit/close UDOW at 9:45 am

The problem with this one is that the signal is generated at the close of the previous day. Remember that Wealth-Lab timestamps are at the end-of-bar. A market order would be sold at the open of the 09:45 bar. So if you were running the strategy on Wednes, the signal would have been generated for the next bar (tomorrow) and immediately canceled because the TIF (time in force) for the order is "Day".

When this happens, there's no other recourse currently than to re-enter the order manually.

We could entertain the idea of making orders "GTC" if they are triggered on the last intraday bar of the day.

First, let me check if a signal would be generate during the S. Monitor initialization for the current day. It seems reasonable to show the current signals even if based on the last bar available.
0
Cone8
 ( 28.25% )
- ago
#10
Here's the answer. When you initialize the strategy for the day, it doesn't automatically run, and simply sets up the Next Run. To get the signals triggered by yesterday's last bar for the start of the day, right click the strategy and select "Run Now".

You have time to review, Stage, and/or Place these orders individually before enabling Auto-Place.

0
Best Answer
- ago
#11
Thanks. I was not aware of "run now", and not clear when it should be used. I thought all we had to do was drag and drop the strategy, activate it, then click either Auto-stage or Auto-place.

Below is the last portion of the strategy monitor log pane for one of the three strategies. The strategies were left running overnight. At 06:58:44 this morning I right-clicked one strategy and chose "run now". There is now a new message I have not seen before: Status = Deactivated. Is this a concern ?

The log prompts other questions:

At 12:45 there appear to be two separate runs of the strategy, however at 13:00 it was only one run. I see this frequently from all the strategies. Could this be partly causing my issues ?

This morning at 06:45 upon the first 15-min bar, I expected the strategy to process all symbols, but the status is "incomplete". Are you saying right-clicking and choosing "run-now" fixes this ?

It appeared that the three strategies became deactivated sometime between the market close yesterday and market open this morning, but there was no action taken here by anyone. The connections apparently held. Here is the log:






6/17/2021 12:45:00: Status = Processing
6/17/2021 12:45:03: Ran Strategy on SDOW: 0 Signals, Run Time=426ms
6/17/2021 12:45:06: Ran Strategy on UDOW: 0 Signals, Run Time=371ms
6/17/2021 12:45:07: NextRun set to 6/17/2021 4:00 PM
6/17/2021 12:45:07: Status = Completed
6/17/2021 12:45:07: Processed all Symbols
6/17/2021 13:00:00: Status = Processing
6/17/2021 13:00:02: Ran Strategy on SDOW,UDOW: 0 Signals, Run Time=472ms
6/17/2021 13:00:03: NextRun set to 6/18/2021 9:45 AM
6/17/2021 13:00:03: Status = Completed
6/17/2021 13:00:03: Processed all Symbols
6/18/2021 06:45:00: Status = Processing
6/18/2021 06:45:50: NextRun set to 6/18/2021 10:00 AM
6/18/2021 06:45:50: Status = Incomplete
6/18/2021 06:45:50: 2 Symbols not Processed: UDOW,SDOW
6/18/2021 06:58:44: Running Now
6/18/2021 06:58:45: Status = Processing
6/18/2021 06:58:45: Ran Strategy on UDOW,SDOW: 0 Signals, Run Time=384ms
6/18/2021 06:58:45: Status = Deactivated
6/18/2021 06:58:46: Status = Completed
6/18/2021 06:58:46: Processed all Symbols
6/18/2021 06:58:46: Status = Deactivated
6/18/2021 06:58:46: Leaving Streaming Bars Thread


0
Glitch8
 ( 12.08% )
- ago
#12
Doing a Run Now always deactivates a Strategy. This is because otherwise you might run into a conflict where another run occurs in an activated Strategy right after the Run Now completes. You can just activate the Strategy again, no problem.
0
- ago
#13
Here is something I found that you may not be aware of:

If the same C# strategy is saved three separate times, each with different data sets contained totally different symbols, I am assuming that the system treats these as totally separate strategies. However, when I clicked "run now" for just one of my three strategies in Strategy Manager, it deactivated all three of them.
0

Reply

Bookmark

Sort