Calculation of ticks

 

My project is to create an EA capable of sending me alerts every 100 ticks.

But the one I created now only sends me alerts once.

I tried to insert my code in a loop but it doesn't work.

I need help

 
Bahijulien: I need help

Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button) or attach the source file.
     How To Ask Questions The Smart Way. (2004)
          Be precise and informative about your problem

We can't see your broken code.

Fix your broken code.

With the information you've provided — we can only guess. And you haven't provided any useful information for that.

 

There are many ways how to do it, best is to post your code. Or here is one example.

double  Ticks = 0.00100; // 100 Ticks (on 5 digits symbol)
double  Bid;

//+------------------------------------------------------------------+

void OnTick()
  {
   MqlTick last_tick; SymbolInfoTick(Symbol(), last_tick);
   Bid = last_tick.bid;

   if (Starter == 0) {Starter = Bid;}
        if (Bid == Starter+Ticks) {Starter = 0; Print("Price travel 100 ticks");}  
  }
 
  1. if (Bid == Starter+Ticks) {Starter = 0; Print("Price travel 100 ticks");}  

    Doubles are rarely equal. Understand the links in:
              The == operand. - MQL4 programming forum #2 (2013)

    Ticks do not change only by point.

    What about the downward direction?

    if( MathAbs(Bid - Starter) >= Ticks){ Starter=0; …
  2. Because you don't immediately set Starter to Bid, your alerts will slowly drift.
 
Bahijulien:

My project is to create an EA capable of sending me alerts every 100 ticks.

But the one I created now only sends me alerts once.

I tried to insert my code in a loop but it doesn't work.

I need help

William Roeder #:

Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button) or attach the source file.
     How To Ask Questions The Smart Way. (2004)
          Be precise and informative about your problem

We can't see your broken code.

Fix your broken code.

With the information you've provided — we can only guess. And you haven't provided any useful information for that.i

you are right but d i don't how add files. this is my code source

Files:
GetTicks.mq5  2 kb
 
Tadeas Rusnak #:

There are many ways how to do it, best is to post your code. Or here is one example.

 

this is my code source

Files:
GetTicks.mq5  2 kb
 
  1. Bahijulien #: this is my code source
      CopyTicks(_Symbol,tick,COPY_TICKS_ALL,0,500);
       ArraySetAsSeries(tick,true);
       int copiedTick= CopyTicks(_Symbol,tick,COPY_TICKS_ALL,0,100);

    Why are you copying twice?

  2. Bahijulien: But the one I created now only sends me alerts once.
      if(PositionsTotal()==0&&TickNumber==copiedTick)
          {
          Alert("100 TICKS");
          MessageBox("100 TICKSr",NULL,0);
          };
    

    On the next tick your variable is 101. It will never go down. Instead, count the ticks.

    input int TickNumber=100;
    int count=0;
    void OnTick()
      {
          if(++count % TickNumber != 0) return;
          Alert("100 TICKS");
          MessageBox("100 TICKSr",NULL,0);