How can the attached Stochastic indicator alert be edited so that the alert only occurs when ADX is less than 25?

 

Hi,

 

In my trading I use the attached indicator to create an alert when Stochastic is overbought or oversold using the 80 and 20 limits.

I really want to only get these alerts when the standard ADX indicator (the one included with MetaTrader) is less than 25.

Can anyone please help with this? 

I think that if the attached stochastic code was wrapped in some kind of IF, then, else statement (maybe!) according to the value of ADX then this would work. (If ADX < 25 then fire stochastic alert else do nothing.) 

I am not too familiar with MQL 4 so not 100% sure how to do this.

If anyone could edit the attached code and repost that would be very handy. 

 

Thanks! 

 

p.s. Also this is my first post so apologies if this is in the wrong place. 

Files:
 
steveh2015:

Hi,

 

In my trading I use the attached indicator to create an alert when Stochastic is overbought or oversold using the 80 and 20 limits.

I really want to only get these alerts when the standard ADX indicator (the one included with MetaTrader) is less than 25.

Can anyone please help with this? 

I think that if the attached stochastic code was wrapped in some kind of IF, then, else statement (maybe!) according to the value of ADX then this would work. (If ADX < 25 then fire stochastic alert else do nothing.) 

I am not too familiar with MQL 4 so not 100% sure how to do this.

If anyone could edit the attached code and repost that would be very handy. 

 

Thanks! 

 

p.s. Also this is my first post so apologies if this is in the wrong place. 

Add this function to the code and change the four expressions accordingly.

bool adx()
  {
   double adx = iADX(_Symbol,_Period,14,PRICE_CLOSE,MODE_MAIN,0);
   if(adx<25)  return(true);
   return(false);
  }
  
if (Enable_Alert_1 && adx() && v1[0] >= Overbuy_Level && OBOS != 1)
 
 if(adx<25)  return(true);
   return(false);
return (adx<25);
Reason: