Hello Support Team, My strategy runs without any error using Historical Tester and historical data. However when I try to do a local run I get the following error: DataCacheException: Failed to load in-progress candle data in timeout period I searched the postings in the Support forum. There are several postings from people getting the same error but there is no clear resolution. One of the suggestions was to clean the local cache. I did that but I still get the error. I pulled from my strategy just an excerpt which generates the error. One strange thing is that the same piece of code works fine when it is used to get data for a currency pair: USDCHF, EURUSD, etc: double[] M60_Price_buffer = new double[Nbars]; for( i= 0 ; i < Nbars ; i++) { M60_Price_buffer[i] = (history.getBar(instrument, Period.ONE_HOUR, OfferSide.ASK, i+1).getClose() + history.getBar(instrument, Period.ONE_HOUR, OfferSide.ASK, i+1).getHigh() + history.getBar(instrument, Period.ONE_HOUR, OfferSide.ASK, i+1).getLow() )/3 ; } However when the same code is used with oil (BRENTCMDUSD), gold or indices (USA500IDXUSD, etc) it generates the above error. double[] U500_Price_buffer = new double[Nbars]; for( i= 0 ; i < Nbars ; i++) { U500_Price_buffer[i] = (history.getBar(Instrument.USA500IDXUSD, Period.ONE_HOUR, OfferSide.ASK, i+1).getClose() + history.getBar(Instrument.USA500IDXUSD, Period.ONE_HOUR, OfferSide.ASK, i+1).getHigh() + history.getBar(Instrument.USA500IDXUSD, Period.ONE_HOUR, OfferSide.ASK, i+1).getLow() )/3 ; } I tried to attach files to this message but got an error: the board attachment quota has been reached. So I pasted just an code excerpt which you can run to generate the error. Also pasted are the generated messages and the Console output. Can you please advise me how to resolve this issue? Thank you.
package jforex;
import java.util.*; import java.io.*; import java.text.*; import com.dukascopy.api.*;
import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.TimeZone;
import com.dukascopy.api.Configurable; import com.dukascopy.api.IAccount; import com.dukascopy.api.IBar; import com.dukascopy.api.IConsole; import com.dukascopy.api.IContext; import com.dukascopy.api.IDataService; import com.dukascopy.api.IEngine; import com.dukascopy.api.IFXSentimentIndex; import com.dukascopy.api.IHistory; import com.dukascopy.api.IIndicators; import com.dukascopy.api.IMessage; import com.dukascopy.api.IStrategy; import com.dukascopy.api.ITick; import com.dukascopy.api.IUserInterface; import com.dukascopy.api.Instrument; import com.dukascopy.api.JFException; import com.dukascopy.api.JFUtils; import com.dukascopy.api.OfferSide; import com.dukascopy.api.Period;
@RequiresFullAccess public class TestIndex implements IStrategy { private IEngine engine; private IConsole console; private IHistory history; private IContext context; private IIndicators indicators; private IUserInterface userInterface;
private IAccount account; private IDataService dataService; private JFUtils utils;
@Configurable("Instrument") public Instrument instrument = Instrument.USDCHF ; @Configurable("Period") public Period period = Period.FIVE_MINS ; // @Configurable("Period") public Period period = Period.FIFTEEN_MINS ; @Configurable("OfferSide") public OfferSide offerSide = OfferSide.BID;
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();
this.account = context.getAccount(); this.dataService = context.getDataService(); this.utils = context.getUtils();
Set<Instrument> subscribedInstruments = new HashSet<Instrument>(); subscribedInstruments.clear(); subscribedInstruments.add(instrument); // one or more subscribedInstruments.add(Instrument.BRENTCMDUSD ); subscribedInstruments.add(Instrument.USA500IDXUSD);
context.setSubscribedInstruments(subscribedInstruments, true);
} public void onAccount(IAccount account) throws JFException { }
public void onMessage(IMessage message) throws JFException { }
public void onStop() throws JFException { }
public void onTick(Instrument instrument, ITick tick) throws JFException { }
// Global Variables ; static int Nbars = 48 ; static int Nbars1 = 12 ; static double GBID_1_PT , M60_1_PT , U500_1_PT ; public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
if (!( instrument.equals(this.instrument) && ( period.equals(this.period) ))) { return; } PutXvars2List() ; }
public void PutXvars2List() throws JFException {
int i , n ;
double[] M60_Price_buffer = new double[Nbars]; for( i= 0 ; i < Nbars ; i++) { M60_Price_buffer[i] = (history.getBar(instrument, Period.ONE_HOUR, OfferSide.ASK, i+1).getClose() + history.getBar(instrument, Period.ONE_HOUR, OfferSide.ASK, i+1).getHigh() + history.getBar(instrument, Period.ONE_HOUR, OfferSide.ASK, i+1).getLow() )/3 ; } M60_1_PT = M60_Price_buffer[0] ;
double[] U500_Price_buffer = new double[Nbars]; for( i= 0 ; i < Nbars ; i++) { U500_Price_buffer[i] = (history.getBar(Instrument.USA500IDXUSD, Period.ONE_HOUR, OfferSide.ASK, i+1).getClose() + history.getBar(Instrument.USA500IDXUSD, Period.ONE_HOUR, OfferSide.ASK, i+1).getHigh() + history.getBar(Instrument.USA500IDXUSD, Period.ONE_HOUR, OfferSide.ASK, i+1).getLow() )/3 ; } U500_1_PT = U500_Price_buffer[0] ;
}
}
Messages 2015-07-07 01:51:31 Strategy "TestIndex" is stopped at 2015-07-07 01:51:31.121 GMT on the local computer with parameters "Instrument"=[USD/CHF], "Period"=[5 Mins], "OfferSide"=[Bid]. Reason: Stopped by Engine 2015-07-07 01:51:31 Stopping "TestIndex" strategy at 2015-07-07 01:51:31.119 GMT on the local computer 2015-07-07 01:50:22 com.dukascopy.charts.data.datacache.DataCacheException: Failed to load in-progress candle data in timeout period [USA500.IDX/USD, Hourly, Ask] @ jforex.TestIndex.PutXvars2List(TestIndex.java:145) 2015-07-07 01:45:20 Strategy "TestIndex" Strategy ID: CA9B7E38B5165CA3936D2C4AA7E49767 is started at 2015-07-07 01:45:20.753 GMT on the local computer with parameters "Instrument"=[USD/CHF], "Period"=[5 Mins], "OfferSide"=[Bid] 2015-07-07 01:45:20 Starting "TestIndex" strategy at 2015-07-07 01:45:20.710 GMT on the local computer 2015-07-07 01:45:13 Compilation successful. Strategy ID: CA9B7E38B5165CA3936D2C4AA7E49767 2015-07-07 01:45:13 Compiling TestIndex.java
Console Java Web Start 11.45.2.14 Using JRE version 1.8.0_45-b14 Java HotSpot(TM) Client VM User home directory = C:\Users\PAVEL ---------------------------------------------------- c: clear console window f: finalize objects on finalization queue g: garbage collect h: display this help message m: print memory usage o: trigger logging p: reload proxy configuration q: hide console r: reload policy configuration s: dump system and deployment properties t: dump thread list v: dump thread stack 0-5: set trace level to <n> ---------------------------------------------------- 2015-07-06 21:48:09.632 WARN e - Ticks <3> skipped due to slow previous ticks processing by platform 2015-07-06 21:49:24.673 ERROR n - com.dukascopy.charts.data.datacache.DataCacheException: Failed to load in-progress candle data in timeout period [USA500.IDX/USD, Hourly, Ask] com.dukascopy.api.JFException: com.dukascopy.charts.data.datacache.DataCacheException: Failed to load in-progress candle data in timeout period [USA500.IDX/USD, Hourly, Ask] at com.dukascopy.api.impl.n.a(L:601) at com.dukascopy.api.impl.p.run(L:532) at com.dukascopy.api.impl.p.run(L:529) at java.security.AccessController.doPrivileged(Native Method) at com.dukascopy.api.impl.n.getBars(L:529) at com.dukascopy.api.impl.n.a(L:232) at com.dukascopy.api.impl.n.getBar(L:201) at jforex.TestIndex.PutXvars2List(TestIndex.java:145) at jforex.TestIndex.onBar(TestIndex.java:119) at com.dukascopy.api.impl.execution.n.ct(L:85) at com.dukascopy.api.impl.execution.n.call(L:63) at com.dukascopy.api.impl.execution.n.call(L:23) at java.util.concurrent.FutureTask.run(Unknown Source) at com.dukascopy.api.impl.execution.g$a.f(L:904) at com.dukascopy.api.impl.execution.g$a.run(L:926) at java.lang.Thread.run(Unknown Source) Caused by: com.dukascopy.charts.data.datacache.DataCacheException: Failed to load in-progress candle data in timeout period [USA500.IDX/USD, Hourly, Ask] at com.dukascopy.charts.data.datacache.bu.c(L:1255) at com.dukascopy.charts.data.datacache.au.c(L:1529) at com.dukascopy.api.impl.n.a(L:209) at com.dukascopy.api.impl.n.a(L:553) ... 15 more 2015-07-06 21:49:24.678 ERROR o$b - Exception thrown while running onBar method: com.dukascopy.charts.data.datacache.DataCacheException: Failed to load in-progress candle data in timeout period [USA500.IDX/USD, Hourly, Ask] com.dukascopy.api.JFException: com.dukascopy.charts.data.datacache.DataCacheException: Failed to load in-progress candle data in timeout period [USA500.IDX/USD, Hourly, Ask] at com.dukascopy.api.impl.n.a(L:601) at com.dukascopy.api.impl.p.run(L:532) at com.dukascopy.api.impl.p.run(L:529) at java.security.AccessController.doPrivileged(Native Method) at com.dukascopy.api.impl.n.getBars(L:529) at com.dukascopy.api.impl.n.a(L:232) at com.dukascopy.api.impl.n.getBar(L:201) at jforex.TestIndex.PutXvars2List(TestIndex.java:145) at jforex.TestIndex.onBar(TestIndex.java:119) at com.dukascopy.api.impl.execution.n.ct(L:85) at com.dukascopy.api.impl.execution.n.call(L:63) at com.dukascopy.api.impl.execution.n.call(L:23) at java.util.concurrent.FutureTask.run(Unknown Source) at com.dukascopy.api.impl.execution.g$a.f(L:904) at com.dukascopy.api.impl.execution.g$a.run(L:926) at java.lang.Thread.run(Unknown Source) Caused by: com.dukascopy.charts.data.datacache.DataCacheException: Failed to load in-progress candle data in timeout period [USA500.IDX/USD, Hourly, Ask] at com.dukascopy.charts.data.datacache.bu.c(L:1255) at com.dukascopy.charts.data.datacache.au.c(L:1529) at com.dukascopy.api.impl.n.a(L:209) at com.dukascopy.api.impl.n.a(L:553) ... 15 more 2015-07-06 21:49:56.762 WARN e - Ticks <6> skipped due to slow previous ticks processing by platform 2015-07-06 21:49:57.037 WARN e - Ticks <5> skipped due to slow previous ticks processing by platform 2015-07-06 21:49:57.038 WARN e - Ticks <3> skipped due to slow previous ticks processing by platform 2015-07-06 21:53:25.772 WARN e - Ticks <4> skipped due to slow previous ticks processing by platform 2015-07-06 21:53:55.857 WARN e - Ticks <3> skipped due to slow previous ticks processing by platform
|