Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1701

 
MakarFX #:

It's much simpler than that.

it's the same thing)

Why do you need a KillCount variable when you can just put tickCount%100

"find the difference".

int KillCount=tickCount%100;
if (KillCount == 0)
if ( tickCount%100 == 0 )
 
Taras Slobodyanik #:

so the same thing)

Why do you need a KillCount variable when you can just put tickCount%100?

"find the difference."

He needs a variable that resets at every hundred.

I already wrote there "if" isn't needed at all, just

int KillCount=tickCount%100;
 
MakarFX #:
And you're back on the horse!)))
Yeah, I'm in favour of any feast, except the hunger strike :-)) but to fall under the handout - I guess I'm still really lucky)))) sadly, my Grail machine only for the drain goodbye)))))))))
 

What might be the secret meaning of such a design?

int OnInit()
  {
  ........

   OnTick();

   return(INIT_SUCCEEDED);
  }//OnInit


void OnTick()
  {
.....
}
 
Valeriy Yastremskiy #:

What might be the secret meaning of such a design?

Where did you find this?

Maybe the author wanted to execute OnTick() during initialization

 
Valeriy Yastremskiy #:

What could be the secret meaning of such a construct, tell me.

To run OnTick logic immediately at load (restart), without waiting for a new tick. It makes sense on inactive pairs, although it's better to remove it in the timer.

There must be IsConnected, TradeAllowed and similar checks

 
Maxim Kuznetsov #:

Run OnTick logic immediately at load (restart), without waiting for a new tick. It makes sense on inactive pairs, although it's better to remove it in the timer.

There should be IsConnected, TradeAllowed and similar checks

There are checks). But isn't the first OnTick after OnInit called on tick arrival and not forced?
 
Valeriy Yastremskiy #:
There are checks). But isn't the first OnTick after OnInit called on tick arrival, not forced?

no

Events

onlygenerated for experts when a new tick is received

 
MakarFX #:

no

Events

is onlygenerated for experts when a new tick is received

I'll have a look at the print on Saturday. It's just that my EA is drawing. And it also draws at the weekend, I think. I'll have to check it out.
 
Valeriy Yastremskiy #:
There are checks). But isn't the first OnTick after OnInit called when a tick comes, and not forced?

No tick - no OnTick(), even on first run.

There are cases when graph objects are drawn in OnTick, but if there is no tick, it will not draw anything. That's why we made a single call to OnInit.