Difference between OnStart() and OnTick()

 
I cannot seem to understand the difference between OnStart() and OnTick() event handlers.
Documentation says OnStart() is for handling scripts while OnTick() is for handling NewTick event. But I use OnStart() to handle events for incoming new tick in my EA and it seems to be working just fine. In fact, I use start() with the void type. Can  anybody tell me their differences? Thanks in advance.
 
macpee: I cannot seem to understand the difference between OnStart() and OnTick() event handlers.
Documentation says OnStart() is for handling scripts while OnTick() is for handling NewTick event. But I use OnStart() to handle events for incoming new tick in my EA and it seems to be working just fine. In fact, I use start() with the void type. Can  anybody tell me their differences? Thanks in advance.

You are mixing things up. The old "start()" event handler is from the old (almost obsolete) ways of coding MQL4 and has nothing to do with the newer "OnStart()" of MQL4+/MQL5.

"OnTick()" handles tick events in an Expert Advisors (EA) and is called on new ticks to be processed (in MQL4+/MQL5), while the "OnStart()" is called only once when running a Script (MQL4+/MQL5) or Service (only available on MQL5).

"OnTick()" is not used in Scripts, Services nor Indicators, while "OnStart()" is not used in EAs nor Indicators.

You should not be using the old ways to code in MQL4. Stick with the more modern MQL4+ which is more compatible with MQL5.

Updated MQL4 - Language Basics - MQL4 Reference
Updated MQL4 - Language Basics - MQL4 Reference
  • docs.mql4.com
Updated MQL4 - Language Basics - MQL4 Reference
 
Fernando Carreiro #:

You are mixing things up. The old "start()" event handler is from the old (almost obsolete) ways of coding MQL4 and has nothing to do with the newer "OnStart()" of MQL4+/MQL5.

"OnTick()" handles tick events in an Expert Advisors (EA) and is called on new ticks to be processed (in MQL4+/MQL5), while the "OnStart()" is called only once when running a Script (MQL4+/MQL5) or Service (only available on MQL5).

"OnTick()" is not used in Scripts, Services nor Indicators, while "OnStart()" is not used in EAs nor Indicators.

Wow! Just imagine me. Now I understand. Thanks to you Fernando. I used to think that start() and OnStart() can be used interchangeably on EA and that I preferred using start(), not knowing that OnStart() can't even work in an EA. Now I know that start() is an old version of OnTick(). What an evolution!
But they should discontinue the use of start() to avoid confusion with Start.