Run these code:
.........................
private IEngine engine;
private IHistory history;
private IConsole console;
private IDataService myDataService;
private IHighLowListener myHighLowListener;
private IContext context;
..................................................
public void onStart(IContext context) throws JFException {
this.context = context;
this.console = context.getConsole();
this.engine = context.getEngine();
this.history = context.getHistory();
myDataService = context.getDataService();
.........................
Set<Instrument> instruments = new HashSet<Instrument>();
instruments.add(Curinstrument);
context.setSubscribedInstruments(instruments, true);
................................
if (myDataService != null) {
myHighLowListener = new IHighLowListener() {
double _maxHighPrice=0,_minLowPrice=0;
@Override
public void highUpdated(Instrument instrument, double high) {
//your logic here
try{
if(high!=0)
_maxHighPrice = high;
// console.getOut().println("cur min price=%.5f"+high);
}
catch(Exception et)
{
et.printStackTrace();
// console.getOut().println("HighUpdated exception"+et);
}
}
@Override
public void lowUpdated(Instrument instrument, double low) {
//your logic here
try
{
if(low!=0)
_minLowPrice = low;
// console.getOut().println("cur min price=%.5f"+low);
}
catch(Exception e)
{
e.printStackTrace();
// console.getOut().println("lowUpdated exception"+e);
}
}
};
if(myHighLowListener!=null)
myDataService.addHighLowListener(Period.DAILY, Curinstrument, myHighLowListener);
//myDataService.
else
console.getOut().println("create highlowlistener exception");
...............................
in netbean platom exception found :
2018-05-02 16:40:13.697 ERROR AbstractStrategyRateDataNotificationManager -
java.lang.NullPointerException at com.dukascopy.charts.data.datacache.hl.HighLowManager.scheduleToFillPreviousCandle(HighLowManager.java:302)
at com.dukascopy.charts.data.datacache.hl.HighLowManager.newCandle(HighLowManager.java:222)
at com.dukascopy.api.impl.connect.JForexHighLowManager.newCandle(JForexHighLowManager.java:112)
at com.dukascopy.dds2.greed.agent.strategy.tester.listener.TesterHighLowManager.onBar(TesterHighLowManager.java:138)
at com.dukascopy.dds2.greed.agent.strategy.notification.candle.StrategyCandleNotificationManager.onBar(StrategyCandleNotificationManager.java:91)
at com.dukascopy.dds2.greed.agent.strategy.notification.candle.StrategyCandleNotificationManager.onBar(StrategyCandleNotificationManager.java:27)
at com.dukascopy.dds2.greed.agent.strategy.notification.AbstractStrategyRateDataNotificationManager.historicalBarReceived(AbstractStrategyRateDataNotificationManager.java:339)
at com.dukascopy.dds2.greed.agent.strategy.tester.AbstractStrategyRunner.historicalCandleReceived(AbstractStrategyRunner.java:465)
at com.dukascopy.dds2.greed.agent.strategy.tester.StrategyTesterRunner.run(StrategyTesterRunner.java:348)
at java.lang.Thread.run(Thread.java:748)
2018-05-02 16:40:13.698 ERROR AbstractStrategyRateDataNotificationManager -