⬡ TUTORIAL PASSO A PASSO · READ 12 MIN

How to install e configurar um bot (EA) no MetaTrader 5.

Do arquivo do bot until ele operando em demo account — incluindo backtest no Strategy Tester, optimization without cair em overfitting e por that you vai querer uma VPS. Com diagramas da interface.

By RoboTraderIA Team· updated may/2026· nível iniciante

You have an Expert Advisor (EA) — whether you coded it, downloaded from our bot grátis, or purchased — and now need to get it running on MetaTrader 5. This tutorial covers the complete process, from scratch, with attention to the details that trip up beginners (the famous "I installed it but the bot won't trade"). From file to backtest to deploy.

Prerequisite: you need MT5 installed (downloaded from your broker, not the generic site — you need the right broker's server) and the EA file, with extension .ex5 (compiled) or .mq5 (source code). If you haven't chosen a broker yet, see our reviews of brokers with MT5.

01Step 1: Colocar o EA na pasta certa

MT5 only sees bots in the correct data folder. The safest way to find it:

AAbrir a data folder

In MT5, go to File → Open Data Folder. This opens the file explorer exactly at the folder MT5 uses — avoids the common mistake of placing the EA in the wrong installation folder.

MetaTrader 5 — menu Arquivo
Novo Gráfico Abrir Conta Abrir Pasta de Dados ← Imprimir 📁 MQL5 📁 Experts ← coloque o EA aqui 📁 Indicators 📁 Scripts
BCopiar para MQL5 / Experts

In the folder that opened, go to MQL5 → Experts and paste your bot file (.ex5 ou .mq5). If it's an indicator, it goes in Indicators; if it's a script, in Scripts.

CAtualizar o Navegador

Go back to MT5. In the Navigator panel (Ctrl+N if not visible), right-click on "Expert Advisors" and choose Refresh. Your bot should appear in the list.

02Step 2: Habilitar o Auto Trading

This is the step that most generates "my bot does nothing". MT5 has a master automated trading button that needs to be green/on. Without it, the EA loads on the chart but sends no orders.

Barra de ferramentas MT5
Algo Trading ← deve estar VERDE. Se estiver vermelho, clique para ativar.

The button is in the top toolbar, called "Algo Trading" (or "Auto Trading" in older versions). Green = on. Red = off. Click to toggle.

Two permission levels: besides the global button, each EA has its own permission. When dragging the bot onto the chart (next step), in the "Common" tab check "Todosow automated trading". Both need to be active.

03Step 3: Arrastar o EA for the chart

Open the chart of the asset you want to trade (e.g., WIN, EURUSD). In the Navigator, drag the EA onto the chart (or double-click). A configuration window will open.

1Aba "Comum"

Check "Todosow automated trading". The other options (allow DLL import etc.) are generally left unchecked for security, unless the bot requires it.

2Aba "Parâmetros de entrada"

Here are the bot's variables (lot size, stop, take, moving average period etc.). Configure according to your strategy. Always start with minimum lot.

3Confirmar

Click OK. If everything went right, a smiley face 🙂 appears in the upper right corner of the chart — it means the EA is active. If you see a 🙁 or ✗, auto trading is not enabled at some level.

Green light of success: the EA icon in the chart corner smiling + the bot's name next to it. If you see this, the bot is monitoring the market and will trade according to its rules.

04Step 4: Backtest no Strategy Tester (ANTES de operar)

This step is non-negotiable. Never run an EA on a live account without first testing it on historical data. MT5 has a built-in simulator — the Strategy Tester — that runs your bot on years of past data in seconds.

Open with View → Strategy Tester (or Ctrl+R). Configure:

  • Expert: selecione seu bot
  • Símbolo: o ativo (ex: WIN, EURUSD)
  • Período: o timeframe (M5, M15, H1...)
  • Intervalo de datas: use no mínimo 2-3 anos, abrangendo alta, baixa e lateralização
  • Modelagem: "Cada tick baseado em ticks reais" é o mais preciso (e mais lento)
Strategy Tester — resultado de backtest
Curva de capital (equity) drawdown Lucro: +R$ 4.280 DD máx: 12% Trades: 1.204 Acerto: 58%

Read the drawdown, not just the profit: a curve that rises nicely but with 40% drawdown is a ticking bomb — it means at some point you'd lose 40% of the account. Look for low drawdown (ideally below 20% for small traders) with relatively smooth equity curve. A "too good" curve, perfect straight line, is usually a sign of overfitting.

05Step 5: Otimização (com cuidado redobrado)

The Strategy Tester also optimizes — tests hundreds of parameter combinations to find the "best". It's powerful and dangerous in equal measure. The risk is overfitting: you find parameters that would have been perfect in the past, but fail in the future because they were fitted to noise, not signal.

How to optimize without fooling yourself:

  1. Divida os dados: otimize em 70% do período (in-sample) e valide nos 30% restantes (out-of-sample) que o bot never "viu".
  2. Be suspicious of picos isolados: se um conjunto de parâmetros lucra very mais que seus vizinhos, é sorte estatística, não robustez. Prefira regiões amplas de parâmetros que funcionam de forma parecida.
  3. Menos é mais: bot com 3 parâmetros otimizáveis é mais robusto que um com 15. Cada parâmetro extra is a chance a mais de overfit.

Ainda doesn't have um bot for instalar?

Download our sample EA, commented line by line, ready to run in this tutorial.

Baixar bot grátis →

06Passo 6: VPS — why seu bot precisa

Aqui está o que separa hobby de operação séria. If you roda o EA no seu computador pessoal, o bot só funciona while a máquina estiver ligada, com internet, e o MT5 aberto. Caiu a luz? Dormiu e desligou o PC? Internet oscilou? O bot para — possivelmente com uma posição aberta without gerenciamento.

A solução is a VPS (Virtual Private Server) — um computador na nuvem, ligado 24/7, where seu MT5 roda ininterruptamente. Advantages:

  • Disponibilidade 24/5 (o mercado forex opera 24h em dias úteis)
  • Latência baixa — VPS perto do servidor da broker executa ordens mais rápido
  • Independência da sua máquina — can desligar o PC, o bot segue

Muitas brokers oferecem VPS grátis for those who trade volume mínimo. Alternativamente, há VPS especializadas em forex a partir de poucos dólares por mês. Pra HFT/scalping, escolha VPS na mesma região do servidor da broker (geralmente Londres ou Nova York).

07Checklist final before de ir for the real

Antes de deixar o bot operar dinheiro truly, confirme:

  • ☐ Backtest de 2-3 anos com drawdown aceitável (<20%)
  • ☐ Validação out-of-sample (testou em dados não otimizados)
  • ☐ Rodou em demo account por by the menos 1 mês
  • ☐ Comportamento na demo bate com o backtest
  • ☐ Auto trading habilitado nos dois níveis (global + EA)
  • ☐ Lote configurado no mínimo
  • ☐ VPS configurada (se for operar sério)
  • ☐ Você entende o que o bot faz e when ele para

08Preguntas frecuentes

Meu EA não está operando, o que fazer?

Verifique nesta ordem: (1) botão "Algo Trading" verde na barra; (2) na configuração do EA, "Permitir negociação automatizada" marcado; (3) rostinho sorridente 🙂 no canto do chart; (4) o mercado está aberto; (5) os parâmetros do bot fazem sentido (lote > 0). O problema quase always está no item 1 ou 2.

What is the difference between .ex5 e .mq5?

.mq5 é o código-fonte (você can editar e compile). .ex5 é o arquivo compilado (executável, não-editável). Ambos rodam no MT5; if you tem só o .mq5, o MT5 compila automaticamente for .ex5 ao carregar.

Preciso pagar por uma VPS?

Não necessariamente. Muitas brokers oferecem VPS grátis if you mantém volume ou saldo mínimo. Se não, VPS de forex custam a partir de poucos dólares mensais. Pra quem opera só em horário comercial e fica de olho, dá for começar without VPS — but for operação 24/5 ela é praticamente obrigatória.

Posso rodar o bot no mini index (WIN)?

Sim, since que sua broker ofereça MT5 com acesso à B3. Aí você abre o chart do WIN/WDO e roda o EA normalmente. Veja nosso guia de day trading na B3 for entender o mercado.

O backtest garante que vou lucrar?

Não. Backtest mostra como o bot teria se comportado no passado — é necessário, but não suficiente. Mercado futuro difere do passado. That's why a demo account por 1 mês é essencial: ela testa o bot em condições reais e atuais before de você arriscar capital.

Coloque um bot for rodar hoje

Baixe nosso EA de exemplo (Python + MQL5) e siga este tutorial passo a passo.

Baixar bot grátis →