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

help getbar is exception!!!
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=16&t=56774
Page 1 of 1

Author:  grosskt [ Fri 19 Oct, 2018, 06:03 ]
Post subject:  help getbar is exception!!!

com.dukascopy.api.JFException: Could not load bar for instrument [USD/JPY], period [30 Mins], side [Ask], start time [2018.10.19 07:30:00 000],
current bar start time [2018.10.19 08:00:00 000]


at com.dukascopy.api.impl.n.a(L:295)
at com.dukascopy.api.impl.n.getBar(L:255)
at COM.Mystrategies.StrategyTest.getbar_test(StrategyTest.java:77)
at COM.Mystrategies.StrategyTest.onBar(StrategyTest.java:70)
at com.dukascopy.api.impl.execution.m.cy(L:85)
at com.dukascopy.api.impl.execution.m.call(L:63)
at com.dukascopy.api.impl.execution.m.call(L:23)
at java.util.concurrent.FutureTask.run(Unknown Source)
at com.dukascopy.api.impl.execution.f$a.e(L:904)
at com.dukascopy.api.impl.execution.f$a.run(L:926)
at java.lang.Thread.run(Unknown Source)

package jforex;

import java.util.*;

import com.dukascopy.api.*;
import java.text.SimpleDateFormat;

public class StrategyTest implements IStrategy {
     @Configurable("Instrument")
    public Instrument Curinstrument = Instrument.USDJPY;
        @Configurable("Amount")
    public double NewOrderAmount = 0.061;
       
    private IEngine engine;
    private IConsole console;
    private IHistory history;
    private IContext context;
    private IIndicators indicators;
    private IUserInterface userInterface;
    private final SimpleDateFormat gmtSdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    public double DailyHighPrice,DailyLowPrice,newDailyHighPrice,newDailyLowPrice;
     public long LpriceCreateTime,HpriceCreateTime;
    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();
         Set<Instrument> instruments = new HashSet<Instrument>();

        instruments.add(Curinstrument);
        context.setSubscribedInstruments(instruments, true);
    }

    @Override
    public void onAccount(IAccount account) throws JFException
    {
       
    }

    @Override
    public void onMessage(IMessage message) throws JFException
    {
       
    }

    @Override
    public void onStop() throws JFException {
    }

    @Override
    public void onTick(Instrument instrument, ITick tick) throws JFException {
    }
   
    @Override
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
         if (!instrument.equals(this.Curinstrument)) {
            return;

        }
         if (period.equals(Period.ONE_MIN))
        {
         
           getbar_test();
        }
    }
   
    public void getbar_test() throws JFException
    {
        IBar curThirtBar = history.getBar(Curinstrument, Period.THIRTY_MINS, OfferSide.ASK, 0);
        IBar preThirtBar = history.getBar(Curinstrument, Period.THIRTY_MINS, OfferSide.ASK, 1);
       
        print(String.format("pre bar time=%s  cur bar time=%s\n",gmtSdf.format(preThirtBar.getTime()),gmtSdf.format(curThirtBar .getTime())));
    }
       private void print(Object o)
       {
        console.getOut().println(o);
      }

Author:  ASLOG2002 [ Sat 20 Oct, 2018, 12:27 ]
Post subject:  Re: help getbar is exception!!!

Hi support!
the same problem JFException !!!!
   int szVolume = 5;
   double[] volume = new double[szVolume];

   public void initVolume() throws JFException {

      for (int i = 0; i < szVolume; i++) {
         volume[i] = 0;
         Err("i=" + i +" " );
         try {
            volume[i] = ((IBar) context.getHistory().getFeedData(feedDescriptor, i)).getVolume();
         } catch (JFException e) {

            Err( e.getMessage());
            e.printStackTrace();
         }

      }
   }

11:13:52 Could not load bar for instrument [GBP/USD], period [1 Min], side [Bid], start time [2018.10.20 23:56:00 000], current bar start time [2018.10.21 00:00:00 000]
11:13:52 i=4
11:13:52 Could not load bar for instrument [GBP/USD], period [1 Min], side [Bid], start time [2018.10.20 23:57:00 000], current bar start time [2018.10.21 00:00:00 000]
11:13:52 i=3
11:13:52 Could not load bar for instrument [GBP/USD], period [1 Min], side [Bid], start time [2018.10.20 23:58:00 000], current bar start time [2018.10.21 00:00:00 000]
11:13:52 i=2
11:13:52 Could not load bar for instrument [GBP/USD], period [1 Min], side [Bid], start time [2018.10.20 23:59:00 000], current bar start time [2018.10.21 00:00:00 000]
11:13:52 i=1
11:13:52 i=0
The current version JForex API is 2.13.60. In the previous version, the code above worked fine.

Author:  API Support [ Tue 23 Oct, 2018, 10:36 ]
Post subject:  Re: help getbar is exception!!!

Problem detected, will be fixed in next release.

Author:  ASLOG2002 [ Tue 23 Oct, 2018, 16:28 ]
Post subject:  Re: help getbar is exception!!!

Hi support! You must provide the ability to return to the previous version! You cause damage by your actions!

Author:  flashroyal [ Wed 24 Oct, 2018, 21:35 ]
Post subject:  Re: help getbar is exception!!!

JForex ver.3.4.6
JForex API ver.2.13.60

19:47:01 com.dukascopy.api.JFException: Could not load bar for instrument [EUR/USD], period [4 Hours], side [Ask], start time [2018.10.24 20:00:00 000], current bar start time [2018.10.25 00:00:00 000] @ Bot1M_082018CE.ACSignal(Bot1M_082018CE.java:505)
private int ACSignal(Period _ACTimeFrame,int _AC)throws JFException{
 int rezult=0;
 int  ACFastPeiod=5 ,ACSlowPeiod=34;
 
IBar prevBar = history.getBar(instr, _ACTimeFrame, OfferSide.ASK, 1);
 ....................


All my strategy stoped by this bug! Above example from one of them.

ASLOG2002 wrote:
Hi support! You must provide the ability to return to the previous version! You cause damage by your actions!

Yes, is true!

Author:  JFR [ Mon 29 Oct, 2018, 14:28 ]
Post subject:  Re: help getbar is exception!!!

Every few minutes since I updated I get the following errors and my strategy crashes - PLEASE FIX URGENTLY

12:58:00 [ERROR] Could not load bar for instrument [USD/JPY], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:58:00 [ERROR] Could not load bar for instrument [USD/JPY], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:58:00 [ERROR] Could not load bar for instrument [GBP/JPY], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:58:00 [ERROR] Could not load bar for instrument [GBP/JPY], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:58:00 [ERROR] Could not load bar for instrument [GBP/USD], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:58:00 [ERROR] Could not load bar for instrument [GBP/USD], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:58:00 [ERROR] Could not load bar for instrument [EUR/USD], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:58:00 [ERROR] Could not load bar for instrument [EUR/USD], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:57:01 [ERROR] Could not load bar for instrument [USD/JPY], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:57:01 [ERROR] Could not load bar for instrument [USD/JPY], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:57:01 [ERROR] Could not load bar for instrument [GBP/JPY], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:57:01 [ERROR] Could not load bar for instrument [GBP/JPY], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:57:00 [ERROR] Could not load bar for instrument [GBP/USD], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:57:00 [ERROR] Could not load bar for instrument [GBP/USD], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:57:00 [ERROR] Could not load bar for instrument [EUR/USD], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:57:00 [ERROR] Could not load bar for instrument [EUR/USD], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:56:00 [ERROR] Could not load bar for instrument [EUR/USD], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:56:00 [ERROR] Could not load bar for instrument [EUR/USD], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:56:00 [ERROR] Could not load bar for instrument [USD/JPY], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:56:00 [ERROR] Could not load bar for instrument [USD/JPY], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:56:00 [ERROR] Could not load bar for instrument [GBP/JPY], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:56:00 [ERROR] Could not load bar for instrument [GBP/JPY], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:56:00 [ERROR] Could not load bar for instrument [GBP/USD], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:56:00 [ERROR] Could not load bar for instrument [GBP/USD], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:55:00 [ERROR] Could not load bar for instrument [GBP/USD], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:55:00 [ERROR] Could not load bar for instrument [GBP/USD], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:55:00 [ERROR] Could not load bar for instrument [GBP/JPY], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:55:00 [ERROR] Could not load bar for instrument [GBP/JPY], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:55:00 [ERROR] Could not load bar for instrument [EUR/USD], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:55:00 [ERROR] Could not load bar for instrument [EUR/USD], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:55:00 [ERROR] Could not load bar for instrument [USD/JPY], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:55:00 [ERROR] Could not load bar for instrument [USD/JPY], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:54:00 [ERROR] Could not load bar for instrument [USD/JPY], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:54:00 [ERROR] Could not load bar for instrument [USD/JPY], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:54:00 [ERROR] Could not load bar for instrument [GBP/USD], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:54:00 [ERROR] Could not load bar for instrument [GBP/USD], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:54:00 [ERROR] Could not load bar for instrument [GBP/JPY], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]
12:54:00 [ERROR] Could not load bar for instrument [GBP/JPY], period [1 Min], side [Bid], start time [2018.10.29 12:59:00 000], current bar start time [2018.10.29 13:00:00 000]

