Specifiche
ESPECIFICAÇÃO TÉCNICA – EA MT5 RENKO COM CONFLUÊNCIA + MARTINGALE POR BLOCOS
-
Objetivo
Desenvolver um Expert Advisor para MetaTrader 5 que opere em gráficos Renko, executando ordens apenas quando houver confluência entre 5 indicadores, sempre negociando na direção da tendência.
As entradas devem ocorrer apenas na abertura do próximo candle/bloco após a confirmação de todos os sinais.
-
Indicadores Utilizados
Indicadores:
Gold Stuff (ex5)
Gann (ex5)
EMA Levels (ex5)
Color RSI (mq5)
Trend Cycle (mq5)
Observação:
Somente Color RSI e Trend Cycle possuem código fonte.
Os demais indicadores são arquivos EX5.
O desenvolvedor deverá:
Mapear buffers via iCustom + CopyBuffer
Caso não haja buffers, mapear objetos gráficos (setas, cores, etc.)
-
Lógica Geral de Operação
Operar somente na direção da tendência
Entrada apenas quando TODOS os sinais alinharem
Execução sempre na abertura do próximo candle/bloco
-
Regras dos Indicadores
4.1 Gold Stuff (ex5)
Seta azul para cima → Gatilho de compra
Seta vermelha para baixo → Gatilho de venda
4.2 Gann (ex5)
Candle/Bloco verde → Gatilho de compra
Candle/Bloco vermelho → Gatilho de venda
Candle/Bloco cinza → Neutro (aguardar)
O indicador possui 66 tipos de médias móveis configuráveis.
Todos os parâmetros devem estar disponíveis na EA.
4.3 EMA Levels (ex5)
Linha verde → Gatilho de compra
Linha laranja → Gatilho de venda
Linha cinza → Neutro
4.4 Color RSI (mq5)
RSI acima de 60 (configurável) + linha verde → Compra
RSI abaixo de 40 (configurável) + linha vermelha → Venda
4.5 Trend Cycle (mq5)
Linha verde → Compra
Linha laranja → Venda
Linha cinza → Neutro
-
Confluência Obrigatória
Compra
Gold Stuff = Compra
Gann = Verde
EMA Levels = Verde
Color RSI > 60 e verde
Trend Cycle = Verde
Novo brick Renko de alta
Venda
Gold Stuff = Venda
Gann = Vermelho
EMA Levels = Laranja
Color RSI < 40 e vermelho
Trend Cycle = Laranja
Novo brick Renko de baixa
-
Martingale por Blocos
O EA deve implementar martingale em blocos com fechamento coletivo.
Funcionamento:
Abrir primeira ordem com lote inicial
Abrir novas ordens conforme o preço se move contra a posição
Cada bloco contém N ordens
Após completar o bloco, o próximo bloco multiplica o lote
Fechamento coletivo baseado no preço médio
Parâmetros:
Tamanho_Bloco
Multiplicador_Bloco
Step_Entre_Ordens
-
Gestão de Take Profit
Take Profit Individual
Cada ordem terá um TP fixo em pontos.
Take Profit Médio
Se existir mais de uma ordem:
Fechar todas quando o lucro atingir:
Quantidade de ordens × TP_Pontos
Baseado no preço médio das posições.
-
Parâmetros Editáveis
Indicadores
Todos os parâmetros editáveis, exceto Gold Stuff
Gestão de Ordens
Lote_Inicial
TP_Pontos
TP_Financeiro
Stop_Global
Max_Ordens
Spread_Maximo
Numero_Magico
Martingale
Tamanho_Bloco
Multiplicador_Bloco
Step_Entre_Ordens
Risco
Modo_Lote (Fixo / Percentual)
Risco_Percentual
Controle de Horário
Horario_Inicio
Horario_Fim
Dias_Ativos
Funcionalidades Extras
Trailing_Stop_Ativo
Breakeven_Ativo
Painel_Ativo
Mostrar_Indicadores_No_Grafico
-
Painel Informativo
Exibir no gráfico:
Saldo
Patrimônio
Lotes atuais
Próximo lote
Preço médio
Lucro atual
Alvo de fechamento (pontos)
Alvo financeiro
Bloco atual
Próximo multiplicador
-
Requisitos Técnicos
Operar apenas em candle fechado (shift 1)
Evitar repaint
Apenas um ciclo por sinal
Compatível com gráfico Renko
Logs de depuração
Código comentado
Mapear buffers, se não houver, mapear objetos gráficos
-
Compatibilidade com Gráfico Renko (Símbolo Sintético)
O gráfico Renko pode gerar símbolos sintéticos com sufixos:
XAUUSD.R200tks
XAUUSD_renko
XAUUSD.r
XAUUSD,M2
A corretora aceita ordens apenas no símbolo real.
O EA deve:
Ler preços do gráfico Renko
Detectar símbolo base
Enviar ordens no símbolo real
Manter lógica baseada no Renko
Extração do Símbolo Base
Remover qualquer sufixo após:
"."
"_"
","
Exemplos:
XAUUSD.R200 → XAUUSD
XAUUSD_renko → XAUUSD
XAUUSD.r → XAUUSD
XAUUSD,M2 → XAUUSD
Variáveis Internas
ChartSymbol → símbolo do gráfico
TradeSymbol → símbolo utilizado para enviar ordens
Parâmetro Manual Opcional
input string TradeSymbol = "";
Lógica:
Se vazio → detectar automaticamente
Se preenchido → usar valor manual
Compatibilidade com Prefixos
Deve funcionar com:
m.XAUUSD
XAUUSDm
XAUUSD.pro
O algoritmo deve preservar prefixos e remover apenas sufixos Renko.
Comportamento Esperado
Gráfico Renko:
XAUUSD.R200tks
EA lê sinais do Renko
EA envia ordens em:
XAUUSD
Regra Obrigatória
Toda leitura → ChartSymbol
Toda execução → TradeSymbol
-
Regra de Reset de Confluência
O EA deve abrir apenas uma ordem por ciclo de confluência.
Se um ou mais indicadores saírem da confluência e posteriormente retornarem à confluência total, duas situações devem ser tratadas:
Caso 1 — Existe ordem aberta
Se já houver uma posição aberta, o EA deve:
NÃO abrir uma nova ordem
Aguardar o fechamento da ordem atual (ou grupo de ordens)
Somente após o fechamento, avaliar novas entradas
Caso 2 — Não existem ordens abertas
Se não houver posições abertas e os indicadores retornarem à confluência total:
O EA deve abrir uma nova ordem normalmente
A ordem deve seguir a mesma direção da última operação encerrada
Isso só é permitido se a confluência tiver sido quebrada anteriormente e depois restabelecida
Regra Importante
Apenas uma ordem por ciclo de confluência.
O EA deve:
Detectar confluência total
Abrir operação
Ignorar sinais enquanto a confluência permanecer ativa
Aguardar pelo menos um indicador sair da confluência
Detectar nova confluência
Somente então permitir nova operação
Resumo
Confluência aparece → Abrir operação
Confluência continua → Não fazer nada
Confluência quebra → Aguardar
Confluência retorna →
Se houver operação aberta → aguardar fechamento
Se não houver operação → abrir nova operação
Isso evita múltiplas entradas durante a mesma condição de confluência.
-
Parâmetro de Ativação Individual dos Indicadores
O EA deve possuir parâmetros independentes para ativar ou desativar cada indicador utilizado na lógica de confluência.
Isso permitirá ao usuário testar diferentes combinações sem necessidade de alterar o código.
Parâmetros:
Use_GoldStuff = true
Use_Gann = true
Use_EMA_Levels = true
Use_Color_RSI = true
Use_Trend_Cycle = true
Lógica de Funcionamento
Se o indicador estiver ativado (true):
→ Ele será considerado na regra de confluência.
Se o indicador estiver desativado (false):
→ Ele será ignorado completamente na validação de entrada.
Exemplo
Se apenas 3 indicadores estiverem ativos, a confluência será validada somente entre os indicadores ativos.
Regra de Confluência Dinâmica
O EA deve:
-
Verificar quais indicadores estão ativos
-
Considerar apenas os ativos
-
Exigir alinhamento apenas entre os ativos
-
Ignorar totalmente os desativados
Exemplo Prático
Ativos:
Use_GoldStuff = true
Use_Gann = true
Use_EMA_Levels = false
Use_Color_RSI = true
Use_Trend_Cycle = false
Confluência exigida apenas entre:
Gold Stuff
Gann
Color RSI
Benefícios
Permite otimização
Permite backtests mais rápidos
Permite estratégias híbridas
Facilita testes A/B
1. Objective
Develop an Expert Advisor for MetaTrader 5 that operates on Renko charts, executing orders only when there is confluence between 5 indicators, always trading in the direction of the trend.
Entries must occur only at the opening of the next candle/brick after confirmation of all signals.
2. Indicators Used
Indicators:
-
Gold Stuff (ex5)
-
Gann (ex5)
-
EMA Levels (ex5)
-
Color RSI (mq5)
-
Trend Cycle (mq5)
Note:
Only Color RSI and Trend Cycle have source code.
The other indicators are EX5 files.
The developer must:
-
Map buffers via iCustom + CopyBuffer
-
If buffers are not available, map graphical objects (arrows, colors, etc.)
3. General Trading Logic
-
Trade only in the direction of the trend
-
Entry only when ALL signals align
-
Execution always at the opening of the next candle/brick
4. Indicator Rules
4.1 Gold Stuff (ex5)
Blue arrow up → Buy trigger
Red arrow down → Sell trigger
4.2 Gann (ex5)
Green candle/brick → Buy trigger
Red candle/brick → Sell trigger
Gray candle/brick → Neutral (wait)
The indicator has 66 configurable moving average types.
All parameters must be available in the EA.
4.3 EMA Levels (ex5)
Green line → Buy trigger
Orange line → Sell trigger
Gray line → Neutral
4.4 Color RSI (mq5)
RSI above 60 (configurable) + green line → Buy
RSI below 40 (configurable) + red line → Sell
4.5 Trend Cycle (mq5)
Green line → Buy
Orange line → Sell
Gray line → Neutral
5. Mandatory Confluence
Buy
Gold Stuff = Buy
Gann = Green
EMA Levels = Green
Color RSI > 60 and green
Trend Cycle = Green
New bullish Renko brick
Sell
Gold Stuff = Sell
Gann = Red
EMA Levels = Orange
Color RSI < 40 and red
Trend Cycle = Orange
New bearish Renko brick
6. Block Martingale
The EA must implement martingale in blocks with collective closing.
Operation:
-
Open first order with initial lot
-
Open new orders as price moves against position
-
Each block contains N orders
-
After completing a block, next block multiplies lot
-
Collective closing based on average price
Parameters:
Block_Size
Block_Multiplier
Step_Between_Orders
7. Take Profit Management
Individual Take Profit
Each order will have a fixed TP in points.
Average Take Profit
If more than one order exists:
Close all when profit reaches:
Number of orders × TP_Points
Based on the average position price.
8. Editable Parameters
Indicators
All parameters editable except Gold Stuff
Order Management
Initial_Lot
TP_Points
TP_Financial
Global Stop
Max_Orders
Max_Spread
Magic_Number
Martingale
Block_Size
Block_Multiplier
Step_Between_Orders
Risk
Lot Mode (Fixed / Percent)
Risk_Percent
Time Control
Start_Time
End_Time
Active_Days
Extra Features
Trailing_Stop_Enabled
Breakeven_Enabled
Panel_Enabled
Show Indicators on Chart
9. Information Panel
Display on chart:
Balance
Equity
Current lots
Next lot
Average price
Current profit
Closing target (points)
Financial target
Current block
Next multiplier
10. Technical Requirements
-
Trade only on closed candle (shift 1)
-
Avoid repainting
-
Only one cycle per signal
-
Compatible with Renko chart
-
Debug logs
-
Commented code
-
Map buffers, if not available, map graphical objects
11. Renko Chart Compatibility (Synthetic Symbol)
Renko charts may generate synthetic symbols with suffixes:
XAUUSD.R200tks
XAUUSD_renko
XAUUSD.r
XAUUSD,M2
The brokers accept orders only on the real symbol.
The EA must:
-
Read prices from the Renko chart
-
Detect base symbol
-
Send orders on the real symbol
-
Maintain logic based on Renko
Base Symbol Extraction
Remove any suffix after:
"."
"_"
","
Examples:
XAUUSD.R200 → XAUUSD
XAUUSD_renko → XAUUSD
XAUUSD.r → XAUUSD
XAUUSD,M2 → XAUUSD
Internal Variables
ChartSymbol → chart symbol
TradeSymbol → symbol used to send orders
Optional Manual Parameter
input string TradeSymbol = "";
Logic:
-
If empty → auto-detect
-
If filled → use manual value
Prefix Compatibility
Must work with:
m.XAUUSD
XAUUSDm
XAUUSD.pro
The algorithm must preserve prefixes and remove only Renko suffixes.
Expected Behavior
Renko chart:
XAUUSD.R200tks
EA reads Renko signals
EA ships orders on:
XAUUSD
Mandatory Rule
All reading → ChartSymbol
All execution → TradeSymbol
The EA must open only one order per confluence cycle.
If one or more indicators leave confluence and later return to full confluence again, two situations must be handled:
Case 1 — There is an open order
If a position is already open, the EA must:
-
Do NOT open a new order.
-
Wait for the current order (or group of orders) to be closed
-
Only after closing, the EA can evaluate new entries
Case 2 — There are no open orders
If there are no open positions and the indicators return to full confluence:
-
The EA must open a new order normally
-
The order must follow the same direction of the previous closed trade
-
This is allowed only if confluence was previously broken and then restored
Important rule
Only one order per confluence cycle.
The EA must:
-
Detect full confluence
-
Open a trade
-
Ignore signals while confluence remains active
-
Wait for at least one indicator to leave confluence
-
Detect new confluence again
-
Only then allow a new trade
Summary
Confluence appears → Open trade
Confluence remains → Do nothing
Confluence breaks → Wait
Confluence returns →
-
If trade open → wait close
-
If no trade → open new trade
This prevents multiple entries during the same confluence condition.
-
Individual Indicator Enable Parameter
The EA must include independent parameters to enable or disable each indicator used in the confluence logic.
This allows the user to test different combinations without modifying the code.
Parameters:
Use_GoldStuff = true
Use_Gann = true
Use_EMA_Levels = true
Use_Color_RSI = true
Use_Trend_Cycle = true
Logic
If the indicator is enabled (true):
→ It will be considered in the confluence rule.
If the indicator is disabled (false):
→ It will be completely ignored in the entry validation.
Example
If only 3 indicators are enabled, the confluence will be validated only among the active indicators.
Dynamic Confluence Rule
The EA must:
-
Check which indicators are enabled
-
Consider only the enabled ones
-
Require alignment only among the enabled indicators
-
Completely ignore disabled indicators
Practical Example
Enabled:
Use_GoldStuff = true
Use_Gann = true
Use_EMA_Levels = false
Use_Color_RSI = true
Use_Trend_Cycle = false
Confluence required only between:
Gold Stuff
Gann
Color RSI
Benefits
Allows optimization
Allows faster backtests
Enables hybrid strategies
Facilitates A/B testing