E&A Standard Trading System - page 29

Mladen Rakic
160407
Mladen Rakic  

ADX crossing

Be careful with it.

for (shift = CountBars; shift>=0; shift--)

{

b4plusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_PLUSDI,shift-1);

nowplusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_PLUSDI,shift);

b4minusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_MINUSDI,shift-1);

nowminusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_MINUSDI,shift);

if (b4plusdi>b4minusdi && nowplusdi<nowminusdi)

{

val1[shift]=Low[shift]-5*Point;

}

if (b4plusdinowminusdi)

{

val2[shift]=High[shift]+5*Point;

}

}

It is looking for future values (the shift-1 parameter) to find out crossings

jturns23
442
jturns23  
ValeoFX:
If my memory serves me correctly, this indicator is a renamed version of the VQ.mq4 and I see on their Thread that they have improved the original quite considerably. The present Alaskin downloaded from your Thread, seems to behave like in the beginning of the VQ concept. You may want to look into this.

Secondly, I have an ADX Crossing indicator by Amir which I find extremely accurate almost to the point of disbelief. It outperforms the 2 I have downloaded from your zipped file and I place it here for your perusal and comment.

Best wishes.

Valeo, upon closer inspection, its the exact same as the Non-repainting ADX cross. The difference is that the dot in yours looks like it shows up 1 bar before the Non-repainting ADX cross arrows show up. The funny thing is, they appear at the same time. As Mladen pointed out, it's the shift value that makes it look like it shows up 1 bar "earlier".

Hercs
2957
Hercs  
Big Joe:
Hey yah Valeo !

I think pip assasin alaskan (or whatever you like) REPAINTS ?

I ask confirmation.

Hi my good friend,

I was just being polite.

Did you get my e-mail to your private mail address?

Best wishes.

Hercs
2957
Hercs  
mladen:
Be careful with it.
for (shift = CountBars; shift>=0; shift--)

{

b4plusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_PLUSDI,shift-1);

nowplusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_PLUSDI,shift);

b4minusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_MINUSDI,shift-1);

nowminusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_MINUSDI,shift);

if (b4plusdi>b4minusdi && nowplusdi<nowminusdi)

{

val1[shift]=Low[shift]-5*Point;

}

if (b4plusdinowminusdi)

{

val2[shift]=High[shift]+5*Point;

}

}
It is looking for future values (the shift-1 parameter) to find out crossings

Mladen, would you mind being more explicit regarding the "warning"? It most certainly does not repaint, but if there is anything else to be aware of, I would like to know so that I can address it. It most certainly gives excellent signals.

Looking forward to hearing from you.

Best wishes.

Hercs
2957
Hercs  
jturns23:
Thanks Valeo, been looking for a good ADX cross indicator. As far as the APA, I agree, it repaints very badly. Anyone who questions it, just open strategy tester and watch it.

Thanks for the confirmation re APA. My pleasure for the ADX Crossing.mq4.

Best wishes.

Mladen Rakic
160407
Mladen Rakic  

There are two coding errors in that indicator :

  • as I stated in my previous post already, it is looking for crosses comparing currentand futurevalue (I sincerely doubt that it was the intention)
  • also buffer values are not emptied on every loop. As a result, there are cases when indicator is going to become a "repainter" (cases when it posts signal for crossing and then, before the bar expires, values change back - since the buffer values are not cleaned (emptied), the "cross" is still remaining there, but if you change time frames or symbol and go back, or restart mt, it will disappear - effectively becoming a repainting indicator) Author did try to avoid that situation with fixed bar count (always recalculating the CountBarsbars) but it means that the indicator is almost always recalculating unnecessarily

Hope this is explicit enough

regards

mladen

ValeoFX:
Mladen, would you mind being more explicit regarding the "warning"? It most certainly does not repaint, but if there is anything else to be aware of, I would like to know so that I can address it. It most certainly gives excellent signals.

Looking forward to hearing from you.

Best wishes.
Hercs
2957
Hercs  
mladen:
There are two coding errors in that indicator :
  • as I stated in my previous post already, it is looking for crosses comparing currentand futurevalue (I sincerely doubt that it was the intention)
  • also buffer values are not emptied on every loop. As a result, there are cases when indicator is going to become a "repainter" (cases when it posts signal for crossing and then, before the bar expires, values change back - since the buffer values are not cleaned (emptied), the "cross" is still remaining there, but if you change time frames or symbol and go back, or restart mt, it will disappear - effectively becoming a repainting indicator) Author did try to avoid that situation with fixed bar count (always recalculating the CountBarsbars) but it means that the indicator is almost always recalculating unnecessarily

Hope this is explicit enough

regards

mladen

Very much so as I have come to know you, Mladen and I thank you for this kind explanation.

Would you therefore suggest that the other version (ADX_CrossesNonrepainting), be the correct one to use?

I await your expert advise with baited breath. Thanking you most sincerely.

Mladen Rakic
160407
Mladen Rakic  

...

Sorry. Same buffer cleaning issue with ADX_CrossesNonrepainting (but it does not "look into the future")

Nature of ADX (the DI+ and DI- which are changing values only when price makes new high or new low) makes the repainting situations rare, but, still there they are...

ValeoFX:
Very much so as I have come to know you, Mladen and I thank you for this kind explanation.

Would you therefore suggest that the other version (ADX_CrossesNonrepainting), be the correct one to use?

I await your expert advise with baited breath. Thanking you most sincerely.
BlueWhale
95
BlueWhale  

Clean it out?

Is there a way to periodically clean out the memory?

Mladen Rakic
160407
Mladen Rakic  

...

All one need to do (in the case of ADX_CrossesNonrepainting) is to add two lines of 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 = EMPTY_VALUE; // this line added

ExtMapBuffer2 = EMPTY_VALUE; // this line added too

//----

if(b4plusdi nowminusdi)

ExtMapBuffer1 = Low - nShift*Point;

//----

if(b4plusdi > b4minusdi && nowplusdi < nowminusdi)

ExtMapBuffer2 = High + 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)