Client Terminal Events
Init
Triggered after program load, global variable initialization.
Also triggered by: financial instrument/timeframe change, recompilation, input parameter change, account change (for EAs).
Handled by OnInit().Deinit
Triggered before global variable deinitialization and program unload.
Also triggered by: client terminal close, chart close, security/timeframe change, successful recompilation, input parameter change, account change.
Handled by OnDeinit(). Parameter provides deinitialization reason.
Execution restricted to 2.5 seconds; forcibly terminated if exceeded.Start
Special event for script activation after loading.
Handled by OnStart().
Not sent to Expert Advisors or custom indicators.NewTick
Generated upon receiving new quotes.
Handled by OnTick() for Expert Advisors.
New quotes are ignored if OnTick() is currently processing a previous quote.
Events are not enqueued; new quotes received during OnTick() execution are ignored until OnTick() completes.
Generated regardless of automated trading status.Calculate
Generated only for indicators.
Triggered after Init event and upon any price data change.
Handled by OnCalculate().Timer
Periodically generated for Expert Advisors that activate timers using EventSetTimer() (typically in OnInit).
Handled by OnTimer().
Timers must be destroyed using EventKillTimer() (typically in OnDeinit).Tester
Generated after Expert Advisor testing on historical data concludes.
Handled by OnTester().ChartEvent
Generated by user interaction with a chart:
- Keystroke (chart window in focus)
- Graphical object creation/deletion
- Mouse press/move on a graphical object
- End of text editing in LabelEdit
Can be a custom event sent via EventChartCustom().
Handled by OnChartEvent().