OnInit() runs once when the EA/indicator is attached, OnTick() runs on each new tick, and OnDeinit() runs when the EA is removed or terminal closes. In legacy MQL4, similar roles were init(), start(), and deinit(). These handlers are where traders code their logic for reacting to market data.