What is -nan(ind) error and solution to it.

 

Dear Members

Just now I have started receiving  UpperInn[-nan(ind)] Error, where as this indicator and code have been working fine for quite a months.

Search on Google and Forum, did not helped much.

Any help will be highly appreciated.

2022.08.01 14:29:50.270 2022.01.04 00:01:00   CSignalEntry::RefreshDataH01: DBBH01 UpperInn[-nan(ind)] Base[0.0] LowerInn[-nan(ind)]

2022.08.01 14:29:50.270 2022.01.04 00:01:00   CSignalEntry::RefreshDataH01: GetLastError[0]
2022.08.01 14:29:50.270 2022.01.04 00:01:00   CSignalEntry::RefreshDataH01: HAshiH01 [3][36513.3] [2][36553.3] [1][36567.4]
2022.08.01 14:29:50.270 2022.01.04 00:01:00   CSignalEntry::RefreshDataM15: DBBM15 UpperInn[-nan(ind)] Base[0.0] LowerInn[-nan(ind)]
2022.08.01 14:29:50.270 2022.01.04 00:01:00   CSignalEntry::RefreshDataM15: HAshiM15 [3][36563.2] [2][36568.0] [1][36556.8]


regards

 
Nan/-nan/Inf/-inf are special double/float values, which represent (Nan) Not A Number or (inf) infinity.

These values are predefined values.

Search for floating point wiki on Google.
 
 
Dominik Christian Egert #:
Nan/-nan/Inf/-inf are special double/float values, which represent (Nan) Not A Number or (inf) infinity.

These values are predefined values.

Search for floating point wiki on Google.

Thanks Dominik for your quick reply.

However this problem was solved with redefining the Constructor Method to include symbol data, as I noticed the class symbol was shown as null value. I was using in the following way to define constructor for sub class.

CSignalEntry() : CStrategyBase(mSymbol,mBBPeriod,mBBDeviationOut,mBBDeviationInn,mRiskPerTrade) {  }

Redefining it as follows and entering the values as creation of class constructor, resolved the issue of -nan(ind) error, however I am not sure why this caused problem in first place.

CSignalEntry(string pSymbol,int pBBPeriod,double pBBDeviationOut,double pBBDeviationInn,double pRiskPerTrade)
        : CStrategyBase(pSymbol,pBBPeriod,pBBDeviationOut,pBBDeviationInn,pRiskPerTrade) {  }
SignalEntryDTB = new CSignalEntry(mSymbol,mBBPeriod,mBBDeviationOut,mBBDeviationInn,mRiskPerTrade);

I have a bigger issue of defining constructor method for class and sub-class, and plan to raise that later in future. Till then I am entering minimum required values of defining each new class or its sub class.

Surely I will google for floating point wiki, to learn more about this problem.

 
William Roeder #:

double NaN=double("nan");

See LifeHack for traders: Fast food made of indicators - MQL5 Articles #1.1 (2012)

Thanks a lot William for your quick reply.

I have not gone in details of the artricle, as the problem is solved for now. However I have noticed the following quote in the article.

"All indicators pass their data as double. This is an issue of sending a message to a user if it has suddenly become impossible to obtain data from the indicator. This may happen if the indicator handle is not created (for example, if a non-existent symbol is specified) ".

And since my Class was having no symbol, defined, it could have caused the problem, but again other indicators were showing correct valued except only one.

Reason: