| //+------------------------------------------------------------------+
|
| //| BosChoch.mqh |
|
| //| 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 strict
|
|
|
| #ifndef ICT_LIBRARY_BOS_CHOCH_MQH
|
| #define ICT_LIBRARY_BOS_CHOCH_MQH
|
| #include "Base.mqh"
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| class CBosChoch : public CMarketStructTrend
|
| {
|
| private:
|
| int m_handle;
|
| int m_handle_swing;
|
|
|
| //---
|
| void Destroy();
|
|
|
| public:
|
| CBosChoch();
|
| ~CBosChoch();
|
|
|
| //--- Creación
|
| bool Create(string symbol_, ENUM_TIMEFRAMES timeframe_, long chart_id_ = 0, int subwin_ = 0, bool show_concept_ = true);
|
|
|
| //--- Setter principales
|
| inline void SetGrapich(color clr_choch_, color clr_bos_, color clr_choch_bajista, color clr_bos_bajista, ENUM_LINE_STYLE style_bos_choch_, int width_line = 1, int fontsize = 7, string font = "Microsoft Sans Serif");
|
| inline void Init(int16_t lenth_, color swing_low_clr, color swing_high_clr, string font_swing, int8_t font_size_swing, bool show_swings, int max_espera_bos_choch_,
|
| MODE_BUSQUEDA_SWING swing_strict_, bool is_exter_struct, int rango);
|
|
|
| //--- Override de IIctConcept
|
| inline bool ShowAll() override final;
|
| inline bool HideAll() override final;
|
| inline bool DeleteAll() override final;
|
| inline bool IsNewBarConcept() override final;
|
| inline void SetFlagMostrarObjetos(bool mostrar) override final;
|
| inline void ForzeToActulizeCurrentTick() override final;
|
| inline int Handle() const override final;
|
| inline ENUM_TIMEFRAMES Timeframe() const override final;
|
| inline string Symbol() const override final;
|
| inline long ChartId() const override final;
|
| inline int Subwin() const override final;
|
| inline bool InitialStateObj() const override final;
|
|
|
| //--- Override de CMarketStructTrend
|
| inline int EstructurasAlcistasSize() override final;
|
| inline int EstructurasBajistasSize() override final;
|
| inline MarketStruct GetEstructuraAlcista(const int index) override final;
|
| inline MarketStruct GetEstructuraAlcistaSeries(const int index) override final;
|
| inline MarketStruct GetEstructuraBajista(const int index) override final;
|
| inline MarketStruct GetEstructuraBajistaSeries(const int index) override final;
|
| inline void GetEstructuraAlcista(MarketStruct& dst[], int dst_start = 0, int src_start = 0, int count = WHOLE_ARRAY) override final;
|
| inline void GetEstructuraBajista(MarketStruct& dst[], int dst_start = 0, int src_start = 0, int count = WHOLE_ARRAY) override final;
|
| inline void GetEstructura(MarketStruct& dst_str_alcista[], MarketStruct& dst_str_bajista[], int dst_start = 0, int src_start = 0, int count = WHOLE_ARRAY) override final;
|
| inline bool NuevaRopturaAlAlza() override final;
|
| inline bool NuevaRopturaAlaBaja() override final;
|
| inline ENUM_TYPE_MARLET_STRUCT_TREND CurrentTrendEnum() override final;
|
| inline string CurrentTrendString() override final;
|
| inline void SetParo() override final;
|
| inline void OnNewBar() override final;
|
| inline int ContadorAlcista() override final;
|
| inline int ContadorBajista() override final;
|
| inline void ResetContadores() override final;
|
| inline bool InitSwingPointer() override final;
|
|
|
| //--- Funciones específicas de BosChoch
|
| inline void InitPrevSimepl();
|
| inline int GetAlcistasCreadosSize();
|
| inline int GetBajistasCreadosSize();
|
| inline MarketStruct GetAlcistasCreados(int idx);
|
| inline MarketStruct GetBajistasCreados(int idx);
|
|
|
| //--- Logging
|
| inline void AddLogFlags(const uint8_t flags) override final;
|
| void RemoveLogFlags(const uint8_t flags) override final;
|
|
|
| //--- Acceso al handle del swing
|
| inline int HandleSwing() const;
|
|
|
| //---
|
| inline ENUM_ICTLIB_CONCEPT_MARKET_STRUCT_TYPE TypeMarketStruct() const override final { return ICTBosChoch_TypeMarketStruct(m_handle); }
|
|
|
| inline uint8_t ModifyFlags() const override final { return ICTBosChoch_ModifyFlags(m_handle); }
|
| inline bool GetStateObj() const override final { return ICTBosChoch_GetStateObj(m_handle); }
|
| inline void Summary() const override final { ICTBosChoch_Summary(m_handle); }
|
| inline void ChangeChart(long new_chart_id, int new_subwin) override final { ICTBosChoch_ChangeChart(m_handle, new_chart_id, new_subwin); }
|
|
|
| };
|
|
|
| //+------------------------------------------------------------------+
|
| //| Constructor |
|
| //+------------------------------------------------------------------+
|
| CBosChoch::CBosChoch()
|
| : m_handle(INVALID_HANDLE), m_handle_swing(INVALID_HANDLE)
|
| {
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| Destructor |
|
| //+------------------------------------------------------------------+
|
| CBosChoch::~CBosChoch()
|
| {
|
| Destroy();
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| Crea el concepto BosChoch |
|
| //+------------------------------------------------------------------+
|
| bool CBosChoch::Create(string symbol_, ENUM_TIMEFRAMES timeframe_, long chart_id_ = 0, int subwin_ = 0, bool show_concept_ = true)
|
| {
|
| if(m_handle != INVALID_HANDLE)
|
| Destroy();
|
|
|
| m_handle = ICTBosChoch_Create(symbol_, timeframe_, chart_id_, subwin_, show_concept_);
|
|
|
| if(m_handle >= 0)
|
| {
|
| return true;
|
| }
|
| else
|
| {
|
| LogFatalError("No se pudo crear un handle para CBosChoch", FUNCION_ACTUAL);
|
| m_handle = INVALID_HANDLE;
|
| }
|
|
|
| return false;
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| Establece los colores y estilos de los OBJ_TREND |
|
| //| relacionados a los bos y choch |
|
| //+------------------------------------------------------------------+
|
| inline void CBosChoch::SetGrapich(color clr_choch_, color clr_bos_, color clr_choch_bajista, color clr_bos_bajista, ENUM_LINE_STYLE style_bos_choch_, int width_line = 1, int fontsize = 7, string font = "Microsoft Sans Serif")
|
| {
|
| ICTBosChoch_SetGrapich(m_handle, clr_choch_, clr_bos_, clr_choch_bajista, clr_bos_bajista, style_bos_choch_, width_line, fontsize, font);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| Inicia el bos y choch |
|
| //+------------------------------------------------------------------+
|
| inline void CBosChoch::Init(int16_t lenth_, color swing_low_clr, color swing_high_clr, string font_swing, int8_t font_size_swing, bool show_swings, int max_espera_bos_choch_,
|
| MODE_BUSQUEDA_SWING swing_strict_, bool is_exter_struct, int rango)
|
| {
|
| ICTBosChoch_Init(m_handle, lenth_, swing_low_clr, swing_high_clr, font_swing, font_size_swing, show_swings, max_espera_bos_choch_, swing_strict_, is_exter_struct, rango);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| Override IIctConcept |
|
| //+------------------------------------------------------------------+
|
| inline bool CBosChoch::ShowAll()
|
| {
|
| return ICTBosChoch_ShowAll(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline bool CBosChoch::HideAll()
|
| {
|
| return ICTBosChoch_HideAll(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline bool CBosChoch::DeleteAll()
|
| {
|
| return ICTBosChoch_DeleteAll(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline bool CBosChoch::IsNewBarConcept()
|
| {
|
| return ICTBosChoch_IsNewBarConcept(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline void CBosChoch::SetFlagMostrarObjetos(bool mostrar)
|
| {
|
| ICTBosChoch_SetFlagMostrarObjetos(m_handle, mostrar);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline void CBosChoch::ForzeToActulizeCurrentTick()
|
| {
|
| ICTBosChoch_ForzeToActulizeCurrentTick(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline int CBosChoch::Handle() const
|
| {
|
| return m_handle;
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline ENUM_TIMEFRAMES CBosChoch::Timeframe() const
|
| {
|
| return ICTBosChoch_Timeframe(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline string CBosChoch::Symbol() const
|
| {
|
| return ICTBosChoch_Simbolo(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline long CBosChoch::ChartId() const
|
| {
|
| return ICTBosChoch_ChartId(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline int CBosChoch::Subwin() const
|
| {
|
| return ICTBosChoch_Subwin(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline bool CBosChoch::InitialStateObj() const
|
| {
|
| return ICTBosChoch_GetInittialStateObj(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| Override CMarketStructTrend |
|
| //+------------------------------------------------------------------+
|
| inline int CBosChoch::EstructurasAlcistasSize()
|
| {
|
| return ICTBosChoch_EstructurasAlcistasSize(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline int CBosChoch::EstructurasBajistasSize()
|
| {
|
| return ICTBosChoch_EstructurasBajistasSize(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline MarketStruct CBosChoch::GetEstructuraAlcista(const int index)
|
| {
|
| return ICTBosChoch_GetEstructuraAlcista(m_handle, index);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline MarketStruct CBosChoch::GetEstructuraAlcistaSeries(const int index)
|
| {
|
| return ICTBosChoch_GetEstructuraAlcistaSeries(m_handle, index);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline MarketStruct CBosChoch::GetEstructuraBajista(const int index)
|
| {
|
| return ICTBosChoch_GetEstructuraBajista(m_handle, index);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline MarketStruct CBosChoch::GetEstructuraBajistaSeries(const int index)
|
| {
|
| return ICTBosChoch_GetEstructuraBajistaSeries(m_handle, index);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline void CBosChoch::GetEstructuraAlcista(MarketStruct& dst[], int dst_start = 0, int src_start = 0, int count = WHOLE_ARRAY)
|
| {
|
| ICTBosChoch_GetEstructuraAlcista(m_handle, dst, dst_start, src_start, count);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline void CBosChoch::GetEstructuraBajista(MarketStruct& dst[], int dst_start = 0, int src_start = 0, int count = WHOLE_ARRAY)
|
| {
|
| ICTBosChoch_GetEstructuraBajista(m_handle, dst, dst_start, src_start, count);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline void CBosChoch::GetEstructura(MarketStruct& dst_str_alcista[], MarketStruct& dst_str_bajista[], int dst_start = 0, int src_start = 0, int count = WHOLE_ARRAY)
|
| {
|
| ICTBosChoch_GetEstructura(m_handle, dst_str_alcista, dst_str_bajista, dst_start, src_start, count);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline bool CBosChoch::NuevaRopturaAlAlza()
|
| {
|
| return ICTBosChoch_NuevaRopturaAlAlza(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline bool CBosChoch::NuevaRopturaAlaBaja()
|
| {
|
| return ICTBosChoch_NuevaRopturaAlaBaja(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline ENUM_TYPE_MARLET_STRUCT_TREND CBosChoch::CurrentTrendEnum()
|
| {
|
| return ICTBosChoch_CurrentTrendEnum(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline string CBosChoch::CurrentTrendString()
|
| {
|
| return ICTBosChoch_CurrentTrendString(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline void CBosChoch::SetParo()
|
| {
|
| ICTBosChoch_SetParo(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline void CBosChoch::OnNewBar()
|
| {
|
| ICTBosChoch_OnNewBar(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline int CBosChoch::ContadorAlcista()
|
| {
|
| return ICTBosChoch_ContadorAlcista(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline int CBosChoch::ContadorBajista()
|
| {
|
| return ICTBosChoch_ContadorBajista(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline void CBosChoch::ResetContadores()
|
| {
|
| ICTBosChoch_ResetContadores(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline bool CBosChoch::InitSwingPointer()
|
| {
|
| return ICTBosChoch_InitSwingPointer(m_handle, m_handle_swing);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| Funciones específicas de BosChoch |
|
| //+------------------------------------------------------------------+
|
| inline void CBosChoch::InitPrevSimepl()
|
| {
|
| ICTBosChoch_InitPrevSimepl(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline int CBosChoch::GetAlcistasCreadosSize()
|
| {
|
| return ICTBosChoch_GetAlcistasCreadosSize(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline int CBosChoch::GetBajistasCreadosSize()
|
| {
|
| return ICTBosChoch_GetBajistasCreadosSize(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline MarketStruct CBosChoch::GetAlcistasCreados(int idx)
|
| {
|
| return ICTBosChoch_GetAlcistasCreados(m_handle, idx);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline MarketStruct CBosChoch::GetBajistasCreados(int idx)
|
| {
|
| return ICTBosChoch_GetBajistasCreados(m_handle, idx);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| Logging |
|
| //+------------------------------------------------------------------+
|
| inline void CBosChoch::AddLogFlags(const uint8_t flags)
|
| {
|
| CLoggerBase::AddLogFlags(flags);
|
| ICTBosChoch_AddLogFlag(m_handle, flags);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| void CBosChoch::RemoveLogFlags(const uint8_t flags)
|
| {
|
| CLoggerBase::RemoveLogFlags(flags);
|
| ICTBosChoch_RemoveLogFlag(m_handle, flags);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| Acceso al handle del swing |
|
| //+------------------------------------------------------------------+
|
| inline int CBosChoch::HandleSwing() const
|
| {
|
| return m_handle_swing;
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| Destruye el concepto |
|
| //+------------------------------------------------------------------+
|
| void CBosChoch::Destroy()
|
| {
|
| if(m_handle != INVALID_HANDLE)
|
| {
|
| ICTBosChoch_Delete(m_handle, m_handle_swing);
|
| m_handle_swing = INVALID_HANDLE;
|
| m_handle = INVALID_HANDLE;
|
| }
|
| }
|
|
|
| #endif
|
| //+------------------------------------------------------------------+
|