How to solve error Could not load bar for instrument

I made a strategy and working well but sometime it give error and stop. error is below :

13:11:49 com.dukascopy.api.JFException: Could not load bar for instrument [EUR/USD], period [30 Mins], side [Bid], start time [2016.05.06 08:00:00 000], current bar start time [2016.05.06 13:00:00 000] @ jforex.TradingEA_Test.Bar(

I don't why it is give error. is anyone idea why it is give error. Please help me

Thanks in Advanced

Translate to English Show original

orto leave comments

Answers: 1

Best Answer

It's difficult to answer that without source code and a thorough investigation of the issue.

You will learn the most by doing it yourself. Try to isolate the issue and identify conditions in which it appears. Once you are able to reproduce the issue, it's much easier to debug the code and, if necessary, report the issue to support via forums or email.

In the meantime, you can employ the following workaround:

1. Use "onTick" method instead of "onBar" method
2. Write code that simulates "onBar" by calling "onMyBar" method at the first available tick for each period
3. Move your "onBar" method code to "onMyBar" method

Translate to English Show original
10 May 2016 by

capilta avatar
capilta 10 May

Actually nothing code in onBar Method. on my strategy onBar is below

    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
        //if(period==Period.ONE_MIN) Delete(OrderCommand.SELLSTOP_BYASK);

capilta avatar
capilta 10 May

i see my code again. line 596 there is a method below:

  protected IBar Bar(int Shift) throws JFException{
      return( myHistory.getBar(myInstrument, myPeriod, OfferSide.BID, Shift) );       

and i call this method on onTick event. and think error come from it.

al_dcdemo avatar

Just move line 596 into try-catch block and log input parameters to "getBar" method along with current time whenever an exception is thrown. It should give you a much better idea of what is going on and when.

orto leave comments
Please log in or register to post answer.