Dukascopy
 
 
Wiki JStore Search Login

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

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

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

Cannot get the last tick for the EUR/USD
 Post subject: Cannot get the last tick for the EUR/USD Post rating: 0   New post Posted: Sun 25 Jan, 2015, 17:23 
User avatar

User rating: 0
Joined: Sat 17 Jan, 2015, 18:46
Posts: 34
Location: China, Shanghai
Test a strategy in jforex platform, only get the info of title, why?


public void onStart(IContext context) throws JFException {
console = context.getConsole();
history = context.getHistory();
indicators = context.getIndicators();
context.setSubscribedInstruments(java.util.Collections.singleton(Instrument.EURUSD), true);

test();

}

private int getNumberOfCandlesBefore(Period period){
return (int) (period.getInterval() / Period.ONE_HOUR.getInterval()) * 30;
}

private void test() throws JFException {
long time = history.getBar(Instrument.EURUSD, Period.ONE_HOUR, OfferSide.ASK, 0).getTime();
double[] rsi14Results = indicators.rsi(Instrument.EURUSD, Period.ONE_HOUR, OfferSide.ASK, AppliedPrice.CLOSE, 14, Filter.NO_FILTER, getNumberOfCandlesBefore(Period.ONE_HOUR), time, 0);
double[] rsi60Results = indicators.rsi(Instrument.EURUSD, Period.ONE_HOUR, OfferSide.ASK, AppliedPrice.CLOSE, 60, Filter.NO_FILTER, getNumberOfCandlesBefore(Period.ONE_HOUR), time, 0);
for(double rsi14Result : rsi14Results){
console.getOut().println(rsi14Result);
}

for(double rsi60Result : rsi60Results){
console.getOut().println(rsi60Result);
}
}


 
The Best Answer  Post subject: Re: Cannot get the last tick for the EUR/USD Post rating: 0   New post Posted: Sun 25 Jan, 2015, 19:50 
User avatar

User rating: 2
Joined: Thu 27 Jun, 2013, 07:45
Posts: 11
Hi ,
Today 25.01.2015 Sunday , i have suffer with the same message in the historical tester.
I thing this is a bug who comes with Demo update.
I haved runnig demo from the last week , and when i tried to test a strategy , i found something weird - the system isn`t drawing horisontal lines at the stoploss prices , also not drawing horisontal lines for offers and bids. After exiting , and starting the demo again in the Java console i saw line containing "update = true", after that i wasn`t able to test any of my strategies.
in the historical tester start to apear the following message: "Cannot get the last tick for the EUR/USD"
I created simlple strategy from scratch, install latest java update , clear temp files (installed applications too) in the java control panel , clear the cache in the JForex - and get the same result!

the code:

package jforex;

import com.dukascopy.api.*;
import com.dukascopy.api.IAccount;
import com.dukascopy.api.IBar;
import com.dukascopy.api.IConsole;
import com.dukascopy.api.IContext;
import com.dukascopy.api.IEngine.OrderCommand;
import com.dukascopy.api.IEngine;
import com.dukascopy.api.IHistory;
import com.dukascopy.api.IIndicators;
import com.dukascopy.api.IMessage;
import com.dukascopy.api.IOrder;
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.Period;
import java.util.*;

public class PlaceBIDS implements IStrategy {
private IEngine engine;
private IConsole console;
private IHistory history;
private IContext context;
private IIndicators indicators;
private IUserInterface userInterface;
private int counter = 0;

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();
ITick lastTick = history.getLastTick(Instrument.EURUSD);
console.getNotif().println(lastTick.getBid());
}

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

public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {

if (period == Period.FIVE_MINS){
this.counter++;
double price = history.getLastTick(Instrument.EURUSD).getBid() - 50 * Instrument.EURUSD.getPipValue();
IOrder order = engine.submitOrder("order" + counter, Instrument.EURUSD, OrderCommand.PLACE_BID, 0.01,
price, 0, 0, 0, 0);
}
}
}

The Jave console registered the following:

25.01.2015 18:54:18.464 INFO a.b ] Connected to d-ja-gva-141-194
25.01.2015 18:54:18.464 INFO impl.JDK14LoggerAdapter ] Authorized
25.01.2015 18:54:19.514 INFO client.b ] Child session opened for [d-ja-gva-141-194.dukascopy.com/194.8.15.194:10443]
25.01.2015 18:54:20.454 WARNING datacache.cs ] Some or all of the requested data was not found, instrument [EUR/USD], period [Ticks], side [null], chunk from [2015-01-25 16:00:00:000], chunk to [2015-01-25 17:00:00:000]
25.01.2015 19:39:00.380 SEVERE actions.c ] Cannot get the last tick for the EUR/USD
java.lang.RuntimeException: Cannot get the last tick for the EUR/USD
at com.dukascopy.dds2.greed.actions.servicesources.StrategyTesterAction.ER(Unknown Source)
at com.dukascopy.dds2.greed.actions.servicesources.StrategyTesterAction.El(Unknown Source)
at com.dukascopy.dds2.greed.actions.c.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


 
 Post subject: Re: Cannot get the last tick for the EUR/USD Post rating: 0   New post Posted: Mon 26 Jan, 2015, 07:24 
User avatar

User rating: 0
Joined: Sat 17 Jan, 2015, 18:46
Posts: 34
Location: China, Shanghai
When I test in eclipse, set the starttime and totime in testclient before call the strategy, I can get the data, because the time period contains weekdays, history.getLastTicks's starttime is not current weekend time.
But I test in jforex, I set the starttime and totime in historical tester, why it still can not get the last tick's starttime, does it still point to current weekend time?


 
 Post subject: Re: Cannot get the last tick for the EUR/USD Post rating: 0   New post Posted: Tue 27 Jan, 2015, 08:52 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi!

Please, next time submit bug reports to corresponding forums:
viewforum.php?f=16 - in case of automated trading/JForex API bugs
viewforum.php?f=85 - in case of JForex Platform bugs

We will provide answers on these issues in this topic: viewtopic.php?f=16&t=52166


 

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