Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, monk12, TipmyPip, Quad, aliswee), 1,031 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
Detrend=SHUFFLE? #475515
12/18/18 07:39
12/18/18 07:39
Joined: Nov 2018
Posts: 55
G
gamadeus Offline OP
Junior Member
gamadeus  Offline OP
Junior Member
G

Joined: Nov 2018
Posts: 55
Hello,

I am educating myself how to use Zorro in the Robotwealth course and recently stumbled over a neat illustration of the Detrend = SUFFLE parameter.

In this course the authors conclude:
"If the StartDate and EndDate of your simulation don’t use all available price data, then the shuffled price curves will have different statistical properties to the data used in your backtest because they start at a different price level, but all finish at the same level."

They then go on to illustrate that you only get the same start and endpoint of your shuffled price curve, if you include all of the available data.

However, I have been unable to reproduce this behavior myself, no matter how much data I use there are alsways curves that start and/or end differently. So my question is whether the SHUFFLE functionality has been altered in later versions and if it is possible to shuffle the data while maintaining its statistical properties, like mean, sd, trend etc.?

Re: Detrend=SHUFFLE? [Re: gamadeus] #475520
12/18/18 08:48
12/18/18 08:48
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
No, shuffled curves should still start and end all at the same points. You can check that by printing the prices at the start and at the end of the historical data.

Re: Detrend=SHUFFLE? [Re: jcl] #475525
12/18/18 16:50
12/18/18 16:50
Joined: Nov 2018
Posts: 55
G
gamadeus Offline OP
Junior Member
gamadeus  Offline OP
Junior Member
G

Joined: Nov 2018
Posts: 55
Ok then can you please explain why I get price curves with offset start/end values when I run a script like this over my entire data?

function run()
{
set(PLOTNOW);
StartDate = 20150101;
EndDate = 20161231;
BarPeriod = 1440;

NumTotalCycles = 50;
Detrend = SHUFFLE;

PlotWidth = 600;
PlotHeight1 = 300;
ColorUp = ColorDn = 0;
plot(strf("#Cycle_%d", TotalCycle), priceClose(), MAIN, color(100*TotalCycle/NumTotalCycles, BLUE, RED, GREEN));
}

see also the attached output. The values are relatively close, but it was my understanding that they should start/end at exactly the same value.

Attached Files test_EURUSD.png
Re: Detrend=SHUFFLE? [Re: gamadeus] #475526
12/18/18 17:13
12/18/18 17:13
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
Your chart does not match start and end date and does not show the lookback period.

Re: Detrend=SHUFFLE? [Re: Spirit] #475529
12/18/18 20:43
12/18/18 20:43
Joined: Nov 2018
Posts: 55
G
gamadeus Offline OP
Junior Member
gamadeus  Offline OP
Junior Member
G

Joined: Nov 2018
Posts: 55
ups sorry, I copied the code in and changed the start and end date afterwards, my bad.
of course I included the entire historical data set I have in my history folder, by setting startdate to 20020101 and no enddate.

Edit: Thanks for the hint with the Lookback, though. Setting it to 0 makes the starting point equal, but the enddates still diverge slightly.

See script and output below:

function run()
{
set(PLOTNOW);
StartDate = 20020101;
BarPeriod = 1440;
LookBack = 0;

NumTotalCycles = 5;
Detrend = SHUFFLE;

PlotWidth = 1200;
PlotHeight1 = 600;
ColorUp = ColorDn = 0;
plot(strf("#Cycle_%d", TotalCycle), priceClose(), MAIN, color(100*TotalCycle/NumTotalCycles, BLUE, RED, GREEN));
}

Attached Files test_EURUSD.png
Last edited by gamadeus; 12/18/18 22:10.
Re: Detrend=SHUFFLE? [Re: gamadeus] #475533
12/19/18 13:33
12/19/18 13:33
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
You're right. I see in my notes that the LEAN flag must be set for Detrend=SHUFFLE. That info didn't make it into the manual. The reason is probably that without LEAN, open and close prices are stored in the ticks and affect the shuffling.

This will be either added to the manual or worked around so that the LEAN flag is not needed anymore.


Re: Detrend=SHUFFLE? [Re: jcl] #475534
12/19/18 16:25
12/19/18 16:25
Joined: Nov 2018
Posts: 55
G
gamadeus Offline OP
Junior Member
gamadeus  Offline OP
Junior Member
G

Joined: Nov 2018
Posts: 55
Ah yes, now it works like it should, thanks a lot jcl!


Moderated by  Petra 

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