ICTLibraryEasy/Examples/Base/BosChoch.mq5
Nique_372 097959f1b1
2026-01-06 16:54:20 -05:00

76 lines
3 KiB
MQL5

//+------------------------------------------------------------------+
//| BosChoch.mq5 |
//| Copyright 2025, Leo. |
//| https://www.mql5.com/es/users/nique_372/news |
//+------------------------------------------------------------------+
#property copyright "Copyright 2025, Leo."
#property link "https://www.mql5.com/es/users/nique_372/news"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#include "..\\Global.mqh"
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int8_t idx_controler_d1 = INVALID_INDEX;
CBosChoch bos_choch;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
g_new_bar_manager.GetPosExecute(PERIOD_D1, idx_controler_d1);
//--- Creacion del bos choch
bos_choch.Create(_Symbol, _Period);
bos_choch.SetGrapich(clrBlue, clrBlue, clrRed, clrRed, STYLE_DOT);
bos_choch.Init(4, clrBlue, clrRed, "Arial", 7, true, 30, MODE_SWING_NO_STRICT, false, 500);
//---Test para obtener el swing usado y modificarlo (CUIDADO)
bos_choch.InitSwingPointer(); // Inciilizamos puntero interno
CSwingBarDefault swing; // Default
swing.CreateByHandle(bos_choch.HandleSwing()); // Creacion
Print("Tipo de swing usado: ", EnumToString(swing.TypeSwing())); // Tipo de swing usado
#define BoolToStr(b) (b ? "true" : "false")
PrintFormat("Swing length = %d | Swing state = %s", swing.LenthAntes(), BoolToStr(swing.InitialStateObj())); // 4 - false
// Cambaimso el clor de los swings (high)
swing.SwingHighColor(clrAliceBlue);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
ICTGen_OnDeinitEvent();
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
const datetime curr_time = TimeCurrent();
g_new_bar_manager.Execute(curr_time);
//---
if(CNewBarManager_IsNewBarM1(g_new_bar_manager))
{
const bool new_day = CNewBarManager_IsNewBar(g_new_bar_manager, idx_controler_d1);
ICTGen_FuncionOnBarM1(new_day, curr_time);
bos_choch.OnNewBar();
}
}
//+------------------------------------------------------------------+