Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
Deeplearning Script
by wolfi. 02/26/24 12:46
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/22/24 16:22
AssetAdd() vs. modern asset list?
by jcl. 02/21/24 15:01
How many still using A8
by Aku_Aku. 02/20/24 12:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 521 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Ahead bias when retrain #472774
05/22/18 11:10
05/22/18 11:10
Joined: Oct 2017
Posts: 17
J
JRA Offline OP
Newbie
JRA  Offline OP
Newbie
J

Joined: Oct 2017
Posts: 17
I have a question: If the average trade duration is 5 bars (example) and Zorro retrain on every bar, can the WFO be "overlapped"? Is there possible the "ahead bias"?

For example:

NumWFOCycles = 5 * DataSplit/(100-DataSplit); // And the trade runs 6 days.

Thanks.

Re: Ahead bias when retrain [Re: JRA] #472776
05/22/18 12:18
05/22/18 12:18
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Yes, it is possible. You must set DataHorizon when WFO cycles can overlap.

Re: Ahead bias when retrain [Re: jcl] #472779
05/22/18 18:28
05/22/18 18:28
Joined: Oct 2017
Posts: 17
J
JRA Offline OP
Newbie
JRA  Offline OP
Newbie
J

Joined: Oct 2017
Posts: 17
Sorry but I can not find a practical example of DataHorizon.
When the DataHorizon is set correctly for me (Train sample bars long) I donīt get trades.
Can you writte a little example please?

Thank you very much.


Re: Ahead bias when retrain [Re: JRA] #472784
05/23/18 08:32
05/23/18 08:32
Joined: Oct 2017
Posts: 17
J
JRA Offline OP
Newbie
JRA  Offline OP
Newbie
J

Joined: Oct 2017
Posts: 17
All the examples on Zorro ML examples than I found (Financial Hacker or Robot Wealth) uses:

WFOPeriod = 252*24; // 1 year

But without set the asset before.
I run two "train and test" on the same algo, first setting the asset on the slider and the second on the script, the results are very differents


This explains why when set the DataHorizon correctly I get no trades.
Are the "succesfull" examples peeking on the future?

Attached Files L_X_ES_30.pngL_X_ES_30(Ticker).png
Last edited by JRA; 05/23/18 08:33.
Re: Ahead bias when retrain [Re: JRA] #472789
05/23/18 14:21
05/23/18 14:21
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
If your profit goes down when you set DataHorizon, then you have indeed been peeking into the future. But if your script does not trade at all, then debug it and find the reason, for instance a wrong trade logic or a mistake on cycle setup.

Re: Ahead bias when retrain [Re: jcl] #472793
05/23/18 16:28
05/23/18 16:28
Joined: Oct 2017
Posts: 17
J
JRA Offline OP
Newbie
JRA  Offline OP
Newbie
J

Joined: Oct 2017
Posts: 17
Originally Posted By: jcl
If your profit goes down when you set DataHorizon, then you have indeed been peeking into the future. But if your script does not trade at all, then debug it and find the reason, for instance a wrong trade logic or a mistake on cycle setup.


StartDate = 20000101;
BarPeriod = 1440; // 1 day
LookBack = 100;

WFOPeriod = 252; // 1 year
DataSplit = 90;
DataHorizon = 25; // the 10% of WFO, also the test period

Itīs correct? The rest of the script donīt matters, mine or yours.

Re: Ahead bias when retrain [Re: JRA] #472804
05/24/18 10:27
05/24/18 10:27
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
No, it is not correct. Look here: http://manual.zorro-project.com/dataslope.htm

I do not know your data horizon, but it is certainly not 25.

Re: Ahead bias when retrain [Re: jcl] #472821
05/25/18 08:05
05/25/18 08:05
Joined: Oct 2017
Posts: 17
J
JRA Offline OP
Newbie
JRA  Offline OP
Newbie
J

Joined: Oct 2017
Posts: 17
Sorry JCL but here are a very important question without answer:

When everyone uses the "WFOPeriod" without setting the asset before the script, is peeking ahead.
This happens with all scripts I can found, not only mines.
This question is explained in the manual "need to set the asset before", but it opens the door to: are the OOS test a full Out of sample?

I think is not possible to train all the data sample without know the test periods from start to end, almost without timestamps to know if a test period has been crossed the "trained zone".

My script donīt use future bars explicitly, dontīt have the PEEK flag, the only future leak comes from the train.

Thanks.


PD: If the WFO is correct Iīm rich before Christmas.




Re: Ahead bias when retrain [Re: JRA] #472823
05/25/18 08:46
05/25/18 08:46
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
Peeking ahead means you use future information for trading. Then your result is worthless no matter how you set the asset before the script! laugh So, hope of getting rich may be wrong...

Re: Ahead bias when retrain [Re: Spirit] #472824
05/25/18 08:54
05/25/18 08:54
Joined: Oct 2017
Posts: 17
J
JRA Offline OP
Newbie
JRA  Offline OP
Newbie
J

Joined: Oct 2017
Posts: 17
Originally Posted By: Spirit
Peeking ahead means you use future information for trading. You cannot fix it by setting the asset before the script! laugh


Yes, you can, because when Zorro knows the asset can split correctly the cycles.
You can see the images attached up, the only change is the asset set.

And more: if you train the algo without setting the asset on the script , and set it before test, you donīt get trades, because test period OOS do not exists.

From the manual:

// calculate NumWFOCycles from the test period in days
// DataSplit and LookBack must be set before
function setWFO2(int daysTest)
{
asset(Asset); // requires NumBars, so asset must be set
int barsTest = daysTest * 1440/BarPeriod;

Page 1 of 2 1 2

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1