alert message for 15 to 30 pips long bars

 

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.

Thanks

Ravibala

 

You can hire a programmer.

https://www.mql5.com/en/job

Freelance service at MQL5.com
Freelance service at MQL5.com
  • www.mql5.com
Orders for the development of automated trading programs
 

Hi

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);        
         }
Reason: