MQL5 Programming Basics for Expert Advisors
Learn MQL5 programming basics for Expert Advisors (EAs). This guide covers file structure, inputs, and essential functions (OnInit, OnDeinit, OnTick) to build E
Published · Updated · Methodology: Technical Indicators
Part of: Algorithmic & Automated Trading
- Methodology: Technical Indicators
- Content type: educational
- Timeframes: M1, M5, M4, M3, M2, Monthly
- Markets: Forex (Euro/Dollar, Pound/Dollar), Indices (US30, Nasdaq, S&P500), Commodities (Gold)
Source video
Decoded from: Clase 1 MQL5: 😳 Antes de Programar un EA Mira Esto 🚨 Conceptos Básicos Explicados 📘 by Bot Pulse Trading — watch the original
Key timestamps:
- 0:00 - Introduction to MQL5 course
- 3:00 - Creating a new MQL5 project
- 4:30 - Basic code structure and properties
- 6:00 - Explanation of #property and its elements (link, version, description)
- 9:00 - Use of libraries (include files)
- 10:40 - Global parameters (inputs) for modifiable settings
- 11:30 - Example of input parameters (Take Profit, Stop Loss, Lots)
- 13:00 - Adding descriptions to input parameters for clarity
- 15:00 - Grouping parameters using #property group
- 16:30 - Explanation of int OnInit() function
- 18:00 - Explanation of void OnDeinit() function
- 20:00 - Practical example of OnInit and OnDeinit with alerts
- 22:00 - Explanation of void OnTick() function
- 23:00 - Discussion on strategy complexity and effectiveness (intraday/swing trading)
- 24:00 - Market bias examples (US30, Nasdaq, S&P500, Gold)
Strategy overview
An Expert Advisor is a program that runs inside MetaTrader and makes trading decisions on the platform's own terms, which means that before any strategy logic can exist there is a file to be assembled first. This entry decodes the opening class of Bot Pulse Trading's MQL5 series, whose title tells viewers to look at something *before* programming an EA — and the session takes that literally, never reaching an entry or an exit. It spends its runtime on scaffolding instead: creating the project, the skeleton the editor generates for you, the property header that stamps a program with its link, version and description, the include files that pull in code someone else already wrote, and finally the global input parameters that expose settings to whoever runs it.
The endpoint is the interesting part. In MQL5 an input variable is the boundary between the program and the platform: values declared that way show up in the EA's settings window and can be swept by MetaTrader's Strategy Tester, while values written into the body of the code stay fixed until the file is recompiled. Deciding which numbers become inputs is therefore not a formatting habit but the moment a fixed program turns into a search space — a beginner class that ends there has, without framing it that way, handed the viewer the exact mechanism through which every later optimization, and every later overfit, will happen.
That also sets expectations for what this page carries. No indicator, entry condition or exit rule is recorded here, because the source does not contain one — this is class one of a course, and the trading logic belongs to the classes that follow. What the video offers is the file anatomy and vocabulary that make those later lessons readable: the part that is easy to skip and expensive to relearn when a compiler error, a missing library or a hardcoded value that should have been an input brings a build to a stop.
Topics
mql5 programming · expert advisor · ea development · forex trading · indices trading · commodities trading · technical indicators · algorithmic trading · tradingview strategy · mt5 programming · trading automation · coding for trading · beginner mql5
Frequently asked questions
What is an Expert Advisor in MetaTrader 5?
An Expert Advisor (EA) is a program written in MQL5, the language of the MetaTrader 5 platform, that can monitor the market and place or manage orders automatically according to the logic it contains.
What does the first class of this MQL5 course cover?
Groundwork rather than trading: how a new MQL5 project is created, the basic structure of the generated code, the property header used to document the program, how libraries are brought in with include files, and how global input parameters make settings adjustable.
Why do input parameters matter when programming an EA?
Anything declared as an input can be changed from the EA's settings window without recompiling, and can be varied by MetaTrader's Strategy Tester during optimization. Values hardcoded inside the code cannot — so the choice of which parameters to expose defines what can be tested and tuned later.
Does this entry contain a tradeable strategy?
No — the source is a programming lesson that stops before any entry or exit logic is written, so there are no rules or indicators to extract from it. Strategy Decoder catalogues sources like this alongside the strategy videos it decodes, so the educational material and the tradeable setups stay distinguishable.
About this strategy page
This trading strategy was decoded by Strategy Decoder's AI from a public YouTube trading video and turned into a structured, reviewable specification. In the interactive app this page shows the full entry and exit logic, risk management settings, the indicators involved with their parameters, AlgoWizard-compatible logic and a Pine Script export ready for TradingView backtesting — plus an automated backtest verdict when one has been computed for this strategy.
Strategy Decoder catalogs 2,229 decoded strategies. Each one is extracted with confidence scoring, cross-linked to the indicators it uses, and kept up to date as new videos are processed daily. Load this page with JavaScript enabled to use the interactive tools, or start from the strategy explorer to filter by methodology, market and timeframe.
Other versions of this strategy
- Thanksgiving Trading Strategy — Quantified Strategies
- Trading Robot Automation, Strategy Selection — Tradesfera
- Python, Binance API, Cryptocurrencies — Hobbiecode
- Williams %R Strategy — Quantified Strategies
- Robust Parametric Zone, Over-optimization — Bfunded EA
- Middle Of Week Mini S&P Strategy — Algo Trading With Kevin Davey