Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Time differences between GUI tester and ITesterClient
 Post subject: Time differences between GUI tester and ITesterClient Post rating: 0   Post Posted: Fri 03 Sep, 2010, 05:35 

User rating: 0
Joined: Fri 07 May, 2010, 02:59
Posts: 61
I made an error in judgement while developing a strategy in that I didn't periodically compare in the GUI and my command-line back testing interface. Consequently, I was encountering significant differences (ironically enough, the GUI always seemed to produce significantly better profits but I think it was a coincidence -- you'll see why) between the two.

Throughout my development, I strove to ensure everything worked off UTC so I didn't introduce any bias from my own timezone -- that way, whether I ran my client from Japan, the US, or Europe it would always produce the same results.

What I found is the GUI client retrieves data relative to your current timezone (and I didn't see a way to specify a time in the GUI tester, so no workaround for that). When I specified a time to start (in the CLI client), it was always just before London session open, and the GUI tester (in my timezone at least) always seems to begin supplying data right at the beginning of London open. Consequently, my CLI client was starting 20 minutes earlier.

Anyway, I hope this helps someone else.

-Brian


 
 Post subject: Re: Time differences between GUI tester and ITesterClient Post rating: 0   Post Posted: Tue 07 Sep, 2010, 12:58 

User rating: 0
Joined: Tue 10 Nov, 2009, 16:58
Posts: 65
that is really strange, for me the JForex always shows the current time/date (top right of the main window) as GMT time. You mean that is not always the case ?

I am personally at GMT+2, and never noticed a difference in tester results between GUI and JForexClient. I do specify all start/stop times with a java.util.Calendar initialized to GMT in my command-line tester.


 
 Post subject: Re: Time differences between GUI tester and ITesterClient Post rating: 0   Post Posted: Tue 07 Sep, 2010, 15:49 

User rating: 0
Joined: Fri 07 May, 2010, 02:59
Posts: 61
I could be wrong on the timezone thing, but a day definitely doesn't start at midnight UTC. It's either relative to your timezone, or they start a day at the beginning of London session open. I realized that could be the case last night, but I haven't had time to test that idea yet.

-Brian


 
 Post subject: Re: Time differences between GUI tester and ITesterClient Post rating: 0   Post Posted: Thu 09 Sep, 2010, 08:00 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
if you are using a Calendar or DateFormat, please don't forget to set proper timezone.


 
 Post subject: Re: Time differences between GUI tester and ITesterClient Post rating: 0   Post Posted: Thu 09 Sep, 2010, 17:40 

User rating: 0
Joined: Fri 07 May, 2010, 02:59
Posts: 61
I'm setting the timezone to UTC in my code, but the GUI client doesn't have any means of choosing what the cut-off time is for a daily bar. I think the cutoff is london session open, or 6am UTC; I'm not sure which.

-Brian


 
 Post subject: Re: Time differences between GUI tester and ITesterClient Post rating: 0   Post Posted: Fri 10 Sep, 2010, 14:55 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
All daily bars start at midnight GMT, but forex is closed at 21:00 - 22:00 GMT Friday and opened at 21:00 - 22:00 GMT Sunday. Daily candles on Friday and Synday are shorter


 
 Post subject: Re: Time differences between GUI tester and ITesterClient Post rating: 0   Post Posted: Fri 10 Sep, 2010, 19:15 

User rating: 0
Joined: Fri 07 May, 2010, 02:59
Posts: 61
Hm. I used something on par with the following code to print out the time:

GregorianCalendar currentDate = new GregorianCalendar();
SimpleDateFormat dateFormatter = new SimpleDateFormat( "MM/dd/yyyy HH:mm z" );

currentDate.setTimeZone( TimeZone.getTimeZone( "UTC" ) );
dateFormatter.setTimeZone( currentDate.getTimeZone() );

(...)

onBar( ..., IBar bidBar, IBar askBar ) {
  if ( period is hourly ) {
    currentDate.setTimeInMillis( bidBar.getTime() );
    System.out.format( "Current bar time is: %s\n", dateFormatter.format( currentDate.getTime() ) );
  }
}


The time it displayed, in UTC, was around 6am (in that case, it was running during the winter). If daily bars are cutoff at midnight GMT, at most it should be off by an hour during DST.

Tonight or sometime this weekend I'll run another test. It's entirely possible I made a gross mistake in what I actually wrote. I'll also tweak it to both use onbar() and get a daily bar from IHistory. I'll post the results here when I have them.

-Brian


 
 Post subject: Re: Time differences between GUI tester and ITesterClient Post rating: 0   Post Posted: Tue 14 Sep, 2010, 08:38 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Quote:
if ( period is hourly ) {

Are we talking about daily or hourly bars? For hourly bars it's absolutely normal to start at 6am
Quote:
currentDate.setTimeInMillis( bidBar.getTime() );

There is no need in this code. Time represented in long format is always in GMT timezone. You could write this with the same effect:
System.out.format( "Current bar time is: %s\n", dateFormatter.format(bidBar.getTime()));


 
 Post subject: Re: Time differences between GUI tester and ITesterClient Post rating: 0   Post Posted: Tue 14 Sep, 2010, 23:15 

User rating: 0
Joined: Fri 07 May, 2010, 02:59
Posts: 61
It's daily, that was my mistake.

As for the other thing, I was distilling more elaborate code and hadn't made that leap. I'll post something when I have time to run the test.

-Brian


 
 Post subject: Re: Time differences between GUI tester and ITesterClient Post rating: 0   Post Posted: Thu 16 Sep, 2010, 06:00 

User rating: 0
Joined: Fri 07 May, 2010, 02:59
Posts: 61
It looks like I did make a mistake; it was printing out in my timezone, so at midnight UTC it was printing 6am and I didn't question it because it seemed reasonable to be ending a daily bar just before London session open so it didn't seem odd at the time.

-Brian


 

Jump to:  

cron
  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com