Dukascopy Support Board
http://www.dukascopy.com/swiss/english/forex/jforex/forum/

FIXED: JFOREX-1197: JF1.8.1 Start in Tester shifted by 1 day
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=85&t=1100
Page 1 of 1

Author:  RoadRunner [ Tue 29 Sep, 2009, 16:29 ]
Post subject:  FIXED: JFOREX-1197: JF1.8.1 Start in Tester shifted by 1 day

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.

Author:  API Support [ Wed 30 Sep, 2009, 10:25 ]
Post subject:  Re: JFOREX-1197: JF1.8.1 Start in Tester shifted by 1 day

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 {
    }
}

Author:  RoadRunner [ Wed 30 Sep, 2009, 13:23 ]
Post subject:  Re: JFOREX-1197: JF1.8.1 Start in Tester shifted by 1 day

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

  Page 1 of 1