Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (kzhao, AndrewAMD, bigsmack), 824 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
Trying to identify best time to re-Train #436936
02/05/14 21:55
02/05/14 21:55
Joined: Jul 2013
Posts: 522
D
dusktrader Offline OP
User
dusktrader  Offline OP
User
D

Joined: Jul 2013
Posts: 522
I'm trying to identify the proper time that a live trading strategy should be re-Train'd, so that it continues in the same way that it was Train'd during simulation. Can you please confirm that I am doing this correctly:

My strategy uses the following:
Code:
StartDate = 20080101;
EndDate = 20140122;
DataSplit = 70;
NumWFOCycles = 11;



Here is what the Performance report says:
Code:
Simulation period   04.01.2008-22.01.2014
Test period         26.02.2009-22.01.2014
WFO test cycles     10 x 5947 bars (25 weeks)
Training cycles     11 x 13876 bars (59 weeks)



My understanding is that Zorro performs 11 WFO cycles, but saves the last cycle to be used for the current trading period (such as live trading).

Since I use DataSplit 70, it means that 30% of the history data during simulation was used for the out-of-sample testing. Therefore, for trading a bot that begins at exactly the time period ending after the EndDate, I believe I would be looking for a time period of 30% of 1/11th of the total span of time used.

If I ask Wolfram Alpha for the time span from 04.01.2008-22.01.2014, it tells me that it is 2210 days.

So 2210 days / 11 cycles = 201 days per cycle. 30% of that is 60 days. Therefore, my thinking is that this particular bot should be re-Train'd every ~60 days, to stay consistent with the Train regimen that was used during simulation.

Can you please verify I have calculated this correctly? Is there a better way to handle re-Train operations?
Thank you

Re: Trying to identify best time to re-Train [Re: dusktrader] #436941
02/05/14 23:30
02/05/14 23:30
Joined: Nov 2013
Posts: 123
Mithrandir77 Offline
Member
Mithrandir77  Offline
Member

Joined: Nov 2013
Posts: 123
It seems reasonable to me.

However, what I have understood is that retraining should be done when the strategy start to differ too much from the expected behaviour. For instance, when you detect real trading results differ too much from the OOS test you could switch to equity curve trading (phantom mode), retrain the strategy and still in phantom mode see if the equity curve or other parameters start to resemble the previous ones. If they do, it was a problem of under-optimized parameters. If not, the strategy probably is outdated or need to be reengineered.

In my opinion, retraining as time goes by seems reasonable because market conditions vary and parameters should be optimized but on the other hand I am afraid of it because I have the feeling that it can overfit parameters if such a thing is possible to exist.

I would appreciate if anyone can correct any of my statements (or feelings wink ) that are wrong.

Last edited by Mithrandir77; 02/05/14 23:33.
Re: Trying to identify best time to re-Train [Re: Mithrandir77] #436960
02/06/14 15:36
02/06/14 15:36
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
It is normally hard to tell at once if a strategy begins to differ - the time to find that out is often longer than the retraining interval.

In your example, you must retrain every 25 weeks, as this is the length of a test cycle. It should be the time span 26.02.2009-22.01.2014 divided by 10. Your calculation was wrong because the cycles overlap.

Re: Trying to identify best time to re-Train [Re: jcl] #436977
02/06/14 21:04
02/06/14 21:04
Joined: Nov 2013
Posts: 123
Mithrandir77 Offline
Member
Mithrandir77  Offline
Member

Joined: Nov 2013
Posts: 123
In the Zorro manual, System variables/NumWFOCycles it says that any strategy should be retrained every 2..3 months:

Quote:
When trading a walk-forward optimized strategy, re-train the last cycle perodically for making the strategy independent on parameter settings. For this, set SelectWFO and UpdateDays both to -1 and EndDate to 0 for updating the price data up to the current date. Every 2..3 months, click [Train]. A second Zorro instance will start, download the price data from the server and generate a new parameter, factor, and rule set. The trading Zorro instance will continue trading with the updated files.


Is this a rule of thumb that applies to any strategy?

Re: Trying to identify best time to re-Train [Re: jcl] #436995
02/07/14 11:56
02/07/14 11:56
Joined: Jul 2013
Posts: 522
D
dusktrader Offline OP
User
dusktrader  Offline OP
User
D

Joined: Jul 2013
Posts: 522
Originally Posted By: jcl
In your example, you must retrain every 25 weeks, as this is the length of a test cycle. It should be the time span 26.02.2009-22.01.2014 divided by 10. Your calculation was wrong because the cycles overlap.


Thank you! I think I'm finally grasping this. And I see that you're already providing the reTrain period on the Perf Report (25 weeks) so I really don't need to calculate anything it seems.

So according to Wolfram Alpha, the (test) period from 26.02.2009-22.01.2014 is a time span of:
1791 days
or 1279 weekdays

1791 days / 10 cycles = 179 days / 7day-wk = 25 weeks
1279 weekdays / 10 cycles = 128 days / 5day-wk = 25 weeks

Therefore, my understanding is that, in order to maintain parameter re-optimization on the same schedule as that used in the WFO simulation, that I would want to reTrain the strategy 25 weeks after the latest test date 22.01.2014

That brings up a few followup questions I'd love to hear your thoughts on:
1) if the human reTrains earlier than the 25 weeks, do you believe there could be a negative or different impact? I do believe their could be, for the same reason that 11 WFO cycles may not produce the same results as 12 WFO cycles, for example. I've found in testing that there is a performance "sweet spot" depending on how often a logic's parameters are re-optimized;

2) I think we briefly discussed this before... but is it advisable to simply hardcode an automated reTrain to occur in the strategy logic? For example, if the simulation EndDate is 22.01.2014, then it could be programmatically scripted to initiate a reTrain at every subsequent 25-week interval. Is there any reason this should not be done? The reason I would want to do this is not because I would leave the bot running unattended for long periods... but more likely because I would fail as a human in remembering the bot's required reTrain schedule.

THANKS

Re: Trying to identify best time to re-Train [Re: dusktrader] #437494
02/18/14 14:11
02/18/14 14:11
Joined: Jul 2013
Posts: 522
D
dusktrader Offline OP
User
dusktrader  Offline OP
User
D

Joined: Jul 2013
Posts: 522
@jcl, is there any way to access the figures shown on the Performance Report while in TRADEMODE?

For example, I would like to be able to print a message in the log when the current date exceeds the time period of the EndDate (from testing) + the Test Cycle weeks (ie, time to reTrain)

I'm guessing probably not, because the WFO Test results are probably not available during TRADEMODE. In that case, I could hardcode a date to check in the script itself.

Re: Trying to identify best time to re-Train [Re: dusktrader] #437500
02/18/14 15:50
02/18/14 15:50
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Hard coding is the easiest way, but you could also calculate the time period from the number of WFO cycles, the DataSplit fraction, and the start date.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1