Gamestudio Links
Zorro Links
Newest Posts
oldschool fps project
by 3run
56 minutes 42 seconds ago
[ALL STYLES] 2D Videogame Artist (pixel, vector, painted)
by DesixStudios
Today at 14:45
Easy question
by jcl
Today at 13:47
Cheap bouncing shells/gibs
by 3run
Today at 00:36
WED doesnt show all entity actions in the behavior list
by rayp
Yesterday at 22:31
Fullscreen Antialiasing plugin
by Iglarion
Yesterday at 22:29
Date field in dataset functions
by jcl
Yesterday at 10:55
AUM Magazine
Latest Screens
RPG PARTY
Triton Wing now available on Steam
AckCon'17: Lotter vs The World
Triton Wing
Who's Online
13 registered (Hredot, jumpman, 3run, Ch40zzC0d3r, Kartoffel, AndrewAMD, MasterQ32, kujo, FLD, 1 invisible), 462 Guests and 5 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
cme, pataba, byano, Tuguldur717, jmgrnt7
17833 Registered Users
Page 2 of 4 < 1 2 3 4 >
Topic Options
Rate This Topic
#468468 - 10/05/17 22:01 Re: Dual Momentum Algorithm - The way Zorro would have done it [Re: AndrewAMD]
Hredot Online
Member

Registered: 09/11/17
Posts: 106
@stephane97490
Short answer: Nope

Long answer:
This strategy opens long only trades, to profit from the constant upwards drift of the market, which is just the fact that market is based on the work of hardworking businesses who constantly tend to produce more value than there was before. Essentially, if you pick all of the assets and long trade all of them in equal amount forever, you will make slightly less money over time than the above script. At daily time frames this upwards drift dilutes to zero, and you are left with fluctuations around the mean. While it is safe to bet on the overall market growth over months and years, daily fluctuations are not as easy to predict. So this would not work at hourly or daily time frames.


Edited by Hredot (10/05/17 22:02)

Top
#468545 - 10/09/17 17:53 Re: Dual Momentum Algorithm - The way Zorro would have done it [Re: Hredot]
stephane97490 Online
Newbie

Registered: 06/04/16
Posts: 29
Loc: france
Thanks, I understand that the main idea is to predict the trend... When you estimate that compenent. You have to use the best filters.

Top
#468593 - 10/11/17 14:14 Re: Dual Momentum Algorithm - The way Zorro would have done it [Re: AndrewAMD]
kmerlo Offline
Newbie

Registered: 03/08/17
Posts: 47
Loc: Bologna
I founded a strange behavior about costs

if I write inside the "function run()" these rows

RollLong= 0;
RollShort=0;
Commission=0;
Spread=0;
Slippage=0;
Fill= ATCLOSE;


In the performant report I found some costs!

Simulation mode Realistic (slippage 0.0 sec)
Capital invested 5000$

Gross win/loss 12728$ / -1195$ (+60334p)
Average profit 1967$/year, 164$/month, 7.56$/day
Max drawdown -622$ 5.4% (MAE -2570$ 22.3%)
Total down time 14% (TAE 85%)
Max down time 77 weeks from Dec 2015
Max open margin 8817$
Max open risk 206$
Trade volume 88079$ (15019$/year)
Transaction costs -151$ spr, 0 slp, 0 rol, -30$ com



instead if I write the same rows in the script "Workshop4_2.c" the result is as I want:

Simulation mode Realistic (slippage 0.0 sec)
Spread 0.0 pips (roll 0.00/0.00)
Contracts per lot 1.0

Gross win/loss 9.45$ / -0.31299591b (+914p)
Average profit 1.39$/year, 0.11589078b/month, 0.00534881b/day
Max drawdown -0.38999176b 4.3% (MAE -1.04$ 11.3%)
Total down time 1% (TAE 73%)
Max down time 14 weeks from Mar 2011
Max open margin 24$
Max open risk 0.82628334b
Trade volume 384$ (58$/year)
Transaction costs 0 spr, 0 slp, 0 rol

Top
#468628 - 10/11/17 22:04 Re: Dual Momentum Algorithm - The way Zorro would have done it [Re: kmerlo]
Hredot Online
Member

Registered: 09/11/17
Posts: 106
My guess is, the Z9 as well as DualMomentumV1.0 scripts both load asset definitions from AssetsZ9.csv. These probably overwrite your settings. Try to set these parameters to zero for all assets in AssetsZ9.csv as well, then I guess it should work as you want.

Top
#468630 - 10/11/17 22:37 Re: Dual Momentum Algorithm - The way Zorro would have done it [Re: Hredot]
kmerlo Offline
Newbie

Registered: 03/08/17
Posts: 47
Loc: Bologna
Yes the reason was that!
indeed I have changed the file "AssetsZ9.csv" putting the value "0" in column "Spread" and "Commission" and now the result it is OK ! laugh

Transaction costs 0 spr, 0 slp, 0 rol

Thanks A lot!!

Good Night


Edited by kmerlo (10/11/17 22:38)

Top
#468946 - 10/28/17 23:08 Re: Dual Momentum Algorithm - The way Zorro would have done it [Re: Hredot]
Mook_Yon Offline
Newbie

Registered: 01/30/17
Posts: 8
@Hredot

Re your DualMomentumV1.0 script, I have a couple of Qs.
There are two classes (A) Technical, (B) Comparative.

A. TECHNICAL
(1) Kudos for making it public. Fascinating write-up. THX!
(2) How far back was this tested (vs. Z9) (did you succeed in starting earlier than 2008)?
(3) Have you optimized ‘myDaysUpdate’, BarPeriod, etc.?
(4) How did you select the Stop ATR TimePeriod, and the (x3) coefficient?
(5) What is the percentage of losing trades closed by the Stop Loss feature prior to reaching the rebalance event (@myDaysUpdate)?
(6) Did you try making the Stop trailing?

