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
2 registered members (AndrewAMD, Imhotep), 567 guests, and 4 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
A most bizarre issue #453495
07/29/15 08:51
07/29/15 08:51
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline OP
Senior Member
boatman  Offline OP
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
I've come across a very perplexing problem and am hoping to get some advice.

I've been building a system that trades one asset, but takes its signals from other assets. Backtest results were OK and I've started a live forward test. Also going OK.

Today, I updated the price history I use in my simulations. I do this by taking the data from www.histdata.com and processing it with the script on the Data Import/Export page in the manual. Code reproduced below.

I've been doing this process regularly (about every other month) and consistently (ie, following the same process every time). The process involves updating the current year's price history by adding the new source data from histdata.com and then creating a new .bar file for the current year to replace the existing one. I archive the existing one so that I can refer to it later if any issues arise. Good thing I did.

Where the old and new 2015 .bar file overlapped, my strategy gives COMPLETELY different results if I run it on the new .bar file or the old .bar file. I then went back to my 2014 source data and created new .bar files and tested these. Same deal - completely different performance.

Visual inspection of the two price histories doesn't reveal any obvious differences. But I will test this in more detail.

The only difference that I can think of is that the new .bar file was created with the latest version of Zorro (v1.32) whilst the old files were created with earlier versions.

The only line of thinking that seems plausible is that this has something to do with the way in which Zorro now handles ticks in version 1.32. However, the strategy has a Bar Period of 60 minutes, so I don't think these changes should affect things.

The strategy doesn't use any TMF or tick() function. It simply buys and sells one asset based on the price change in a number of other assets.

Any help greatly appreciated, as this has really got me stumped! What could be causing such drastic differences when the only thing that has changed is the Zorro version that created the .bar files?

Code:
// import a historic data file from .csv

string InName = "Data\\DAT_ASCII_EURUSD_M1_2013.csv";  // name of the CSV file
string OutName = "History\\EURUSD_2010x.bar";

string readTick(string content,TICK* tick)
{
// tokenize a single line  
  char* line = strtok(content,"\n");
  if(!line) return 0;
  
// read "20100103 170000;1.430100;1.430400;1.430100;1.430400;0"
  int Year, Month, Day, Hour, Minute, Second; 
  if(10 != sscanf(line,"%4d%2d%2d %2d%2d%2d;%f;%f;%f;%f;",
    &Year, &Month, &Day, &Hour, &Minute, &Second,
    &tick->fOpen, &tick->fHigh, &tick->fLow, &tick->fClose)) 
    return 0;
    
// store the time in DATE format (ConvertTime is defined in Convert.c)
// make sure that the time is UTC time!!
  tick->time = ConvertTime(Year,Month,Day,Hour,Minute,Second);

// return pointer to next line
  return line+strlen(line)+1;
}

function main()
{
  if(!file_length(InName))
    quit("Data file not found!");
    
// allocate TICK array    
  int maxticks = 60*24*365; // 1 year
  TICK* ticks = malloc(maxticks*sizeof(TICK)),
    tick = ticks+maxticks; 

// read ticks in reverse order  
  string content = file_content(InName);
  while(content) 
    content = readTick(content,--tick);

// store the ticks
  int size = (int)(ticks+maxticks)-(int)(tick+1);
  file_write(OutName,tick+1,size);
  free(ticks);

  printf("\nRead %d ticks",size/sizeof(TICK));
}


Re: A most bizarre issue [Re: boatman] #453500
07/29/15 14:08
07/29/15 14:08
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline OP
Senior Member
boatman  Offline OP
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
Update:

I have tested the system on the new .bar file over the same period as the live forward test. Results are very different. Attached are the simulated and actual equity curves. Note that the simulated equity curve used what was a slightly generous spread for the sake of being conservative. The actual equity curve was constructed from the trades.csv log (I had to present the actual results this way as there are a couple of algorithms trading on this account, and there is no way to distinguish them using myfxbook or similar).

You can see that the peaks and troughs line up in the first half of the curve, but the levels do not match and they diverge in the second half of the curve.

So it would seem that the problem lies with the data created using the new version of Zorro. Next, I am going to re-install an old version of Zorro and create the 2015 .bar files using that version and then retest.

Attached Files simulated results.pngactual_results.png
Re: A most bizarre issue [Re: boatman] #453516
07/30/15 08:09
07/30/15 08:09
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
The problem must have a different reason. The .bar file format is documented in the manual, so it can not have changed, otherwise no exporters or importers would work anymore.

Re: A most bizarre issue [Re: jcl] #453522
07/30/15 14:35
07/30/15 14:35
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline OP
Senior Member
boatman  Offline OP
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
Thanks for the response jcl. I found that my EURUSD and USDJPY price history was shifted by 5 hours in relation to all other assets. Since my strategy depended the movement of other assets, performance was significantly affected since I was able to look into the future during the backtest. I can't explain how this happened since I use the same process each time I update my history and it only occurred with two of many assets. In order to fix it, I didn't have to do anything differently either. I simply created the price history again using the same procedure. Very strange. I don't expect you to know what's going on here, but if you have any insights at all, I'd appreciate hearing them.

Re: A most bizarre issue [Re: boatman] #453532
07/31/15 09:26
07/31/15 09:26
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Is this the history that you've taken from Histdata.com? The FXCM history is based on UTC, but this is not guaranteed for histories from other websites that might be based on Eastern time or some local time. In that case you need to convert the time, also considering the daylight saving hour.

Re: A most bizarre issue [Re: jcl] #453535
07/31/15 09:33
07/31/15 09:33
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline OP
Senior Member
boatman  Offline OP
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
Timely comment, JCL! I worked that out this afternoon and posted a question in the Brokers forum about batch processing data in such a way.

I'm wondering if the guys at www.histdata.com recently shifted all their data align with EST, when it was previously not consistently aligned. This would explain why some of my data was aligned inconsistently with other data, and why now the most recent data is correctly aligned. I've emailed the site owner about that and will post any response here.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1