ICTLibraryExamples/Base/Extra/SmtDivergence/Ea.mq5
143 lines
9.9 KiB
MQL5
Nique_372
2025-12-10 13:42:49 -05:00
<EFBFBD><EFBFBD>//+------------------------------------------------------------------+
//| SmtDivergence.mq5 |
//| Copyright 2025, Niquel Mendoza. |
//| https://www.mql5.com/es/users/nique_372/news |
//+------------------------------------------------------------------+
#property copyright "Copyright 2025, Niquel Mendoza."
#property link "https://www.mql5.com/es/users/nique_372/news"
Nique_372
2026-02-01 13:11:51 -05:00
Nique_372
2025-12-10 13:42:49 -05:00
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#define DEFGLOBAL_SIMPLE
#include "Main.mqh"
//+------------------------------------------------------------------+
Nique_372
2026-01-06 06:46:34 -05:00
//| |
Nique_372
2025-12-10 13:42:49 -05:00
//+------------------------------------------------------------------+
input group "=== SMT Configuration ==="
input int16_t InpSwingBefore = 4; // Swing: Velas anteriores
Nique_372
2026-01-06 06:46:34 -05:00
input int16_t InpSwingAfter = 4; // Swing: Velas posteriores
input int InpRange = 200; // Rango de b<EFBFBD>squeda
Nique_372
2025-12-10 13:42:49 -05:00
input color InpColorBuySwing = clrBlue; // Color swing alcista
input color InpColorSellSwing = clrRed; // Color swing bajista
input group "=== S<00>mbolos a Comparar ==="
input string InpSymbol2 = "GBPUSD"; // S<EFBFBD>mbolo 2
input bool InpOpenCharts = true; // Abrir gr<EFBFBD>ficos autom<EFBFBD>ticamente
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
CSmtInterprete g_interprete(true); // Interprete
int8_t idx_controler_d1 = INVALID_INDEX;
int8_t idx_controler_curr = INVALID_INDEX;
CSmtDivergence g_smt; // Smt
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- Registramos timeframe D1
g_new_bar_manager.GetPosExecute(PERIOD_D1, idx_controler_d1);
Nique_372
2026-02-01 13:11:51 -05:00
g_new_bar_manager.GetPosExecute(_Period, idx_controler_curr);
Nique_372
2025-12-10 13:42:49 -05:00
//--- Crear concepto SMT
if(!g_smt.Create(_Symbol, _Period, 0, 0, true))
Nique_372
2026-01-06 06:46:34 -05:00
{
Nique_372
2025-12-10 13:42:49 -05:00
Nique_372
2026-01-06 06:46:34 -05:00
Print("Error: No se pudo crear CSmtDivergence");
Nique_372
2025-12-10 13:42:49 -05:00
Nique_372
2026-01-06 06:46:34 -05:00
return INIT_FAILED;
Nique_372
2025-12-10 13:42:49 -05:00
}
Nique_372
2026-01-06 06:46:34 -05:00
Nique_372
2025-12-10 13:42:49 -05:00
//--- Configurar SMT
g_smt.Set(
InpSwingBefore,
InpSwingAfter,
InpRange,
InpColorBuySwing,
InpColorSellSwing,
&g_interprete
);
//--- Agregar s<EFBFBD>mbolo principal
if(!g_smt.AddWithAutoWindow(_Symbol, false, 1, STYLE_SOLID, clrWhite))
{
Print("Error: No se pudo agregar s<00>mbolo principal");
return INIT_PARAMETERS_INCORRECT;
}