- ago
This is WL9. We talk about the very last trading day of a backtest.

My Strategy has a Margin of 1.0 and an Equity of $268,448 at the last trading day of a backtest.

There are 5 Open Positions (20% of equity each):


If I sum Quantity*EntryPrice of all Open positions I arrive at $270,152

WL caclulates the Open Positions Total Size: $260,739. (Because the open positions show some loss)

This means my strategy is fully invested at this day - Fine.

But then it genreates this signal (with a value of $63053,76):

(No matter how if NSF positions are retained or not)

There are no Exit Signals(!)

Why does WL generate this entry signal being sure that it can't be filled?

Such signals cause me a lot of trouble....



1
189
11 Replies

Reply

Bookmark

Jump to End
- ago
#1
It generated a signal because your strategy called PlaceTrade. If you don’t want your strategy to generate a signal for whatever reason you have to code that in your strategy. For example, the Patreon strategy KJ Custom Anti Parabolic has an option to avoid generating entry signals if all six position slots are filled.
0
- ago
#2
Uh! No!
I dont agree!

... for a number of reasons:

#1: Building Block Strategies
QUOTE:
If you don’t want your strategy to generate a signal for whatever reason you have to code that in your strategy.

How would you do this/fix this in a Building Block strategy?

#2: WL should do it!
QUOTE:
If you don’t want your strategy to generate a signal for whatever reason you have to code that in your strategy.

Do you really want to force every strategy developper to add code to prevent signals/orders that can't be filled in a no-margin account?

#3: Can't connect an EOD strategy to Interactive Brokers or Collective2
The behaviour prevents me from connecting a simple (or complex) EOD strategy with a broker like IB or C2. These have a 2:1 or even 4:1 margin by default and would accept and fill these orders at market open. The next day I have the resulting positions in my broker account but not in Wealth-Lab. This creates an out-of-sync situation - every day!

#4 WL already does it
WL conducts the nessesary calculations for every trading day during a backtests. Only those PlaceTrade() signals are filled that find enough remaining buying power.
But at the last trading day WL becomes lazy and does not check the remaining buying power. I don't understand why and consider this a bug.

Conclusion: Please, please do not generate signals that can't be filled!
0
- ago
#3
Hi DrKoch,

We don't plan to suppress these signals, even when they would result in NSF (Not Sufficient Funds) during the backtest.

One important reason is that a user might begin trading a strategy at any point in time. A signal that couldn't be executed in the historical backtest due to insufficient funds could still be a perfectly valid entry opportunity for someone starting to trade the strategy today.

Also, these signals provide valuable information and metrics, even when they aren't executed. Suppressing them would remove potentially useful insights into the strategy's behavior.

So this is intentional behavior, and we believe it's more useful to display the signals and let users decide how to act on them.
0
Cone8
- ago
#4
#2 -
Use Preferences > Trading > Thresholds to assign Open Positions by account.
In your example - and assuming this is the only strategy trading the account - just set the Open Positions threshold to 5 to block additional entry orders.

Logic in the Strategy Monitor only (with "Wait for all Updates Before Processing") allows At Market exits to be replaced by At Market entries on the same bar. As always, the signals with the highest Transaction.Weight are processed first.
0
- ago
#5
Thanks for all the good advice, but it does not solve my trouble.

I made my Point in the first post with a (very) simplified example. In fact I have a multitude of strategies and trade them in parallel in a Bensdorp style combined trading strategy.
(see https://www.wealth-lab.com/Discussion/Laurens-Bensdorp-s-Automated-Stock-Trading-Systems-9377)

There are Building Block strategies and C# coded strategies. They have very different and sometimes dynamic position sizes, so a limitation of number of positions does not help. Also I can't / don't want to modify these strategies.

If you connect such a combined strategy to a broker and there are NSF entries that are filled by the broker but never filled in WealthLab, then you'll end up with a hell of unsynchronised positions - every day.

Fortunately - no panic - I found a way to purge these entry signals in my new infrastructure, so I am fine.
1
- ago
#6
QUOTE:
If you connect such a combined strategy to a broker and there are NSF entries that are filled by the broker but never filled in WealthLab, then you'll end up with a hell of unsynchronized positions

So why is the broker filling NSF positions that WealthLab isn't approving? That does sound like a bug of some kind.
0
Cone8
- ago
#7
Re:
QUOTE:
NSF entries that are filled by the broker but never filled in WealthLab
NSF positions are indeed always filled by WealthLab in the backtest as long as you don't prevent it by disabling "Retain NSF Positions" in the Strategy Settings.
0
- ago
#8
We're not talking NSF Positions.
We're talking NSF signsls. (see first Post)

These are generated by WL, sent to the broker, filled by the broker and result in a position in the broker account.
They don't result in an open position within WL. Thus generating out-of-sync positions in the broker account.
0
Cone8
- ago
#9
"NSF Signal" is a new one on me because it doesn't exist. We've always called those "orphaned positions".

It should be a pretty rare thing though. The only way I can imagine it happening is if an odd lot limit order fills beyond the High/Low of the day. That can happen because providers don't apply odd lots to a BarHistory. Is there another way you've known it to occur?
0
- ago
#10
Cone,
please check initial post of this thread.
It happens whenever a strategy is fully invested (Sum of open position values close to current equity * Margin Factor) and the strategy calls another PlaceTrade(@Market) for the next trading day.
It emerged the word "NSF entry signal" for these during this discussion.
0
Cone8
- ago
#11
I understand where you're coming from now. Thanks.
0

Reply

Bookmark

Jump to Top