Download MetaTrader 5

void onTick() vs int start()

To add comments, please log in or register
Fireche22
24
Fireche22  
are they the same? if I put my logic in start() it works just fine but void tick() doesn't seem to do anything. Also I realised that when the price spikes pretty quick, my EA can't really catch it in time with start() so I thought tick() might be a better use..but then I just read that they are the same? 
whroeder1
17050
whroeder1  
  1. There is no such void tick().
  2. Updated MQL4 - MQL4 Reference 2/2014 Start using the new calls. There will be no difference in timing.
Fireche22
24
Fireche22  
i meant onTick() .. sorry
Mladen Rakic
71676
Mladen Rakic  
Fireche22:
are they the same? if I put my logic in start() it works just fine but void tick() doesn't seem to do anything. Also I realised that when the price spikes pretty quick, my EA can't really catch it in time with start() so I thought tick() might be a better use..but then I just read that they are the same? 

Tested the following two versions and both are working as expected

"‌New" format :

int  OnInit(void) { return(INIT_SUCCEEDED); }
void OnDeinit(const int reason) {}
void OnTick() 
{
   Comment("I am here "+TimeToString(TimeLocal(),TIME_SECONDS));
}

‌"Old" format :

int init(void) { return(INIT_SUCCEEDED); }
int deinit() { return(0); }
void start() 
{
   Comment("I am here "+TimeToString(TimeLocal(),TIME_SECONDS));
}
To add comments, please log in or register