//+------------------------------------------------------------------+ //| 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 ICTLIBRARYEASY_SRC_CONCEPTS_BOS_CHOCH_MQH #define ICTLIBRARYEASY_SRC_CONCEPTS_BOS_CHOCH_MQH #include "..\\Base\\Imports.mqh" //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ class CBosChoch : public CLoggerBase { 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(); inline bool HideAll(); inline bool DeleteAll(); inline bool IsNewBarConcept(); inline void SetFlagMostrarObjetos(bool mostrar) ; inline void ForzeToActulizeCurrentTick() ; inline int Handle() const ; inline ENUM_TIMEFRAMES Timeframe() const ; inline string Symbol() const ; inline long ChartId() const ; inline int Subwin() const ; inline bool InitialStateObj() const ; //--- Override de CMarketStructTrend inline int EstructurasAlcistasSize() ; inline int EstructurasBajistasSize() ; inline MarketStruct GetEstructuraAlcista(const int index) ; inline MarketStruct GetEstructuraAlcistaSeries(const int index) ; inline MarketStruct GetEstructuraBajista(const int index) ; inline MarketStruct GetEstructuraBajistaSeries(const int index) ; inline void GetEstructuraAlcista(MarketStruct& dst[], int dst_start = 0, int src_start = 0, int count = WHOLE_ARRAY) ; inline void GetEstructuraBajista(MarketStruct& dst[], int dst_start = 0, int src_start = 0, int count = WHOLE_ARRAY) ; inline void GetEstructura(MarketStruct& dst_str_alcista[], MarketStruct& dst_str_bajista[], int dst_start = 0, int src_start = 0, int count = WHOLE_ARRAY) ; inline bool NuevaRopturaAlAlza() ; inline bool NuevaRopturaAlaBaja() ; inline ENUM_TYPE_MARLET_STRUCT_TREND CurrentTrendEnum() ; inline string CurrentTrendString() ; inline void SetParo() ; inline void OnNewBar() ; inline int ContadorAlcista() ; inline int ContadorBajista() ; inline void ResetContadores() ; inline bool InitSwingPointer() ; //--- 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; }; //+------------------------------------------------------------------+ //| 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 // ICTLIBRARYEASY_SRC_CONCEPTS_BOS_CHOCH_MQH //+------------------------------------------------------------------+