OptimalF factors for every step of WFO?

Posted By: AndrewAMD

OptimalF factors for every step of WFO? - 04/04/19 13:26

jcl,

In the future, can Zorro have a flag (i.e. "FACTORS_SEASONAL"), so that when Optimal F factors are generated, there will be a unique set of optimal F factors for every step of WFO?

The purpose is to adapt OptimalF factors to the ever-changing market conditions.
Posted By: jcl

Re: OptimalF factors for every step of WFO? - 04/04/19 14:06

Theoretically it's already possible with two training cycles, as described on the training page for parameters and rules. It should also work for factors. But probably no one did that before. Try it. If it does not work, let me know and I'll put it on the list.
Posted By: AndrewAMD

Re: OptimalF factors for every step of WFO? - 04/04/19 14:06

Originally Posted By: jcl
Theoretically it's already possible with two training cycles, as described on the training page for parameters and rules. It should also work for factors. But probably no one did that before. Try it.
OK, I'll look into this.
Posted By: Zheka

Re: OptimalF factors for every step of WFO? - 04/04/19 14:30

May I also suggest that 'Optimal_F' is made into a user-supplied function (with current implementation as the default)?
Posted By: AndrewAMD

Re: OptimalF factors for every step of WFO? - 04/16/19 15:05

jcl,

I believe TrainMode = ALLCYCLES is intended to do what I describe.

However, I think I found a bug... It generates the factors for each cycle, but it doesn't load in Test mode.

I will try to reproduce this and submit a bug report. (Unless you find it first.)

Thanks,
Andrew
Posted By: jcl

Re: OptimalF factors for every step of WFO? - 04/16/19 15:12

I believe you're right. No need for the bug report, I'll forward this to the developers.
Posted By: AndrewAMD

Re: OptimalF factors for every step of WFO? - 04/16/19 15:21

Thank you!
Posted By: MatPed

Re: OptimalF factors for every step of WFO? - 04/17/19 09:12

I have tested with the ALLCYCLES flag, a TS that was not trained accordingly and I did not received any warning message. Maybe it could be useful.
Ciao
Posted By: jcl

Re: OptimalF factors for every step of WFO? - 04/17/19 11:52

I have been informed that the ALLCYCLES factors work fine in Test mode. The last factor file had a wrong name, but this had no effect on the test which only used the other .fac files.

So I'm afraid we will then really need the script for finding out what the problem was.

For determining if factors are loaded in test mode or not, you can use this code:

Code:
if(Test && WFOBar == 1)
	printf("nCycle %i OptF %.2f Long %.2f Short %.2f",
		WFOCycle, OptimalF, OptimalFLong, OptimalFShort);

Posted By: AndrewAMD

Re: OptimalF factors for every step of WFO? - 04/17/19 12:39

I will see if I can reproduce the problem.
Posted By: AndrewAMD

Re: OptimalF factors for every step of WFO? - 04/18/19 13:17

I checked, and there was no bug. All of the Optimal F values came through.

So now that I know it's not a bug, I think I have a strategy problem!
* I have a trend/reversion system that I use to trade a portfolio of ~50 stocks.
* Apparently, Optimal F for every walk ruins the system!
* Whereas, simple OOS test with Optimal F works very well.
* And, one Optimal F value for all combined walks also works well.

Question: If ALLCYCLES is disabled, what exactly is Optimal F "peeking" at? Future walks, or is it actually peeking at test data too?
Posted By: jcl

Re: OptimalF factors for every step of WFO? - 04/18/19 13:28

It is peeking at the test data. Because OptimalF is taken from the complete test, the current walk affects the factors and is thus not completely out of sample. The effect is not large, but it is there.

OptimalF calculation needs as many trades as possible, that's why it's taken from the complete test by default.
Posted By: AndrewAMD

Re: OptimalF factors for every step of WFO? - 04/18/19 13:32

So if I wanted as much Optimal F data as possible without peeking, for example, I can train OOS with ALLCYCLES enabled, correct?
Posted By: jcl

Re: OptimalF factors for every step of WFO? - 04/18/19 13:55

I believe ALLCYCLES has only an effect with WFO. A possible solution would be to generate the factors with a sort of cross validation, from the previous and next cycles, but not from the current cycle. But this had to be implemented, I think it cannot be done by script.
Posted By: AndrewAMD

Re: OptimalF factors for every step of WFO? - 04/18/19 13:58

So for now, I need to manually set the dates with my script?

* If it is trainmode, dates are from A to B. Get factors.
* If it is testmode, dates are from B to C. Use factors.
Posted By: jcl

Re: OptimalF factors for every step of WFO? - 04/18/19 14:04

Yes, that could work.
Posted By: AndrewAMD

Re: OptimalF factors for every step of WFO? - 04/18/19 14:18

Thank you.
Posted By: AndrewAMD

Re: OptimalF factors for every step of WFO? - 04/25/19 19:27

Just to confirm, in ALLCYCLES mode, Zorro's OptimalF calculations never peeks at any test data, correct? As in, it only looks at the training data for a given walk, and not the test data for that walk?

For example, if I did an Anchored WFO ALLCYCLES test with two (2) cycles, the first cycle will effectively act as a simple OOS test, where optimal F is not peeking at test data, and the second cycle will prepare Optimal F for live trading by getting as much trading data as possible. Correct?
Posted By: jcl

Re: OptimalF factors for every step of WFO? - 04/26/19 06:49

Yes.
Posted By: AndrewAMD

Re: OptimalF factors for every step of WFO? - 04/26/19 13:43

Thanks, this simplifies my setup.
© 2024 lite-C Forums