| //+------------------------------------------------------------------+
|
| //| Main.mqh |
|
| //| 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"
|
| #property strict
|
|
|
| #include "..\\..\\..\\DefGlobal.mqh"
|
|
|
| //+------------------------------------------------------------------+
|
| //| Intérprete personalizado de SMT |
|
| //+------------------------------------------------------------------+
|
| class CSmtInterprete : public ISmtInterprete
|
| {
|
| private:
|
| bool m_use_default;
|
| public:
|
| CSmtInterprete(bool use_def) : m_use_default(use_def) {}
|
| ~CSmtInterprete() {}
|
|
|
| //---
|
| bool AnalizeCurrentDivergence(
|
| const int total_symbols,
|
| const SmtDivergenceInfo& data[],
|
| int &out_idx_diverge[],
|
| int& out_res,
|
| string& txt[]
|
| ) override
|
| {
|
| if(total_symbols != 2)
|
| {
|
| LogFatalError("Solo se permiten Dos simbolos", FUNCION_ACTUAL);
|
| Remover();
|
| return false;
|
| }
|
|
|
| //---
|
| if(data[0].divergence_type != data[1].divergence_type) // Diverge
|
| {
|
| //--- Determinamos la señal
|
| // Maximos
|
| if((data[0].divergence_type == SMT_TYPE_DIVERGENCE_HH && data[1].divergence_type == SMT_TYPE_DIVERGENCE_HL)
|
| || (data[1].divergence_type == SMT_TYPE_DIVERGENCE_HH && data[0].divergence_type == SMT_TYPE_DIVERGENCE_HL))
|
| {
|
| //--- Marcamos para que se dibuje (se pone un valor mayor o igual a 0, por ejemplo aqui pondre 1)
|
| out_idx_diverge[0] = 1;
|
| out_idx_diverge[1] = 1;
|
| if(!m_use_default)
|
| {
|
| txt[0] = data[0].symbol + " Diverge";
|
| txt[1] = data[1].symbol + " Diverge";
|
| }
|
|
|
| //---
|
| out_res = 1; // Venta
|
| return true; // Divergencia
|
| }
|
| // Minimos
|
| else
|
| if((data[0].divergence_type == SMT_TYPE_DIVERGENCE_LL && data[1].divergence_type == SMT_TYPE_DIVERGENCE_LH)
|
| || (data[1].divergence_type == SMT_TYPE_DIVERGENCE_LH && data[0].divergence_type == SMT_TYPE_DIVERGENCE_LL))
|
| {
|
| //--- Marcamos para que se dibuje (se pone un valor mayor o igual a 0, por ejemplo aqui pondre 1)
|
| out_idx_diverge[0] = 1;
|
| out_idx_diverge[1] = 1;
|
| if(!m_use_default)
|
| {
|
| txt[0] = data[0].symbol + " Diverge";
|
| txt[1] = data[1].symbol + " Diverge";
|
| }
|
| //---
|
| out_res = 2; // Compra
|
| return true; // Divergencia
|
| }
|
| }
|
|
|
| //---
|
| return false;
|
| }
|
| };
|
| //+------------------------------------------------------------------+
|