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.

Indicator is calculating NaN
 Post subject: Indicator is calculating NaN Post rating: 0   New post Posted: Wed 13 Oct, 2010, 01:06 

User rating: 0
Joined: Tue 28 Sep, 2010, 09:41
Posts: 18
Hello

in this thread
viewtopic.php?f=6&t=23915
I asked you how to access values from my custom indicator inside strategy code.

Your replay was this:
Object[] val = indicators.calculateIndicator(
                    instrument,
                    period,
                    new OfferSide[] {OfferSide.BID, OfferSide.BID},
                    "LS_I_DirectionalCorrelation_vs_GBPUSD",
                    new IIndicators.AppliedPrice[] {IIndicators.AppliedPrice.CLOSE},
                    new Object[] {14},
                    1);
console.getOut().println('indicator value: ' + val[0]);


I then I told that its working fine.
But now I found out that sometimes is NOT.
I run the code in historical tester and its printing the values of the indicator.
But for example another time, I run THE SAME CODE on THE SAME DATA in historical tester but all the calculated values are NaN.

How is this possible???


 
 Post subject: Re: Indicator is calculating NaN Post rating: 0   New post Posted: Thu 21 Oct, 2010, 19:51 

User rating: 0
Joined: Tue 28 Sep, 2010, 09:41
Posts: 18
Hello
I found out how to resolve the problem by myself...
as I told sometimes happens that when you are using multiinstrument indicators in your strategies, all their results are still Double.NaN

In this case is necessery to restart JForex
after that load and display charts of all instruments which are used by your multiinstrument indicator.
The charts has to be displayed with period 1Tick and after that change to any bigger period (i am using 1hour)
This will cause something like "initializing or subscribing the data source into JForex" (thats how I am explaining it to myself :))
and then the indicators can be used without any problem ;)

It is quite unusually behaviour mayebe there is any bug maybe your developer might take a look at this issue.


 

Jump to:  

cron
  © 1998-2025 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