Dukascopy
 
 
Wiki JStore Search Login

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

    Submit JForex API bug reports in this forum only.
    Submit Converter issues in Converter Issues.
    Off topics are strictly forbidden.

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

"thers is not enough data to calculate..." while backtesting
 Post subject: "thers is not enough data to calculate..." while backtesting Post rating: 0   New post Posted: Mon 03 Feb, 2014, 11:09 
User avatar

User rating: 0
Joined: Sun 04 Aug, 2013, 10:16
Posts: 48
Location: FranceFrance
Hi,

While backtesting, for some indicators like atr or fractal and some bar periods I 'm getting in the console the message "there is not enough data to calculate fractal"; this while other indicators with the same period are fine (it seems)...

Is there any explanation ?

thanks


 
 Post subject: Re: "thers is not enough data to calculate..." while backtesting Post rating: 0   New post Posted: Mon 03 Feb, 2014, 13:29 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Could you please provide an example strategy that you run and a print-screen of the Historical Tester settings that you use.


 
 Post subject: Re: "thers is not enough data to calculate..." while backtesting Post rating: 0   New post Posted: Mon 03 Feb, 2014, 13:58 
User avatar

User rating: 0
Joined: Sun 04 Aug, 2013, 10:16
Posts: 48
Location: FranceFrance
thanks for reply, strategy is 1000 lines + so i'll break it down to recreate the problem only asap

however what i have already noticed is that if using IPeriod 1min, 10 mins, 1 hour, 4 hours, daily it looks all fine & it seems the problem occurs only with 5mins/15mins/20 mins/30mins (whatever the configuration in optimization mode but i should cross test more with different config)

(nb: using onbar method)


 
 Post subject: Re: "thers is not enough data to calculate..." while backtesting Post rating: 0   New post Posted: Mon 03 Feb, 2014, 17:42 
User avatar

User rating: 0
Joined: Sun 04 Aug, 2013, 10:16
Posts: 48
Location: FranceFrance
In visual mode I could not observe it this time but i'm fairly sure I saw it happen during a test (& not on start)

In optimisation mode I could maybe find a pattern : if checkperiod is longer than or equal to fractalperiod the error appears, if check period is less then there is no error

here is an example code

public class testNotEnoughData implements IStrategy {
   
    private IEngine engine;
    private IIndicators indicators;
    private IConsole console;
    private IHistory history;
    private IAccount account;
   
    @Configurable("Instrument")  public Instrument selectedInstrument = Instrument.EURUSD;

    @Configurable("fractal Period") public Period fractalPeriod = Period.THIRTY_MINS;
    @Configurable("check period") public Period checkPeriod = Period.TEN_MINS;
   
    private int counter = 0;

    private int delay = 0;
   
    private int switchAfter = 100;

    public void onStart(IContext context) throws JFException {
       
        this.engine = context.getEngine();
        this.indicators = context.getIndicators();
        this.console = context.getConsole();
       
        this.history = context.getHistory();
        this.account = context.getAccount();
       
        }
   
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
                      //CALCULATE FRACTALS
              if (period.equals(checkPeriod) && instrument.equals(selectedInstrument)) {
                    ++delay;
                        engine.submitOrder("test"+(++counter), instrument, OrderCommand.SELL, 0.1, 0, 0, 0, 0,0,"comment"+counter);
                   
                    if (delay>switchAfter) {

                        fractalPeriod = Period.FIVE_MINS;
                        checkPeriod = Period.TEN_MINS;
                    }
                   
                    double[] fracASK = indicators.fractal(instrument, fractalPeriod, OfferSide.ASK, 5, 5);
                   
                   
              }
    }


here is screen capture before delay reach switchAfter (100)

Image

then after the period is changed (checkperiod becoming longer than fractal period)

Image

Image
Image


Attachments:
afterwitch.png [96.34 KiB]
Downloaded 557 times
beforeerror.png [92.82 KiB]
Downloaded 559 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: "thers is not enough data to calculate..." while backtesting Post rating: 0   New post Posted: Wed 05 Feb, 2014, 10:47 
User avatar

User rating: 0
Joined: Sun 04 Aug, 2013, 10:16
Posts: 48
Location: FranceFrance
please provide feedback / explanation on this issue.

can't run any optimisation test


 
 Post subject: Re: "thers is not enough data to calculate..." while backtesting Post rating: 0   New post Posted: Wed 05 Feb, 2014, 11:42 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We are going to investigate the issue as soon as available.


 
 Post subject: Re: "thers is not enough data to calculate..." while backtesting Post rating: 0   New post Posted: Wed 05 Feb, 2014, 12:54 
User avatar

User rating: 0
Joined: Sun 04 Aug, 2013, 10:16
Posts: 48
Location: FranceFrance
i don't understand what happen to onBar method once the error is triggered.

I guess the indicator calculation returns null and/or that the onBar method get killed ?

could you suggest a way to get around or handle the issue in the mean time ?


 

Jump to:  

  © 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