Dukascopy
 
 
Wiki JStore Search Login

FIXED: JFOREX-1197: JF1.8.1 Start in Tester shifted by 1 day
 Post subject: FIXED: JFOREX-1197: JF1.8.1 Start in Tester shifted by 1 day Post rating: 0   New post Posted: Tue 29 Sep, 2009, 16:29 
User avatar

User rating: 3
Joined: Wed 18 May, 2011, 16:25
Posts: 331
Location: SwitzerlandSwitzerland
It seems the new version shifts the selected date range for a historical tester run by -1day.

Example:
Dates: from 2009.06.23 to 2009.07.04
starts processing with first tick at 2009.06.22 00:00:...
and stops at the end of 2009.07.03.


 
 Post subject: Re: JFOREX-1197: JF1.8.1 Start in Tester shifted by 1 day Post rating: 0   New post Posted: Wed 30 Sep, 2009, 10:25 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
The following strategy when run prints first and last ticks. When running from 2009.06.23 to 2009.07.04 it outputs
09:23:40 Last tick: 2009-07-03 21:00:00 020
09:23:07 First tick: 2009-06-23 00:00:00 351
Can you confirm that?

package jforex;

import java.util.*;
import java.text.*;

import com.dukascopy.api.*;

public class PrintFirstLastTick implements IStrategy {
   private IEngine engine;
   private IConsole console;
   private IHistory history;
   private IContext context;
   private IIndicators indicators;
   private IUserInterface userInterface;
   
    private ITick lastTick;
   
   public void onStart(IContext context) throws JFException {
      this.engine = context.getEngine();
      this.console = context.getConsole();
      this.history = context.getHistory();
      this.context = context;
      this.indicators = context.getIndicators();
      this.userInterface = context.getUserInterface();
   }

   public void onAccount(IAccount account) throws JFException {
   }

   public void onMessage(IMessage message) throws JFException {
   }

   public void onStop() throws JFException {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS");
        format.setTimeZone(TimeZone.getTimeZone("GMT"));
        console.getOut().println("Last tick: " + format.format(lastTick.getTime()));
   }

   public void onTick(Instrument instrument, ITick tick) throws JFException {
        if (lastTick == null) {
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS");
            format.setTimeZone(TimeZone.getTimeZone("GMT"));
            console.getOut().println("First tick: " + format.format(tick.getTime()));
        }
        lastTick = tick;
   }
   
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
    }
}


 
 Post subject: Re: JFOREX-1197: JF1.8.1 Start in Tester shifted by 1 day Post rating: 0   New post Posted: Wed 30 Sep, 2009, 13:23 
User avatar

User rating: 3
Joined: Wed 18 May, 2011, 16:25
Posts: 331
Location: SwitzerlandSwitzerland
when I run your code on USD/CHF with a selected date range 2009.06.23 to 2009.07.04, the output is:
12:20:51 Last tick: 2009-07-02 23:59:49 739
12:20:29 First tick: 2009-06-22 00:00:05 869


and a run on EUR/USD results in:
12:26:49 Last tick: 2009-07-02 23:59:57 737
12:26:25 First tick: 2009-06-22 00:00:02 030


==> both shifted by -1 day


 

Jump to:  

cron
  © 1998-2024 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