- ago
On my ongoing quest for new inspirations I bought Laurens Bensdorp’s book „Automated Stock Trading Systems“



In the first half of his book he talks about his rich experience as a trader and teacher and the psychological aspects of trading. He details the mindset necessary to be a successful trader and explains all the interesting things that happen if a trader’s expectations, phantasies, wishes and hopes collide with real-time reality.
In the second half he presents and explains the wonders of diversification. For Bensdorp diversification is not (only) about a large watch list/portfolio/DataSet of stocks but also and foremost about a portfolio of uncorrelated trading systems. In order to illustrate his ideas he presents seven trading systems in great detail.
Out of curiosity and to test the current power and abilities of Wealth-Lab I implemented and published (my personal interpretation of) these trading systems:

Bensdorp's Short Rsi Thrust
https://www.wealth-lab.com/Strategy/DesignPublished?strategyID=48

Bensdorp's Short Mean reversion High Six-Day Surge
https://www.wealth-lab.com/Strategy/DesignPublished?strategyID=47

Bensdorp's Long Trend Low Volatility
https://www.wealth-lab.com/Strategy/DesignPublished?strategyID=46

Bensdorp's Long Trend High Momentum
https://www.wealth-lab.com/Strategy/DesignPublished?strategyID=45

Bensdorp's Long Mean Reversion Selloff
https://www.wealth-lab.com/Strategy/DesignPublished?strategyID=44

Bensdorp's Long Mean Reversion High ADX Reversal
https://www.wealth-lab.com/Strategy/DesignPublished?strategyID=43

Bensdorp's Catastrophe Hedge
https://www.wealth-lab.com/Strategy/DesignPublished?strategyID=42

These are real world trading system, complete with the following parts:
Filters
Filters are used to remove stocks with low volume and low prices (penny stocks).
Differentiators
A condition which helps to make a trading strategy uncorrelated form other trading strategies
Setups
This are conditions the price series must fulfill in order to be considered a trading candidate.
Entries
Market or Limit orders along with limit price calculations
Weighting / Ranking
If there are more candidates than available capital then entry orders are issued for stocks with the highest weighting only.
Exits
A complete set of exit orders:
• Stop Loss
• Profit Taking
• Time based exits / Timeouts
6
2,967
55 Replies

Reply

Bookmark

Sort
MIH8
- ago
#1
Thanks for the effort!
0
- ago
#2
It is possible to combine all these seven systems in a WL Meta Strategy:


And the results are stunning. Here the equity curve:



WL can produce the equity curves of all combined systems in a single graph:



And finally a summary of metrics:



1
Glitch8
 ( 13.91% )
- ago
#3
Looks like we need a new TASC article feature these findings!
2
- ago
#4
In the book Laurens Bensdrop has two different informations about the Watchlist/Portfolio/DataSet he is using.

On page 53 he talks about 40'000 stocks, half of them delisted.

On page 172 He says "The US markets have a tradeable universe of approximately 7000 stocks to work with"

Both numbers are a bit out of reach as long as you don't have an expensive data provider (like Norgate or IQFeed).

So I adapted the parameters using the SMAC optimizer and the methods mentioned in the "How to address overfitting" forum thread (https://www.wealth-lab.com/Discussion/How-to-address-overfitting-9305) to work for the WealthSignals portfolio (738 symbols).
0
- ago
#5
I learned a few things during the journey:

1. A single system needs not to be good all the time. Diversification is the key.
2. The effect of diversification is much larger than I expected.
3. If you are looking for (more or less) extreme trading opportunities, the size of your DataSet makes a huge difference.
1
- ago
#6
Oh, I forgot to mention:
Looking at all the results in this thread one thing becomes clear: Wealth-Lab is a GREAT SOFTWARE PACKAGE!
3
- ago
#7
Here are the system correlations:

2
- ago
#8
Thank you very much DrKoch for sharing the results of your hard work.

This one is a gem that deserves to be pinned to the top, for a long while!

A couple of weeks ago, I saw the reference to this book in another post, in this Forum; and I just started reading it last weekend. The book doesn't come up with much new, but it is an eye opener how the combination of a set of uncorrelated average systems results in a robust market-beating meta-strategy. Simple really is better, most of the times. Very underrated book (at least, I never saw it referenced until very recently).

Again: thanks for sharing!!
0
- ago
#9
I just let the MetaStrategy run again with the Out-of-Sample Interval 2022-today included:
(I never used this data for Bensdorp's systems before)



... very reassuring!
1
- ago
#10
From the profit curves (equity curves of individual systems in the MetaStrategy) it becomes obvious how diversification worked at its best during the two last difficult years:


0
ww58
- ago
#11
Thank you for your efforts. The results are impressive, I'll try to replicate this. I'm definitely doing something wrong, as I haven't managed to beat the market even on history yet. Even with the strategies already published here.
0
Glitch8
 ( 13.91% )
- ago
#12
I contacted My Bensdorp on LinkedIn to let him know about this implementation. Maybe he'll become an avid WealthLab supporter! :D
3
ww58
- ago
#13
How can AvgTurnover from finantic.Indicators be replaced in these scripts?
0
Glitch8
 ( 13.91% )
- ago
#14
If it’s name is accurate it could be an SMA of the Turnover indicator.
1
- ago
#15
The Turnover here in these scripts is just a filter to ensure that there's enough trading happening (i.e. avoid illiquid stocks)

If your data doesn't have Turnover available, then using Close * Volume as the turnover figure should approximate the turnover.
1
Glitch8
 ( 13.91% )
- ago
#16
Our built-in Turnover Indicator is already a shortcut for the Close * Volume.
0
ww58
- ago
#17
Changed avgTurnover to "new SMA(new Turnover(bars),20);"
the rest are default settings, without margin. Got the following picture, which is different from the one here

The only difference in settings I see is PosSizer absence in my case, since I haven't found exactly like that. Where am I wrong?
0
- ago
#18
QUOTE:
How can AvgTurnover from finantic.Indicators be replaced in these scripts?

The correct answer is: You should not replace it! Buy the finatic.Indicators extension instead.

You ask "why should I"?

Let me explain:
What you see here (the seven Bensdorp strategies implemented for WL8) is the result of many hours of hard work partly on Mr. Bensdorps' side, partly on my side.
Based on many years of experience with WL. Based on many hours of experimenting.
If you look through the code you could see literally decades of programing experience.

And true: I built in three small mechanisms of compensation. And instead of asking yourself how you can go around this mechanisms you should:
* Buy the book and read it
* buy as many finantic extensions as you can (You'll need them in going forward anyway)
* think about giving back in various other ways like sharing your results on the forum or donate some money.

I can assure you: If you try to make things as cheap as possible for you you'll be never able to replicate the results shown in this thread or even improve on them.
2
- ago
#19
All strategies use limit orders. But at the same time, tests are weighted - positions with the highest weight are opened. Isn't this a peek into the future?
0
Cone8
 ( 32.23% )
- ago
#20
There's a Strategy error (oversight) in "Catastophe Hedge". Line 48 checks to see if a Long Position is active to limit the strategy to one position per symbol, but instead it should be checking for an open Short Position.

I can probably correct the public strategy, but if you already downloaded, you'll have to make the change on your local machine. Or are these refreshed/downloaded with each restart?
1
Cone8
 ( 32.23% )
- ago
#21
Corrected.
The strategy will be automatically corrected by restarting WealthLab (with a connection).
1
Glitch8
 ( 13.91% )
- ago
#22
>> All strategies use limit orders. But at the same time, tests are weighted - positions with the highest weight are opened. Isn't this a peek into the future?<<

In a way yes, it’s causing the backtest to choose orders that might not have actually been the ones that would have filled first in live trading. A deterministic approach would limit the number of entries to ensure only a specific number would fill to meet the equity.

For this reason I prefer to use Weights only for market orders, where the results are deterministic. Or if I must use limit orders I sort by the Weights in PreExecute and only place an appropriate number of orders that I know will fill.

I vote we remove the Weights for published strategies using limit orders for more realistic results. You could then use our Monte Carlo Lab extension to get a true idea of their potential.
0
- ago
#23
I've referred to Laurens Bensdorp's a few weeks ago during an non-market-correlation discussion.
https://www.wealth-lab.com/Discussion/How-to-leave-only-strategies-with-smooth-equity-curve-9302

His approach to follow a non-correlated approach (with up to 50 different strategies) impressed me pretty much at that time. I came across him via an interview with Tom Basso. The only thing that made me a bit skeptical was his choice of Universe, which according to the book consists of NYSE + ARCA + NASDAQ stocks (survivorship bias free).

From what I know, he's also a big believer in rotational strategies, which could mean he could feel comfortable in WL.

Nevertheless, "Dankeschön" to Mr. Koch for the effort he put into his WL dev work. I had this on my radar last year, but unfortunately had to push it out to 2023.
0
- ago
#24
Where might I find the "WealthSignals" portfolio?
0
Glitch8
 ( 13.91% )
- ago
#25
https://www.wealthsignals.com

0
- ago
#26
Thanks..
I don't see the 783 symbols that Dr Koch was referring to..
0
- ago
#27
I don't see how to replicate Dr Koch's Position Sizers. ""Max Risk Limited" Do these require a special extension?
0
- ago
#28
I totally agree that diversification is the key.
0
- ago
#29
QUOTE:
I don't see the 783 symbols that Dr Koch was referring to..

https://www.wealthsignals.com/symbol-list
1
- ago
#30
QUOTE:
I don't see how to replicate Dr Koch's Position Sizers. ""Max Risk Limited" Do these require a special extension?


This will be included in the next build of finantic.Indicators.
1
ww58
- ago
#31
>https://www.wealthsignals.com/symbol-list

Wouldn't this set lead us to the survivorship bias? Or the key is "Max Risk Limited" sizer?
0
Cone8
 ( 32.23% )
- ago
#32
Yes, any current symbol list inherently leads to survivorship bias. Use one of the Wealth-Data DataSets (like the S&P 500) to eliminate the bias, or one of many of those offered by Norgate Data.

fyi, WealthSignals stocks are the current symbols in the S&P 500, Nasdaq 100, selected highly liquid ETFs, and a handful of stocks that some users requested to trade.
0
- ago
#33
Thanks to Eugene and Dr Koch
0
- ago
#34
Given the liquidity (turnover) constraints in these systems, you could use the Russell 3000 (Current & Past) which goes back to 1990 with no survivorship bias with Norgate Data.

There wouldn't be many qualifying (or statistically significant) trades beyond that.

Cheers,
Richard.
0
- ago
#35
Tested a meta-strategy of seven strategies on the SP500 (WealthData). 14% for each strategy. Yearly Rebalance. Comission 0.05% tradeValue.

Result: 8-9% APR, drawdown -10%. Not too much :)

I could not test it on Russell 3000 CurrentAndPast(NorgateData), because apparently my computer is not powerful enough and the WL8 freezes.



0
Glitch8
 ( 13.91% )
- ago
#36
You’ll probably need more RAM when testing the Russel 3000, I have 64gig
and can backtest it without issue.

Also it looks like you might bump up the position sizes?
0
- ago
#37
"You’ll probably need more RAM when testing the Russel 3000, I have 64gig"

Yes, I only have 32 gig

"Also it looks like you might bump up the position sizes?"

It's probably possible. Exposure is only 36%
0
- ago
#38
Anyone care to share what they find to be a realistic average turnover to use in back testing? Cesar Alvarez mentioned that he used a 21 day average of $5 million when testing low volume stocks.
0
vk8
 ( 102.58% )
- ago
#39
Sounds like a good idea, it seems to combine the volume and the stock price.
0
- ago
#40
The first version of these scripts implemented ranking and limiting the number of positions with a transaction weight and a "Max Open Pos" setting in Strategy Setting->Positio Sizing.
This raised some (justified) concerns beause both cause some subtle form of peeking into the future.
As a consequence the weighting was removed form the published scripts.
This makes backtest results highly variable because on busy days positions are choosen randomly by WL. Furthermore a system with many limit orders is hard to trade without additional software or manual intraday interventions.
In order to remedy concerns and difficulties I implemented a ranking mechanism for the Bensdrop strategies:
Daily candidates are renked and only orders with high priorites are issued.
To find a good number of orders to send it usefull to know how many of the ordes sent will be filled. This impossible to know pof course but it is possible to estimate the fill probability form the past.
I implemented a "Fill Probability Estimator" to do this job.
Here is a comparison of two strategies, first with weight and without weights, second with ranking:


Columns B and D show the original strategy with weight. B is the original weight, C is weight * (-1). It becomes clear that this weight has just a small effect: APR 33.6% vs. 30.7%.

Column C shows the current Strategy with weighting removed. This is just one example. If run several times you'll find results which are somewhere between B and D because WL chooses the trades randomly.

Column A shows the results of the new version 2 of the strategy. This works with the new ranking mechanism. It has slightly less trades, which results in lower APR but also in lower Max.Drawdown.

This comparison shows that ranking is not much worse than the (illegal) weighting.


0
- ago
#41
I equipped all Bensdorp Strategies with limit entries with the new ranking mechanics and published the scripts with a "V2" it their name.

The Gesamtkunstwerk ("total work of art") now looks like this:

The results are as stunning as before:

Metrics Report (Favourite Scorecard):


0
- ago
#42
This should now be very close to the specs in the book. The main difference being the DataSet. All results here are produced with "WealthSignals" DataSet (738 symbols, listed only) while the book is based on "All stocks traded at NYSE, NASDAQ and AMEX, listed and delisted".
0
Glitch8
 ( 13.91% )
- ago
#43
Interesting, I wonder if the author was able to do a true survivorship bias test by considering the period symbols were in the index, or just used all symbols,
listed and delisted.
0
- ago
#44
@Glitch
At least that's what he wrote in his book. Since he's aware of the survivorship bias issue using such a long period, I would assume that he has taken this into account.
0
- ago
#45
I am trying to replicate Dr. Koch's results. When I was looking at the MetaStrategy I had some observations that I was hoping you can clear up.

I understand the WealthSignals portfolio is 738 symbols.

How does Portfolio weight choose which symbols because that many symbols is too many to trade constantly? So if I choose a 2% of equity, I still could not trade all the symbols without having NSF?

Also, why choose a Portfolio weight greater than 100% when you add up the 7 strategies in the MetaStrategy.

Here is the snippet I am looking at:



For me, if I had 7 strategies, then the weight should be considering how many strategies and how many assets in each DataSet portfolio.

So for my simplistic example. I have a portfolio of 10 assets.
Each of the 7 strategies would add up to a total of 100%. So I would make each strategy 14% Portfolio weight.

Not sure how, Wealthlab takes it's symbols when the true portfolio is 738 assets. I assume, that I would get NSF. Also, probably, would get different results when I run the test over and over again.

Thank you for your time.
Larry
0
Cone8
 ( 32.23% )
- ago
#46
The % allocation is displayed next to the "Weight".

In other words, you can put the "weight" at 100 for all of them. That makes them equal "weight". Likewise, the % allocations will all be equal, but the % allocations will add to 100%.
0
- ago
#47
Cone,
Thank you,
Larry

0
- ago
#48
Dr. Koch and forum members,

Just wanted to say thank you for this thread. I learned a lot and appreciate the time and effort of all the work that was done.

Much appreciated.

Larry
0
Glitch8
 ( 13.91% )
- ago
#49
Yes thank you DrKoch and others. Very gratifying to see some interesting research published on WL.com!
0
- ago
#50
In the meantime, I finished reading the book last weekend: very easy to read!

Although the concepts are simple and the systems explained don’t bring much new; it really is an eye opener in regards to the power of trading a set on uncorrelated strategies! I knew that diversifications of trading systems was the way to go; but was not aware of how powerful it really is…

Very well worth the time and the cost (not only it is cheap, but the proceedings seem to be going for charity).
0
mjj38
- ago
#51
One other small correction relative to the book is for the Long Trend Low Volatility the SPY Sma should be 200 not 100.

P.S. Thanks Dr. Koch for publishing this. We should all try to do the same for books we read to help out the community.
0
pmbf8
- ago
#52
@DrKoch, can I ask why is the below code used in the Long Trend High Momentum strategy even though you have already set a stop loss at 5*20D ATR from the entry price in the 1st half of the code?

CODE:
public override double GetMaxRiskStopLevel(BarHistory bars, PositionType pt, int idx)       {          double stop = bars.Close[idx] - 5.0 * atr20[idx];          return stop;       }

0
- ago
#53
These are two completely different things:
1. Exit a Position with a stop loss like this:
CODE:
// Stop Loss ClosePosition(p, OrderType.Stop, p.EntryPrice - 5.0 * atr20[p.EntryBar], "Stop Loss");

2. Defining a GetMaxRiskStopLevel() routine.

The latter is (exclusively) used by the Position Sizing method "Max Risk Percent" and related position sizers like Advanced Pos Sizer->Max Risk % Limited to % of Equity.

The existence of a Routine GetMaxRiskStopLevel() does not close any Positions.

See Help->Strategy->Strategy Settings->Max Risk Percent for further details.
0
pmbf8
- ago
#54
Hi DrKoch,

Thank you for providing your reply and for putting in the effort in writing the codes.

It seems that The Long Trend High Momentum strategy is using the position sizing method, "Percent of Equity", in Strategy Settings as default. In this case, wouldn't defining the GetMaxRiskStopLevel in the code be redundant since GetMaxRiskStopLevel is used only when "Max Risk Percent" or "Advanced Pos Sizer" is used? Or was GetMaxRiskStopLevel written so as to faciliate users who wish to switch from "Percent of Equity" to "Max Risk Percent"?

Furthermore, can I kindly ask where in the code sets the 2% Risk level per trade? I can only see it mentioned as a comment on line 14.

I have attached the Position Sizing settings that I am using for your reference.

0
- ago
#55
QUOTE:
is using the position sizing method, "Percent of Equity"

If you read the book, you'll see that Bendorp uses "Max Risk % Limited to % of Equity" in most of his strategies. For reasons unkonwn to me the publisher strategies come with Position Size: "Percent of Equity". This is not intended and you should change the position sizing method accordingly.

QUOTE:
In this case, wouldn't defining the GetMaxRiskStopLevel in the code be redundant

Yes. The GetMaxRiskStopLevel() routine is used by "Risk %" position sizers only.

QUOTE:
Furthermore, can I kindly ask where in the code sets the 2% Risk level per trade?

This is a property of the (Advanced) pos sizer. It is set outside the strategies code.
Go to Strategy Settings->Position Sizing.
Select Position Size: Advanced Pos Sizer
Select the "max Risk % Limited to % of Equity" Positon Sizer.
Click "Configure Position Sizer"
Here it is possible to set:
Max Risk %: 2.0
Pct of Equity: 10.0
0

Reply

Bookmark

Sort