Download MetaTrader 5
To add comments, please log in or register
Publish your article and get a reward!
gadget
100
gadget 2014.09.16 18:41 

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?

gadget
100
gadget 2014.09.17 12:11  
Does someone have any idea? I've been searching around to really no avail.
gadget
100
gadget 2014.09.18 18:16  
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.
Alain Verleyen
Moderator
28672
Alain Verleyen 2014.09.18 18:44  
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.

/
To add comments, please log in or register