Dukascopy
 
 
Wiki JStore Search Login

JFOREX-3661 indicators.mom and sma returns NaN
 Post subject: JFOREX-3661 indicators.mom and sma returns NaN Post rating: 0   New post Posted: Wed 28 Mar, 2012, 16:16 

User rating: 0
Joined: Wed 29 Feb, 2012, 16:32
Posts: 4
Dear support,
I am unable to use sma and mom indicators from onBar function;
Here is the code:
double sma = indicators.sma(instrument, period, OfferSide.BID, AppliedPrice.CLOSE, 20, 1);
double mom = indicators.mom(instrument, period, OfferSide.BID, AppliedPrice.CLOSE, 5, 1);


After that sma and mom variables are set to NaN.

Thanks


 
 Post subject: Re: indicators.mom and sma returns NaN Post rating: 0   New post Posted: Thu 29 Mar, 2012, 08:03 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We could not replicate this. Please provide a more precise case.


 
 Post subject: Re: indicators.mom and sma returns NaN Post rating: 0   New post Posted: Thu 29 Mar, 2012, 08:57 

User rating: 0
Joined: Wed 29 Feb, 2012, 16:32
Posts: 4
Here is the file attached.
Error is on the line 107, it returns NaN.


Attachments:
TwentyPipsADay.java [4.59 KiB]
Downloaded 350 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: JFOREX-3661 indicators.mom and sma returns NaN Post rating: 0   New post Posted: Fri 30 Mar, 2012, 11:18 

User rating: 0
Joined: Wed 29 Feb, 2012, 16:32
Posts: 4
So does it works for you?

I think I missed something, because indicators should work according to api.

Also history.getBars() not working (when I tried to implement MOM function by myself).
And
sma = indicators.ma(instrument,period,OfferSide.BID,IIndicators.AppliedPrice.CLOSE,20,IIndicators.MaType.SMA,0);

IS WORKING!
while
indicators.sma(instrument, period, OfferSide.BID, AppliedPrice.CLOSE, 20, 1);

not


 

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