Author:  JFR [ Tue 30 Oct, 2018, 08:25 ]
Post subject:  Re: help getbar is exception!!!

When is the fix being released?

Author:  API Support [ Tue 30 Oct, 2018, 09:14 ]
Post subject:  Re: help getbar is exception!!!

JFR wrote:
When is the fix being released?

In next platform release this week. But on old version application restart should help.

Author:  JFR [ Tue 30 Oct, 2018, 11:07 ]
Post subject:  Re: help getbar is exception!!!

API Support wrote:
JFR wrote:
When is the fix being released?

In next platform release this week. But on old version application restart should help.

How do I get that?

Author:  JFR [ Tue 30 Oct, 2018, 12:30 ]
Post subject:  Re: help getbar is exception!!!

Dukascopy have just said ...

For temporary solution you can adapt getBar() method as shown below.

WAS:
IBar curThirtBar = history.getBar(Curinstrument, Period.THIRTY_MINS, OfferSide.ASK, 0);

FIX:
IBar preThirtBar = history.getBars(Curinstrument, Period.THIRTY_MINS, OfferSide.ASK, Filter.NO_FILTER, 2, curThirtBar.getTime(), 0).get(0);

Unfortunately I didn't code my strategy so dont know how to do this...

Please provide link to previous working version ASAP

Author:  ASLOG2002 [ Tue 30 Oct, 2018, 18:12 ]
Post subject:  Re: help getbar is exception!!!

What happened this time? I downloaded version 3.4.9 and my strategy stopped working !!!!!

16:51:19 Strategy "CatSpy16" is stopped at 2018-10-30 16:51:19.109 GMT on the local computer with parameters "Instrument"=[FeedDescriptor [dataType=TIME_PERIOD_AGGREGATION, instrument=GBP/USD, offerSide=Bid, period=1 Min, filter=NO_FILTER]], "Lots"=[26.0], "takeProfit in pips"=[2], "stopLoss in pips"=[2], "slippage in pips"=[5], "slippage in pips LIMIT"=[5], "Close All"=[true], "Use  TP and SL orders"=[true]. Reason: Stopped on exception caught
16:51:19 Stopping "CatSpy16" strategy at 2018-10-30 16:51:19.109 GMT on the local computer
16:51:19 Strategy "CatSpy16" Strategy ID: B6835D1A80823A5D010F8BB87E2B1700 is started at 2018-10-30 16:51:19.107 GMT on the local computer with parameters "Instrument"=[FeedDescriptor [dataType=TIME_PERIOD_AGGREGATION, instrument=GBP/USD, offerSide=Bid, period=1 Min, filter=NO_FILTER]], "Lots"=[26.0], "takeProfit in pips"=[2], "stopLoss in pips"=[2], "slippage in pips"=[5], "slippage in pips LIMIT"=[5], "Close All"=[true], "Use  TP and SL orders"=[true]
16:51:19 Starting "CatSpy16" strategy at 2018-10-30 16:51:19.093 GMT on the local computer
16:51:12 Compilation successful. Strategy ID: B6835D1A80823A5D010F8BB87E2B1700
16:51:11 Compiling CatSpy16.java


No adequate diagnostics!Reason: Stopped on exception caught

Author:  ASLOG2002 [ Tue 30 Oct, 2018, 18:29 ]
Post subject:  help me! I can not work !!!

How to return the previous version?

Author:  ASLOG2002 [ Wed 31 Oct, 2018, 05:53 ]
Post subject:  Re: help getbar is exception!!!

My strategy does not start! Additional information: an exception occurs before calling the method onStart.
See previos my post.
The strategy in this form has worked for more than two years !!!
Simple strategy starts successfully.

Author:  JFR [ Fri 02 Nov, 2018, 07:38 ]
Post subject:  Re: help getbar is exception!!!

Version 3.4.10, 2.13.61 still has the problem

20:36:00 [ERROR] Could not load bar for instrument [GBP/USD], period [1 Min], side [Bid], start time [2018.11.01 20:35:00 000], current bar start time [2018.11.01 20:36:00 000]
20:36:00 [ERROR] Could not load bar for instrument [GBP/USD], period [1 Min], side [Bid], start time [2018.11.01 20:35:00 000], current bar start time [2018.11.01 20:36:00 000]

  Page 1 of 1