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.

NaN Value
 Post subject: NaN Value Post rating: 0   New post Posted: Tue 10 Nov, 2009, 10:06 

User rating: 0
Joined: Fri 23 Oct, 2009, 15:48
Posts: 5
Hi,
Could anyone help me out in getting rid of NaN value which is getting displayed in the output.

Output:
NaNValue of output[1]
NaN Value of output[0]


 
 Post subject: Re: NaN Value Post rating: 0   New post Posted: Tue 10 Nov, 2009, 10:41 

User rating: 0
Joined: Fri 23 Oct, 2009, 15:48
Posts: 5
Hi,
Further adding to the above query.

I am getting NaN value in the output when I am tryin to use indicators.fractal

Please guide me to resolve this issue.


 
 Post subject: Re: NaN Value Post rating: 0   New post Posted: Wed 11 Nov, 2009, 09:26 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
use static method isNaN(double d). Consider this example:
    double d = Double.NaN;
   if (Double.isNaN(d)){
      System.out.println(" Not-a-Number ");
   }


 
 Post subject: Re: NaN Value Post rating: 0   New post Posted: Wed 09 Dec, 2009, 08:27 

User rating: 0
Joined: Fri 23 Oct, 2009, 15:48
Posts: 5
Hi,
I have resolved the NaN value for fractals. But in the display on chart EUR/GBP I see that the
Fractal up values for duration H1 and M15 is same as Fractal down values for the duration H1 and M15. Please help me in resolving this issue and guide me as to why this occurs.
for example :
Fractal Upper(H1) = 0.8992
Fractal Lower(H1) = 0.8665
Fractal Upper(m15) = 0.8992
Fractal Lower(m15) = 0.8665


 
 Post subject: Re: NaN Value Post rating: 0   New post Posted: Tue 15 Dec, 2009, 09:23 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
to be sure that we are on the same page, please consider this example:
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
        if (instrument.equals(Instrument.EURGBP) &&
                (period.equals(Period.FIFTEEN_MINS) || period.equals(Period.ONE_HOUR))){
           
            double maxValue = indicators.fractal(instrument, period, OfferSide.BID, 0, 2)[0];
            double minValue = indicators.fractal(instrument, period, OfferSide.BID, 0, 2)[1];
            Date time = new Date(bidBar.getTime());
           
            if (period.equals(Period.FIFTEEN_MINS)){
                console.getOut().println("FIFTEEN_MINS: "+maxValue+", "+minValue+"    time: "+time);
            }
            if (period.equals(Period.ONE_HOUR)){
                console.getOut().println("ONE_HOUR: "+maxValue+", "+minValue+"    time: "+time);               
            }
        }
    }

Quote:
Please help me in resolving this issue and guide me as to why this occurs.

Min and Max values could match only when an indicator as input data gets flat bars. It happens every time when market is closed.

Are you still able to get such indicator values?


 

Jump to:  

  © 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