- November 8, 2025
The OnTick Function
Overview In an Expert Advisor, the OnTick() function is executed automatically every time a new market tick arrives — meaning each time the Bid or Ask price changes. This makes it the central “loop” of your EA, where decisions are evaluated and orders are executed. Every trading algorithm in MQL5 depends on how efficiently OnTick() processes incoming data. What You Will Be Able to Do Code Example Execution Steps Key Point OnTick() is event-driven — it runs automatically for each market update. It’s the heart of every Expert Advisor, where signals, calculations, and trade executions are performed. Keep OnTick() efficient and lightweight to ensure your EA runs smoothly, even on fast-moving markets. Next Section → Next: Before Using OrderSend