2025-12-09 13:32:01 -05:00 | | | //+------------------------------------------------------------------+
|
| | | //| DoubleTopBottom.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-02-01 13:11:51 -05:00 | | | #define DEFGLOBAL_SIMPLE
|
2026-01-06 06:46:34 -05:00 | | | #include "..\\..\\DefGlobal.mqh"
|
| | |
|
| | | //+------------------------------------------------------------------+
|
| | | //| |
|
| | | //+------------------------------------------------------------------+
|
| | | int8_t idx_controler_d1 = INVALID_INDEX;
|
2025-12-09 13:32:01 -05:00 | | | CDoubleTopBottom g_top_buttom;
|
| | |
|
| | | //+------------------------------------------------------------------+
|
| | | //| Expert initialization function |
|
| | | //+------------------------------------------------------------------+
|
| | | int OnInit()
|
| | | {
|
2026-01-06 06:46:34 -05:00 | | | //---
|
| | | g_new_bar_manager.GetPosExecute(PERIOD_D1, idx_controler_d1);
|
| | |
|
| | | //---
|
2025-12-09 13:32:01 -05:00 | | | const int handle_pos_atr = ICTAtr_Create(_Period, _Symbol, 14, false);
|
| | |
|
| | | //--- Atr
|
2026-10-23 21:51:38 -05:00 | | | TSN::CAtr* atr_ptr = ICTAtr_GetAtrPointer(handle_pos_atr);
|
2025-12-09 13:32:01 -05:00 | | | g_top_buttom.Create(_Symbol, _Period, 0, 0, true);
|
| | |
|
| | |
|
| | | //--- Seteo del doble techo y suelo
|
| | | g_top_buttom.SetSwing(clrBlue, clrRed, "H", "L", "Arial", 11, PURE_SWINGS, 7, true); // Creacion del swing
|
| | | g_top_buttom.SetGrapich(clrBlue, clrRed, STYLE_SOLID, 2); // Seteo grafico
|
| | | g_top_buttom.SetFilterNoRopturaContraria(true); // Filtro 1
|
| | | g_top_buttom.SetFilterByUpper(3, true); // Filtro 2
|
2026-10-23 21:51:38 -05:00 | | | g_top_buttom.SetGen(TSN::CreateDiffptr(TSN::MODE_DIFF_BY_ATR, _Symbol, atr_ptr, 1, 1.0),
|
| | | TSN::CreateDiffptr(TSN::MODE_DIFF_BY_ATR, _Symbol, atr_ptr, 1, 1.0), 50); // Seteo final
|
2025-12-09 13:32:01 -05:00 | | |
|
| | |
|
| | | //---
|
| | | return(INIT_SUCCEEDED);
|
| | | }
|
| | | //+------------------------------------------------------------------+
|
| | | //| Expert deinitialization function |
|
| | | //+------------------------------------------------------------------+
|
| | | void OnDeinit(const int reason)
|
| | | {
|
| | | //---
|
2026-02-01 13:11:51 -05:00 | | | ICTGen_OnDeinitEvent(reason);
|
2025-12-09 13:32:01 -05:00 | | | }
|
| | | //+------------------------------------------------------------------+
|
| | | //| Expert tick function |
|
| | | //+------------------------------------------------------------------+
|
| | | void OnTick()
|
| | | {
|
| | | //---
|
| | | const datetime curr_time = TimeCurrent();
|
2026-01-06 06:46:34 -05:00 | | | g_new_bar_manager.Execute(curr_time);
|
2025-12-09 13:32:01 -05:00 | | |
|
| | | //---
|
2026-01-06 06:46:34 -05:00 | | | if(CNewBarManager_IsNewBarM1(g_new_bar_manager))
|
2025-12-09 13:32:01 -05:00 | | | {
|
2026-01-06 06:46:34 -05:00 | | | const bool new_day = CNewBarManager_IsNewBar(g_new_bar_manager, idx_controler_d1);
|
| | | ICTGen_FuncionOnBarM1(new_day, curr_time);
|
2025-12-09 13:32:01 -05:00 | | | g_top_buttom.OnNewBar();
|
| | | }
|
| | | }
|
| | | //+------------------------------------------------------------------+
|