B. COMPARATIVE
We back tested a strategy similar to Antonacci's GEM, wo leverage and wo Stop Loss.

Every month (Jan 2008 thru Sep 2017) we sorted the recent 12 months returns of BIL, CWI, and SPY and invested long in the highest returning instrument (if BIL showed the best return, we invested in AGG). Our back tested CAGR was 5.7%, while Antonacci reported (here: https://www.optimalmomentum.com/gem_trackrecord.html) on 7.85% for the same period. IMHO, there is a significant gap than demands clarification.

I am interested to know if you were successful in replicating the results reported by Antoncci?

Rgds,

Top
#468951 - 10/29/17 02:10 Re: Dual Momentum Algorithm - The way Zorro would have done it [Re: Mook_Yon]
Hredot Online
Member

Registered: 09/11/17
Posts: 106
Hi Mook_Yon!

A1) Thanks! laugh
A2) No, unfortunately I only went back to the end of 2008, since I did not experiment with other assets. It might be interesting to check the code before 2008!
A3) BarPeriod is set to 1 day since that is the most easily available data format. Since the time frame of momentum is one year, this should be fine graded enough. I did play around with the myDaysUpdate setting and 15 seemed to produce better results than 20 or 10. However, I did no rigorous statistical analysis to support this.
A4) The ATR TimePeriod and x3 coefficient are selected such that the stop loss does not interfere with any of the trades performed in the backtest. The logic is: the algorithm is supposed to work without stop loss, but we cannot be sure that the market will not completely collapse within a period of 15 days some time in the future. So we put a stop loss in place at a very far distance just in case. Ideally it will never be triggered.
A5) 0% closed by stop loss.
A6) Nope, since it is only a precaution, not an applied feature.

B) I'm not sure about the assets you describe. However, we can perform a backtest of DualMomentumV1.0 between 2009 up to today without leveraging. To do that, we just have to open AssetsZ9.csv file in History folder in the main Zorro installation directory and change all leverage fields from 2 to 1. And set e.g. StartDate=2000; in the script (it will only start in 2009 though, since the history of assets used starts at end of 2007).
The result is 8.83% CAGR which can be reconciled with the 7.85% by Antonacci (his value is a bit lower, since his trades have to endure more of the bearish period during the last big crisis).



Edited by Hredot (10/29/17 02:15)

Top
#468954 - 10/29/17 15:00 Re: Dual Momentum Algorithm - The way Zorro would have done it [Re: Hredot]
Mook_Yon Offline
Newbie

Registered: 01/30/17
Posts: 8
Thank you Hredot!

Coming from Value Investment background, after reading Antonacci’s Dual Momentum book, I desperately needed a “sanity check” method. I wished to use Zorro in order to reproduce, and validate Antonacci’s published back test performance.

Unfortunately, using your code, I could not yet validate or re-create Antonacci’s claim to fame (CAGR).

In his Dual Momentum Investing (chapter 8, under the subtitle “HOW TO USE IT”), Antonacci provides a detailed framework of the strategy: look back 12 months, rebalance monthly, at any rebalance invest the entire account balance in a single long position, use IVV or VOO for US stock, and VEU or VXUS for non-US, and finally BIL for checking T-bills (AGG, BND, or SCHZ should be purchased when BIL was the best performer).

Looking at you code, there are plenty of detours from Antonacci’s Dual Momentum framework: usually positions are gradually entered long, leverage is employed, multiple (best past performers) positions are held simultaneously, etc.

Back testing your (greatly done) replica of Z9 (with the initial Z9 asset list) though, produced very nice returns and forum members may consider using it live. Thanks for that!

Top
#468982 - 10/31/17 23:55 Re: Dual Momentum Algorithm - The way Zorro would have done it [Re: Mook_Yon]
Nanitek Offline
Senior Member

Registered: 03/25/15
Posts: 327
Loc: Rogaland

Thanks for sharing!

I have tried to use it, but the trades are not entered. Does "enterLong();" work with IB or another instruction is needed? Or I may added the wrong ETF to IB. I am using the asset list of the z9 system.

This is what I get.

Quote:

Download CSJ.US.. 2720 bars read
[638: Tue 17-10-31 04:00] (105.2700)
enter trade
!Order Message:
BUY 1 XBI ARCA
Warning: your order will not be placed at the exchange until 2017-10-31 09:30:00 US/Eastern XBI-STK--0--SMART--USD
(XBI::L) Can't open 1@83.80 at 04:00:01
enter trade
[SMH::L] Skipped: Lots 0
enter trade
!Order Message:
BUY 2 ITB BATS
Warning: your order will not be placed at the exchange until 2017-10-31 09:30:00 US/Eastern ITB-STK--0--SMART--USD
(ITB::L) Can't open 2@39.36 at 04:00:01
enter trade
!Order Message:
BUY 1 XLV ARCA
Warning: your order will not be placed at the exchange until 2017-10-31 09:30:00 US/Eastern XLV-STK--0--SMART--USD
(XLV::L) Can't open 1@82.14 at 04:00:01

Top
#468984 - 11/01/17 03:35 Re: Dual Momentum Algorithm - The way Zorro would have done it [Re: Nanitek]
firecrest Offline
Newbie

Registered: 12/06/16
Posts: 45
I have the same problem previously too but it solved with the latest Zorro version 1.66.5. Not sure if your problem is the same.

Top
Page 2 of 4 < 1 2 3 4 >



Gamestudio download | chip programmers | Zorro platform | shop | resources | magazine | manual | support faq | bugs

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) 3dgamestudio.net