iADX values are always 0

 

Dear community,

A EA that I have playing with uses the iADX function.

When I debug I have:

iADX (NULL, ADXTime, ADXPeriod, ADXPrice, MODE_PLUSDI, 0) i.e. value of current +DX always returns a value.

iADX (NULL, ADXTime, ADXPeriod, ADXPrice, MODE_PLUSDI, 1) i.e. value of previous +DX always returns a value.

iADX (NULL, ADXTime, ADXPeriod, ADXPrice, MODE_MINUSDI, 0) i.e. value of current -DX always returns a value.

iADX (NULL, ADXTime, ADXPeriod, ADXPrice, MODE_MINUSDI, 1) i.e. value of previous -DX always returns 0!

Any idea on the reason?

The chart clearly displays the ADX lines. Why would MetaTrader return 0?

 
Does someone have any idea? I've been searching around to really no avail.
 
Ok the question didn't trigger tons of suggestions, but just to close the question I found the problem. It was due to the MQL compiler not initializing a local variable. Admins are free to remove this subject if they want.
 
gadget:
Ok the question didn't trigger tons of suggestions, but just to close the question I found the problem. It was due to the MQL compiler not initializing a local variable. Admins are free to remove this subject if they want.

See documentation :

If a variable is not initialized explicitly, the value stored in this variable can be any. Implicit initialization is not used.

Reason: