Download MetaTrader 5

alert message for 15 to 30 pips long bars

To add comments, please log in or register

Hi friends,

Good Day and a very happy new year. Iam a new member.

I need to get automatic alerts whenever the bar length is 15 to 30 pips in a 30 minute bar chart for specified currency pairs. How do I start. Pla help.



Sherif Hasan
Sherif Hasan  

You can hire a programmer.

Freelance service at
Freelance service at
Orders for the development of automated trading programs
Snelle Moda
Snelle Moda  


Try this example:

// Rates structure array for the data of the last complete bar 
   MqlRates MyBar[];                 
   CopyRates(Symbol(), PERIOD_M30, 1, 1, mrate);

// Distance between HIGH/LOW of 30 min BAR multiplied by pip factor value.
   double dHigh_Low_Distance = (MyBar[0].high - MyBar[0].low) * 10000;
// Check if distance is greater than or smaller than 30 pips
   if(dHigh_Low_Distance > 15 && dHigh_Low_Distance < 30)
         Alert("The BAR value of symbol = ", Symbol(), " is between 15 and 30 pips ", dHigh_Low_Distance);        
To add comments, please log in or register