Please Help: I modified MT4's DMI+ADX indicator but one line is not displayed
//---- last counted bar will be recounted if(counted_bars>0) counted_bars--; int limit=Bars-counted_bars;
An "Array out of Range" error occurs because when "counted_bars" is 0, "limit" is equal to "Bars"
An "Array out of Range" error occurs because when "counted_bars" is 0, "limit" is equal to "Bars"
Tried but still note fixed.
I'm rewriting the whole code based on some other approach now so might solve it eventually.
Thank you very much.
Tried but still note fixed.
I've not fixed your program, I'm just pointing out where it's causing the trouble. Don't you understand that?
Hi everyone
I modified MT4's official DMI+ADX indicator(https://www.mql5.com/en/code/7955) to make it same as other other platforms.
The change is, MT4 calculates the EMA of (±DM/TrueRange) for ±DI while my version is to calculate EMA of ±DM and TrueRange separately then divide them. The ADX part is untouched.
- MT4's original version: ±DI = 100 * EMA(±DM/TrueRange)
- My version: ±DI = 100 * EMA(±DM) / EMA(TrueRange)
Well the ±DI part went well and displayed correctly in MT4.
However, the problem is the ADX line somehow disappeared mysteriously. Related code is even not changed! I tried a lot but still can't figure out what's happening. Can anyone help to find out the reason?
Thank you very much.