Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Edgar_Herrera, VoroneTZ, Akow), 973 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 4
Page 1 of 4 1 2 3 4
Dual Momentum Algorithm - The way Zorro would have done it #468282
09/28/17 02:58
09/28/17 02:58
Joined: Sep 2017
Posts: 235
H
Hredot Offline OP
Member
Hredot  Offline OP
Member
H

Joined: Sep 2017
Posts: 235
Perhaps Zorro would not have done it better than anyone else.
But one thing is for sure:

Zorro would have given it to the people for free!

So, here we go:

Quote:
Disclaimer: Use at your own risk! You alone are responsible for your gains or losses.
Dual Momentum Algorithm V1.0

This script uses the same assets as the Z9 system.
Measuring performance during the years 2012-2017 starting with $5000 capital, we get:



The equity (green line) barely scratches the Balance (blue line) during drawdowns. So the script makes sure that no new trades can be opened if more than 2/3 of balance is tied up in current trades (red line). This makes it extremely unlikely for the green and red lines to ever meet, in turn making a margin call unlikely. Therefore, the script reinvests all profits instead of their square root to boost performance.

How does it compare with Z9 system performance?

Since this script reinvests profits over time, while Z9 does not seem to do so, it is kind of hard to compare their returns. Short term (one or two years period) Z9 does better, whereas long term this script is going to exponentially outgrow Z9.

Already at the above test period with the same starting capital we have:

Z9:
- Trades 151 times
- Makes 12144$ gross win
- Makes -1115$ gross loss

DualMomentumV1.0:
- Trades 84 times
- Makes 13717$ gross win
- Makes -904$ gross loss

We see that about five years is enough for the exponential growth of DualMomentumV1.0 to take over. It trades only half the time compared to Z9, which explains the smaller gross losses due to smaller transaction costs.

Of course gradually increasing the margin in Z9 by hand could exponentiate it as well. But having to estimate by how much to move the slider every couple weeks is less convenient than an automatic solution.

Since DualMomentumV1.0 reinvests automatically, you should not touch the Capital slider after you initially start and adjust the algorithm. The slider is only there to quickly backtest the algorithm with different starting points.

What do you guys think of this implementation?
Any improvement suggestions?

Cheers,
Hredot

PS:
In case if the admins find this a worthy contribution to the community, I'd be happy to find a Zorro S license in my inbox! grin

Last edited by Hredot; 09/28/17 13:32.
Re: Dual Momentum Algorithm - The way Zorro would have done it [Re: Hredot] #468285
09/28/17 06:47
09/28/17 06:47
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Well done! No Zorro S, but certainly fame and honour. When reinvesting, I hope you used the square root rule.

Re: Dual Momentum Algorithm - The way Zorro would have done it [Re: jcl] #468292
09/28/17 10:10
09/28/17 10:10
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline
User
MatPed  Offline
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
Nice Job, man!

Last edited by MatPed; 09/28/17 10:10.
Re: Dual Momentum Algorithm - The way Zorro would have done it [Re: MatPed] #468294
09/28/17 10:55
09/28/17 10:55
Joined: Dec 2016
Posts: 71
F
firecrest Offline
Junior Member
firecrest  Offline
Junior Member
F

Joined: Dec 2016
Posts: 71
Kudo to Hredot.

Re: Dual Momentum Algorithm - The way Zorro would have done it [Re: firecrest] #468299
09/28/17 12:41
09/28/17 12:41
Joined: Aug 2017
Posts: 102
Spain
B
Brax Offline
Member
Brax  Offline
Member
B

Joined: Aug 2017
Posts: 102
Spain
This thread literally came out of the blue!

I was about to implement Z9 on my own, so i will have a look into it.

Thank you very much.

Re: Dual Momentum Algorithm - The way Zorro would have done it [Re: firecrest] #468300
09/28/17 13:06
09/28/17 13:06
Joined: Sep 2017
Posts: 235
H
Hredot Offline OP
Member
Hredot  Offline OP
Member
H

Joined: Sep 2017
Posts: 235
Thank you guys!

The system reinvests so that always about 2/3 of Balance are tied up in trades.
Why?
With this strategy, the maximum drawdown in the simulated period was about 6% in 2016. Drawdowns happen once every couple years, but for the sake of discussion let's assume a very pessimistic case of one drawdown per year. If we assume that equity grows linearly (black line), then drawdown is going to increase from the initial 6% with time to the power 1.5 (red line). It will take it about 500 years to hit the 2/3 reinvested margin (green line):



But if we stick to the square root reinvesting rule (blue line) as opposed to the 2/3 rule (green line), we hardly would expect the nice return in equity (black line).

Still, for those who do not feel adventurous there is a comment in the script describing which line to change and how in order to reinvest according to the square root rule instead of linear.

Last edited by Hredot; 09/28/17 13:09.
Re: Dual Momentum Algorithm - The way Zorro would have done it [Re: Hredot] #468301
09/28/17 13:48
09/28/17 13:48
Joined: Jul 2017
Posts: 25
Bangkok
JoFo Offline
Newbie
JoFo  Offline
Newbie

Joined: Jul 2017
Posts: 25
Bangkok
very good job. 1+

Hope you try to code a better Z12 and Z7 too. They pretty useless so far.

Re: Dual Momentum Algorithm - The way Zorro would have done it [Re: JoFo] #468302
09/28/17 13:58
09/28/17 13:58
Joined: Sep 2017
Posts: 235
H
Hredot Offline OP
Member
Hredot  Offline OP
Member
H

Joined: Sep 2017
Posts: 235
@JoFo

I would not say that my script above is better than Z9!
If you increase your margin slider in Z9 by hand over time, you can get the same exponential growth with better trades per time unit.

I'd love to take a closer look at how to implement homebrew versions of the other Z systems. But unfortunately their description is vague, so I'm not too sure what to code.

Re: Dual Momentum Algorithm - The way Zorro would have done it [Re: Hredot] #468465
10/05/17 18:28
10/05/17 18:28
Joined: Jun 2016
Posts: 30
france
S
stephane97490 Offline
Newbie
stephane97490  Offline
Newbie
S

Joined: Jun 2016
Posts: 30
france
is there a way to adapte it on daily trading ?

Re: Dual Momentum Algorithm - The way Zorro would have done it [Re: stephane97490] #468466
10/05/17 18:42
10/05/17 18:42
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Perhaps, but this is an investment algorithm, not a speculative trading algorithm. It might be better to have less trades.

Page 1 of 4 1 2 3 4

Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1