- ago
I have a live strategy running, which unexpectedly exited an orphan position. I'm curious how this could have happened, because my strategy uses only Market entries/exits (no limit/stop orders), and no other problems had happened leading up to this point. In order for an "exit orphan" command to be triggered, doesn't that mean the backtest had already exited the position, but the live strategy had failed to? If that were the case, wouldn't I see some sort of error message about a failed market sell?

0
119
7 Answers

Reply

Bookmark

Sort
Cone7
- ago
#1
Everything you said is right. And, the strategy was happy holding the position for more than an hour.

The only thing I can think of is NSF. Open your strategy and check the Strategy Settings. Is "Retain NSF Positions" checked?
1
MIH7
- ago
#2
The most common and systematic reason for WL not being in sync with the broker in this context is the fact that the backtester evaluates purely hypotetic trades.

This means that if a condition is met in the strategy for an exit, but the order is not filled in reality, the trade is terminated for the backtester and no further signals are generated.

Since the backtester does not query the broker's portfolio (the real status), the backtester cannot know this. What is not known cannot be reproduced as a message. Not receiving a message is the smallest problem...

The WL team should realise that trading is not backtesting and that one does not trade with hypothetical states but with the real status. The API interfaces are usually able to retrieve this information.

There is a feature request for which you can vote. I do not want to comment further on the fact that this functionality requires a vote.

This is at least one important piece of the puzzle the WL team is hunting for more than six months i guess. Maybe it helps ...
2
- ago
#3
@Cone: Retain NSF positions is checked. If you suggest disabling this, I will. The backtest only produces an NSF ratio of 0.01 (5 NSF positions over the last 8 months), and unchecking it doesn't seem to have a noticeable impact on the backtest results.
0
Cone7
- ago
#4
It should be checked, and frankly I thought the S. Monitor always "Retained" anyway (not really sure). I'm just looking for any possible reason that the Strategy at one time thought it had a position, but then decided that it no longer had a position without having signaled to exit it.

Please run that strategy in a Strategy window with the same settings.
1. First, does it enter the position on the same bar (the open of the 17:45 bar)?
2. If it exited the position, when was it?
1
- ago
#5
Things don't seem to match up very well in general, either in terms of entry or exit times, or even the symbols traded:

0
Cone7
- ago
#6
Actually, the trades line up perfectly with the declared trades for ALEPH. The strategy Positions table shows the timestamp of the bar on which the trade occurred, but the S. Monitor shows the previous bar for the Signal. You can see that the entry at 17:45 occurred after the 17:40 signal bar.

Likewise the backtest sold the ALEPH position on the 20:50 bar - the bar after the exit signal bar at 20:45, but this errored out since the position had already been sold by the orphan exit. That last trade shows that the strategy was actually still processing the exit logic still and something else influenced the orphan logic. We need to study this. (Any ideas @Glitch?)

Aside:
The entry for the penultimate trade, RBN, was the same too, but the exit was different. Differences like that can occur due to the differences in the bar data created by Streaming vs. the history generated by the historical provider. However, there really should be no difference if the streaming provider is giving us all the ticks.

Mike, please send the strategy to me so that we can be sure that there wasn't some sort of a "variable logic" error.
1
MIH7
- ago
#7
QUOTE:

...
Likewise the backtest sold the ALEPH position on the 20:50 bar - the bar after the exit signal bar at 20:45, but this errored out since the position had already been sold by the orphan exit. That last trade shows that the strategy was actually still processing the exit logic still and something else influenced the orphan logic.
...


Good point!

However, this signal was not present on the initial screenshot. I'm not sure, but the signal also looks unusual because it doesn't indicate a price or quantity. But since the exit logic is obviously still active, these values don't make sense, do they? Or is that also a consequential error of the orphan exit?
0

Reply

Bookmark

Sort