All one need to do (in the case of
ADX_CrossesNonrepainting) is to add two lines of code :
PHP Code:
for(int i = 0; i < limit; i++)
{
b4plusdi = iADX(NULL, 0, ADXcrossesPeriod, PRICE_CLOSE, MODE_PLUSDI, i + 1);
nowplusdi = iADX(NULL, 0, ADXcrossesPeriod, PRICE_CLOSE, MODE_PLUSDI, i);
b4minusdi = iADX(NULL, 0, ADXcrossesPeriod, PRICE_CLOSE, MODE_MINUSDI, i + 1);
nowminusdi = iADX(NULL, 0, ADXcrossesPeriod, PRICE_CLOSE, MODE_MINUSDI, i);
//----
ExtMapBuffer1[i] = EMPTY_VALUE; // this line added
ExtMapBuffer2[i] = EMPTY_VALUE; // this line added too
//----
if(b4plusdi < b4minusdi && nowplusdi > nowminusdi)
ExtMapBuffer1[i] = Low[i] - nShift*Point;
//----
if(b4plusdi > b4minusdi && nowplusdi < nowminusdi)
ExtMapBuffer2[i] = High[i] + nShift*Point;
}
That is the "clean up". Nothing else does not have to be done
Since the "if block" is
not always going to assign value, the corresponding buffer must be cleaned before the "if block" (otherwise there is a risk of repainting)
PS: when using ADX, do not forget that metatrader ADX is not equal to Wilders DMI (the original)