//+------------------------------------------------------------------+ //| Canales.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 #define DEFGLOBAL_SIMPLE #include "..\\..\\DefGlobal.mqh" //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int8_t idx_controler_d1 = INVALID_INDEX; CCanalBar canal; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- Registramos timeframe D1 g_new_bar_manager.GetPosExecute(PERIOD_D1, idx_controler_d1); //--- int handle_pos_atr = ICTAtr_Create(_Period, _Symbol, 14, false); TSN::CAtr* atr_ptr = ICTAtr_GetAtrPointer(handle_pos_atr); //--- indicator buffers mapping canal.Create(_Symbol, _Period); canal.SetGrapich(clrBlue, clrRed, STYLE_SOLID, 1, true); canal.SetSwing(clrBlue, clrRed, "H", "L", "Arial", 7, PURE_SWINGS, 5, true); canal.Set(TSN::CreateDiffptr(TSN::MODE_DIFF_BY_ATR, _Symbol, atr_ptr, 1, 1.0)); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- ICTGen_OnDeinitEvent(reason); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- const datetime curr_time = TimeCurrent(); g_new_bar_manager.Execute(curr_time); //--- if(CNewBarManager_IsNewBarM1(g_new_bar_manager)) { //Print("Nueva vela m1"); const bool new_day = CNewBarManager_IsNewBar(g_new_bar_manager, idx_controler_d1); ICTGen_FuncionOnBarM1(new_day, curr_time); canal.OnNewBar(); } } //+------------------------------------------------------------------+