Gamestudio Links
Zorro Links
Newest Posts
file_write var array ?
by laz. 10/22/19 16:00
SAV_STATS
by MatPed. 10/22/19 13:57
Instrument Price Zorro Chart
by jcl. 10/22/19 10:39
Accessing All Historical Price Data
by jcl. 10/22/19 10:37
Calculating with price series
by AndrewAMD. 10/21/19 14:31
Error E355: Startup failure
by Dooley. 10/21/19 06:47
Today real live account blown - my experience
by Clifford_B. 10/19/19 17:09
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
14 registered members (JamesHH, AndrewAMD, alibaba, jenGs, FLD, jyd, MatPed, Dalla, 3 invisible), 672 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
VillageTalkies, line7, Shutch, Clifford_B, Paulius
18310 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,033
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,033
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: 568
Milano, Italy
M
MatPed Online
User
MatPed  Online
User
M

Joined: Feb 2015
Posts: 568
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: 66
F
firecrest Offline
Junior Member
firecrest  Offline
Junior Member
F

Joined: Dec 2016
Posts: 66
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: 101
Spain
B
Brax Offline
Member
Brax  Offline
Member
B

Joined: Aug 2017
Posts: 101
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: 774
Chicago
AndrewAMD Online
User
AndrewAMD  Online
User

Joined: Feb 2017
Posts: 774
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

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