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.

Backtests fine, throws nullpointer error immediately live...
 Post subject: Backtests fine, throws nullpointer error immediately live... Post rating: 0   New post Posted: Thu 20 Mar, 2014, 17:51 

User rating: 1
Joined: Thu 20 Mar, 2014, 15:13
Posts: 14
Location: United Kingdom,
Live account, JForex API Ver. 2.9.6.2

I've written a JForex Strategy (1-min EUR/USD) which backtests fine, any period, but when I try to run it live, at the end of the first 1-min bar it throws the exception shown in the attached image below.

With a bit of rearranging the order of the code, I have managed to get it to identify a line number in the onBar method, but this line has nothing to do with anything going on in the onMessage method...

Strange that it should work without problems in the historical tester though, no?

Anyone else had a problem like this / got any ideas?

Cheers!

Image


Attachments:
example_of_error_live.png [143.26 KiB]
Downloaded 270 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: Backtests fine, throws nullpointer error immediately live... Post rating: 2   New post Posted: Fri 21 Mar, 2014, 12:55 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Without the source code, it is almost impossible to help,
especially with NPE...

If the code is confidential, try to create a simplified version of the strategy that is generating the same exception, and attach that one. Or contact send an email to support, attaching the strategy.


 
 Post subject: Re: Backtests fine, throws nullpointer error immediately live... Post rating: 0   New post Posted: Fri 21 Mar, 2014, 13:09 

User rating: 1
Joined: Thu 20 Mar, 2014, 15:13
Posts: 14
Location: United Kingdom,
Yeah, cheers. That's kind of what I feared. I contacted tech support and they sent me here. The source code is huge, and it'll be a hell of a job to create a simplified version which throws the same error, but I guess that's what I'll have to do. Thanks anyway!


 
 Post subject: Re: Backtests fine, throws nullpointer error immediately live... Post rating: 0   New post Posted: Tue 08 Apr, 2014, 10:01 

User rating: 1
Joined: Thu 20 Mar, 2014, 15:13
Posts: 14
Location: United Kingdom,
In case anyone was still wondering, my program made a false assumption... True in back-testing, but not in Live-mode :

That every message in the Istrategy.onMessage is order-related

Therefore, running live, some messages have

message.getOrder() = null

This was simply fixed by adding the following line at the beginning of onMessage :

if ( message.getOrder == null ) { return; }

Thanks for Dukascopy Support Team for quickly resolving this issue for me!


 

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