ICTLibraryEasy/Examples/Base/SwingPure.mq5

61 lines
2.3 KiB
MQL5
Raw Permalink Normal View History

2025-12-10 17:38:22 -05:00
//+------------------------------------------------------------------+
//| SwingPure.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"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
2026-01-06 16:54:20 -05:00
#include "..\\Global.mqh"
2025-12-10 17:38:22 -05:00
CSwingBarPure swing;
2026-01-06 16:54:20 -05:00
int8_t idx_controler_d1 = INVALID_INDEX;
2025-12-10 17:38:22 -05:00
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
2026-01-06 16:54:20 -05:00
//---
g_new_bar_manager.GetPosExecute(PERIOD_D1, idx_controler_d1);
2025-12-10 17:38:22 -05:00
//---
MqlParam params[];
PureToParmas(5, 5, MODE_SWING_NO_STRICT, params); // Obtenemos las configuraciones del swing
swing.Create(_Symbol, _Period, 0, 0, true, params); // Segundo, crear el swing
swing.SetProperties(clrBlue, clrRed, "H", "L", "Arial", 8, 10); // Establecemos propiedades
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
ICTGen_OnDeinitEvent();
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
const datetime curr_time = TimeCurrent();
2026-01-06 16:54:20 -05:00
g_new_bar_manager.Execute(curr_time);
2025-12-10 17:38:22 -05:00
//---
2026-01-06 16:54:20 -05:00
if(CNewBarManager_IsNewBarM1(g_new_bar_manager))
2025-12-10 17:38:22 -05:00
{
2026-01-06 16:54:20 -05:00
const bool new_day = CNewBarManager_IsNewBar(g_new_bar_manager, idx_controler_d1);
ICTGen_FuncionOnBarM1(new_day, curr_time);
2025-12-10 17:38:22 -05:00
swing.OnNewBar();
}
}
//+------------------------------------------------------------------+