Mira cómo descargar robots gratis
¡Búscanos en Twitter!
Pon "Me gusta" y sigue las noticias
Pon "Me gusta" y sigue las noticias
¿Es interesante este script?
Deje un enlace a él, ¡qué los demás también lo valoren!
Deje un enlace a él, ¡qué los demás también lo valoren!
¿Le ha gustado el script?
Evalúe su trabajo en el terminal MetaTrader 5
Evalúe su trabajo en el terminal MetaTrader 5
- Visualizaciones:
- 37
- Publicado:
-
¿Necesita un robot o indicador basado en este código? Solicítelo en la bolsa freelance Pasar a la bolsa
//+------------------------------------------------------------------+
//| JaviMomentum_v2.mq5 |
//| Copyright 2026, Javi & Miquel |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, Javi & Miquel"
#property link "https://www.mql5.com"
#property version "2.01"
#property description "Momentum indicator for XAUUSD and Forex."
#property description "Designed for IndGoldenHen N1 N2 N3 robot."
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots 2
//--- plot COMPRA
#property indicator_label1 "BUY SIGNAL"
#property indicator_type1 DRAW_ARROW
#property indicator_color1 clrLimeGreen
#property indicator_width1 4
//--- plot VENTA
#property indicator_label2 "SELL SIGNAL"
#property indicator_type2 DRAW_ARROW
#property indicator_color2 clrRed
#property indicator_width2 4
//+------------------------------------------------------------------+
//| Input parameters |
//+------------------------------------------------------------------+
input int InpEMAFast = 20; // Fast EMA Period
input int InpEMASlow = 50; // Slow EMA Period
input int InpATR = 14; // ATR Period
input string InpVarName = "VarJaviMomentum"; // Global Variable Name
input int InpMaxBars = 500; // Max History Bars (Anti-Freeze)
//--- Global variables and handles
double bufferBuy[], bufferSell[];
int hEMA20, hEMA50, hATR;
string gVarName;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
gVarName = _Symbol + "_" + InpVarName;
SetIndexBuffer(0, bufferBuy, INDICATOR_DATA);
SetIndexBuffer(1, bufferSell, INDICATOR_DATA);
PlotIndexSetInteger(0, PLOT_ARROW, 233);
PlotIndexSetInteger(1, PLOT_ARROW, 234);
hEMA20 = iMA(_Symbol, _Period, InpEMAFast, 0, MODE_EMA, PRICE_CLOSE);
hEMA50 = iMA(_Symbol, _Period, InpEMASlow, 0, MODE_EMA, PRICE_CLOSE);
hATR = iATR(_Symbol, _Period, InpATR);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &spread[],
const int &short_raw[])
{
//--- Check for minimum data (we need at least EMA Slow + 20 bars)
if(rates_total < InpEMASlow + 20) return(0);
//--- Determine calculation limit
int limit = rates_total - prev_calculated;
if(prev_calculated > 0) limit++;
if(limit > InpMaxBars) limit = InpMaxBars;
if(limit >= rates_total - 20) limit = rates_total - 21; // Safety margin
double e20[], e50[], atrVal[];
ArraySetAsSeries(e20, true);
ArraySetAsSeries(e50, true);
ArraySetAsSeries(atrVal, true);
//--- Copy indicator buffers
int copied20 = CopyBuffer(hEMA20, 0, 0, limit + 20, e20);
int copied50 = CopyBuffer(hEMA50, 0, 0, limit + 20, e50);
int copiedATR = CopyBuffer(hATR, 0, 0, limit + 20, atrVal);
if(copied20 <= 0 || copied50 <= 0 || copiedATR <= 10) return(0);
//--- Main loop
for(int i = limit; i >= 0; i--)
{
int p = rates_total - 1 - i;
if(p < 1 || p >= rates_total) continue; // Out of range protection
bufferBuy[p] = EMPTY_VALUE;
bufferSell[p] = EMPTY_VALUE;
//--- Logic checks with safe indexing
if(i + 10 >= copiedATR || i >= copied20 || i >= copied50) continue;
bool bullTrend = e20[i] > e50[i];
bool bearTrend = e20[i] < e50[i];
bool bullImpulse = close[p] > open[p] && close[p] > close[p-1];
bool bearImpulse = close[p] < open[p] && close[p] < close[p-1];
bool breakHigh = high[p] > high[p-1];
bool breakLow = low[p] < low[p-1];
//--- Volatility filter
double sumATR = 0;
for(int k=0; k<10; k++) sumATR += atrVal[i+k];
double avgATR = sumATR / 10.0;
bool volOk = atrVal[i] > avgATR;
double finalSignal = 0.0;
if(bullTrend && bullImpulse && breakHigh && volOk)
{
bool strong = (MathAbs(close[p] - open[p]) > atrVal[i]);
finalSignal = strong ? 1.1 : 1.0;
bufferBuy[p] = low[p] - (15 * _Point * 10);
}
else if(bearTrend && bearImpulse && breakLow && volOk)
{
bool strong = (MathAbs(close[p] - open[p]) > atrVal[i]);
finalSignal = strong ? 2.2 : 2.0;
bufferSell[p] = high[p] + (15 * _Point * 10);
}
if(i == 0)
{
GlobalVariableSet(gVarName, finalSignal);
Comment("SYSTEM: JAVI & MIQUEL\nVALUE: ", finalSignal);
}
}
return(rates_total);
} 
SMC Fair Value Gap (FVG) Auto-Detector
Un indicador limpio, ligero y sin repintado que detecta y dibuja automáticamente los Fair Value Gaps (FVG) de Smart Money Concepts (SMC) directamente en su gráfico en cualquier marco temporal.
MACD Tradingview version
El MACD estándar en la plataforma MT5 parece no ser suficiente así que codifico esta versión copiando del pinescript.
Accumulation/Distribution
El indicador Accumulation/Distribution (Acumulación/Distribución) queda determinado por los cambios que se producen en el precio y en el volumen.
Accelerator Oscillator (AC)
El indicador Acceleration/Deceleration (AC, Aceleración/Desaceleración) mide la aceleración y la desaceleración de la fuerza impulsora del mercado.