public double getValue(Instrument instrument) throws JFException { JFUtils utils = context.getUtils(); double pipvalue = utils.convertPipToCurrency(instrument, cuenta.getCurrency()); return pipvalue; } I call this method on every 10sec bar. When Internet connection is lost and connection comes back I get this error message:
17:58:16 com.dukascopy.api.JFException: Unable to make the conversion. There are no active, subscirbed instruments containing EUR.
I guess that it is because the instruments are temporally unavailable. I would like to avoid this error because the strategy is supposed to monitor the prices every 10 sec and make a kind of trailing stop. How can I avoid this happening?
Thanks
API Support
Post subject: Re: Strategy stopping when connection is lost
Post subject: Re: Strategy stopping when connection is lost
Post rating: 1
Posted: Tue 18 Jun, 2013, 19:33
User rating: 70
Joined: Sat 22 Sep, 2012, 17:43 Posts: 118 Location: Brazil, Fortaleza, Ceará
The exception handling is fine.
As long as 'pipvalue' holding the value returned by getValue() holds its old value from a previous call to getValue(), then when the exception occurs, you will catch it and 'pipvalue' will remain unchanged.
carlosfx
Post subject: Re: Strategy stopping when connection is lost