The OnStart() function is the Start event handler, which is
automatically generated only for running
scripts. It must be of void type, with no
For the OnStart() function, the int return
type can be specified.
The Start event is a special event
for script activation after it is loaded. This event is processed by OnStart handler. The Start event
is not send to Expert Advisors or custom indicators.
The NewTick event is generated for Expert Advisors only when a new tick for a symbol is received, to the chart of which
the Expert Advisor is attached. It's useless to define the OnTick() function in
a custom indicator or script, because the NewTick event is not generated for
The Tick event is generated only for Expert
Advisors, but this does not mean that Expert Advisors required the OnTick()
function, since not only NewTick events are generated for Expert Advisors, but
also events of Timer, BookEvent and ChartEvent are generated. It must be
declared as the void type, with no
The NewTick event is generated if
there are new quotes, it is processed by OnTick() of Expert Advisors attached. In case when
OnTick function for the previous quote is being processed when a new quote is
received, the new quote will be ignored by an Expert Advisor, because the
corresponding event will not enqueued.
All new quotes that are received while the
program is running are ignored until the OnTick() is completed. After that the
function will run only after a new quote is received. The NewTick event is
generated irrespective of whether automated trade is allowed or not
("Allow/prohibit Auto trading" button). The prohibition of automated trading
denotes only that sending of trade requests from an Expert Advisor is not
allowed, while the Expert Advisor keeps working.
The prohibition of automated trading by
pressing the appropriate button will not stop the current execution of the
OnTick() function. OnTick() is not started when the window of Expert Advisor
properties is open.
To add comments, please log in or register