EA to get events every round cotation

 

Hello dear,

 I submit this topic to get your help as a christmas gift :-)

 I'm coding an EA, and I would like a way to get events (as notification, or something else) every round quotation.

 For instance my EA will send notification each time DAX touch 13100 then at 13200 then 13300.

 I don't want to use MT4 alarm manually, because I prefer to get this automatically.

 I was thinking to convert quote to char, then work on string to manage left part of the string...but a easiest way will be appreciate.

Do you have a better idea for me ?

Best wishes for christmas !

 

Not tested

//+------------------------------------------------------------------+
//|                                                  Price Touch.mq4 |
//|                                                    Keith Watford |
//+------------------------------------------------------------------+
#property copyright "Keith Watford"
#property version   "1.00"
#property strict
//--- input parameters
input double      StartPrice=13000;//Start Price
input double      Increment=100;

double NextPrice;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
  NextPrice=NormalizeDouble(StartPrice+Increment,Digits);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
  if(Bid>=NextPrice)
  {
   SendNotification(Symbol()+" price touched "+DoubleToString(NextPrice,Digits));
   NextPrice=NormalizeDouble(NextPrice+Increment,Digits);
  }
//---
  }
//+------------------------------------------------------------------+
 

Thank you keith for your answer.

My only remark is : How to remove StartPrice=13000, because in two days instead of 13000, it should be 11000 ?

Do you have an idea for that ?

Best regards.

 
Jerome Ligny:

Thank you keith for your answer.

My only remark is : How to remove StartPrice=13000, because in two days instead of 13000, it should be 11000 ?

Do you have an idea for that ?

Best regards.

Change the input.