| //+------------------------------------------------------------------+
|
| //| Swings.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 ICTLIBRARY_CONCEPTS_SWING_SWINGS_MQH
|
| #define ICTLIBRARY_CONCEPTS_SWING_SWINGS_MQH
|
| #include "..\\Base.mqh"
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| //Flujo de trabajo:
|
| //La clase CSwingBar, consta unicamente de la obtencion de swings y dibujado, esto que se ejecuta a cada nueva vela (OnNewBar)
|
|
|
| //--- Declaracion previa
|
| class CSwingBarPure;
|
| class CSwingBarZigZag;
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| class CSwingBar : public IIctConcept
|
| {
|
| protected:
|
| int m_handle_real; // Handle real al array de ISwings
|
| int m_handle; // Handle especifico
|
| bool m_delete;
|
|
|
| public:
|
| CSwingBar();
|
| ~CSwingBar() { Destroy(); }
|
|
|
| //--- Creacion
|
| virtual void Create(string symbol, ENUM_TIMEFRAMES timeframe, long chart_id, int subwin, bool show_concept, MqlParam ¶metros[]) = 0;
|
|
|
| //---
|
| void CreateByHandle(int handle_real, int handle_especifico = INVALID_HANDLE);
|
|
|
|
|
| //--- Destruccion
|
| virtual bool Destroy(); // Destruye el swing, luego de esto hara falta crear un nuevo swing
|
|
|
| //---
|
| inline void SetProperties(color color_buy_swing, color color_sell_swing, string text_buy_swing_, string text_sell_swing_,
|
| string font_ = "Arial", int8_t font_size_ = 7, int max_elements_array_ = ADD_ALL);
|
| inline void OnNewBar(); // Ejecuta la logica principal
|
| inline bool GetSwingPrev(const int range_obtencion); // Obtiene swing previos
|
|
|
| //--- Trabajo con los swings
|
| inline Swings GetSwingsAlcistas(const int pos_idx); // Obtiene un swing alcista en base a su posicion
|
| inline Swings GetSwingsBasjitas(const int pos_idx); // Obtiene un swingf bajista en base a su posicion
|
| inline int SizeSwingAlcistas(); // Obtiene el tamaño total de swings alcistas
|
| inline int SizeSwingBajistas(); // Obtiene el tamaño total de swings bajistas
|
|
|
| //--- GetCloset obtener el mas cercano
|
| // Obtiene el indice (pos) de un swing alcista cercano con el modo mode a tagerget_time
|
| inline int GetCloseSwingAlcistaIndex(datetime target_time, MODE_CLOSET_INDEX mode);
|
|
|
| // Obtiene el indice (pos) de un swing bajista cercano con el modo mode a tagerget_time
|
| inline int GetCloseSwingBajistaIndex(datetime target_time, MODE_CLOSET_INDEX mode);
|
|
|
| // Obtiene el indice (pos) del swing mas cercano con el modo "mode" a target_time, ademas de devolver el tipo de swing
|
| // "tipo", puede ser a (swing alcista), o b (swing bajista)
|
| inline int GetCloseSwingIndex(datetime target_time, MODE_CLOSET_INDEX mode, string &tipo);
|
|
|
| //--- Comprobacion de la creacion de un swing
|
| inline bool HayUnNuevoSwing(); // Devuelve true si se creo un nuevo swing para la nueva vela
|
|
|
| // Devuelve el indice (podra ser consultado con GetSwingAlcista.. o GetSwingBa...) si se creo un nuevo swing del tipo
|
| // type, si no se creo u swing para dicho tipo devolvera -1
|
| inline int HayUnNuevoSwing(ENUM_TYPE_SWING type);
|
|
|
|
|
| //--- Mas cercano
|
| // Devuelve el swing mas cercano por precio y tiempo (el mas cercano el tiempo actual, osea el swing mas reciente)
|
| // Ideal para dibujar Fibbo
|
| inline Swings GetSwingLowMasCeracanoPorPrecioYTime(double target_price, ENUM_TYPE_CERCANOS_SWING mode);
|
| inline Swings GetSwingHighMasCeracanoPorPrecioYTime(double target_price, ENUM_TYPE_CERCANOS_SWING mode);
|
|
|
| //--- Setter y Getter generales
|
| // Minima cantidad de elementos | Para el array interno swings alcista y swwings bajistas, por defecto 0, util
|
| // Si es que siempre se necesita que las funciones de obtencion de data devuelvan un valor..
|
| inline void MiniumElement(int min); // Setter, establece dicho valor (elementos minimos)
|
| inline int MiniumElement(); // Getter, obtiene dicho valor (elementos minimos)
|
|
|
| // Color del swing high | Si se cambia el color, NO SE ACTULIZARA LAS PROPIEDADES
|
| // de los swings existentes.. osea que el cambio de color se vera
|
| // reflejado en el siguiente swing creado luego del cambio del color
|
| inline void SwingHighColor(color new_value);
|
| inline color SwingHighColor();
|
|
|
| // Color del swing low | Si se cambia el color, NO SE ACTULIZARA LAS PROPIEDADES
|
| // de los swings existentes.. osea que el cambio de color se vera
|
| // reflejado en el siguiente swing creado luego del cambio del color
|
| inline void SwingLowColor(color new_value);
|
| inline color SwingLowColor();
|
|
|
| //- Lenth
|
| inline int LenthAntes() { return ICTSwing_LenthAntes(m_handle_real); }
|
| inline int LenthDespues() { return ICTSwing_LenthDespues(m_handle_real); }
|
|
|
| //---
|
| inline bool SwingIsMayor(const int swing_index, int num_swings, ENUM_TYPE_SWING type, bool consecutive);
|
| inline bool SwingIsMinor(const int swing_index, int num_swings, ENUM_TYPE_SWING type, bool consecutive);
|
|
|
|
|
| //--- Funcionalidades
|
| // Obtiene el tiempo en base a un indice y el tipo de swing
|
| inline datetime GetTimeByIndex(const int index, ENUM_TYPE_SWING type);
|
|
|
| // Devuelve el precio de un swing en base a su indice y tipo
|
| inline double GetPriceByIndex(const int index, ENUM_TYPE_SWING type);
|
|
|
| // Devuelve el indice de un swing en base al tiempo, si no se encutra un swing del tipo "type"
|
| // Con el tiempo "time", devolvera -1
|
| inline int GetIndexByTime(const datetime time, ENUM_TYPE_SWING type);
|
|
|
| //--- Funciones de Log
|
| inline void AddLogFlags(const uint8_t flags) override final;
|
| void RemoveLogFlags(const uint8_t flags) override final;
|
|
|
| //---
|
| inline bool IsNewBarConcept() override final;
|
| inline bool ShowAll() override final;
|
| inline bool HideAll() override final;
|
| inline bool DeleteAll() override final;
|
| inline void SetFlagMostrarObjetos(bool mostrar) override final;
|
| inline void ForzeToActulizeCurrentTick() override final;
|
|
|
| //---
|
| virtual inline void SetParo() { }
|
|
|
| //---
|
| inline bool Delete() const { return m_delete;}
|
| void Delete(const bool new_val) { m_delete = new_val; }
|
|
|
| //--- General
|
| inline int Handle() const override final { return m_handle; }
|
| inline int HandleReal() const { return m_handle_real; }
|
| inline ENUM_TIMEFRAMES Timeframe() const override final { return ICTSwing_Timeframe(m_handle_real); }
|
| inline string Symbol() const override final { return ICTSwing_Simbolo(m_handle_real); }
|
| inline int Subwin() const override final { return ICTSwing_Subwin(m_handle_real); }
|
| inline long ChartId() const override final { return ICTSwing_ChartId(m_handle_real); }
|
| inline bool InitialStateObj() const override final { return ICTSwing_GetInittialStateObj(m_handle_real); }
|
| inline ENUM_GET_SWING TypeSwing() const { return ICTSwing_TypeSwing(m_handle_real); }
|
|
|
| inline uint8_t ModifyFlags() const override final { return ICTSwing_ModifyFlags(m_handle); }
|
| inline bool GetStateObj() const override final { return ICTSwing_GetStateObj(m_handle); }
|
| inline void Summary() const override final { ICTSwing_Summary(m_handle); }
|
| inline void ChangeChart(long new_chart_id, int new_subwin) override final { ICTSwing_ChangeChart(m_handle, new_chart_id, new_subwin); }
|
|
|
| };
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| CSwingBar::CSwingBar()
|
| {
|
| m_handle = INVALID_HANDLE;
|
| m_handle_real = INVALID_HANDLE;
|
| m_delete = true;
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| bool CSwingBar::Destroy(void)
|
| {
|
| //---
|
| if(!m_delete)
|
| {
|
| LogWarning("El obejeto no puede ser eliminado", FUNCION_ACTUAL);
|
| return false;
|
| }
|
|
|
| //---
|
| if(m_handle == INVALID_HANDLE)
|
| {
|
| LogError("El obejto a eliminar ya es invalido", FUNCION_ACTUAL);
|
| return false;
|
| }
|
|
|
| //--- Eliminamos el swing
|
| if(TypeSwing() == ZIGZAG)
|
| ICTSwingZigZag_Delete(m_handle, m_handle_real);
|
| else
|
| ICTSwingPure_Delete(m_handle, m_handle_real);
|
|
|
| //--- Reset variables
|
| m_handle = INVALID_HANDLE;
|
| m_handle_real = INVALID_HANDLE;
|
| return true;
|
| }
|
|
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| /*
|
| - Esta funcion crea un swing en base a un handle real existente y opcionalemten un handle especifico, si se especifica
|
| el handle especifico se tiene la posiblidad de poner hacer dynamic cast (si es qeuy se cera un CSwingBar), de lo contrario
|
| solo se pondran las funciones de CSwibngBar
|
| */
|
|
|
| //---
|
| void CSwingBar::CreateByHandle(int handle_real, int handle_especifico = INVALID_HANDLE)
|
| {
|
| if(m_handle != INVALID_HANDLE)
|
| Destroy(); // Si tenmos un swing activo lo eliminamos
|
|
|
| //---
|
| m_handle_real = handle_real;
|
| m_handle = handle_especifico;
|
| m_delete = false; // No eliminar, dado que es una copia
|
|
|
| //---
|
| if(handle_especifico == INVALID_HANDLE)
|
| {
|
| LogWarning("EL handle especifico es invalido, no se podra hacer dynamic cast para usar funciones especificas", FUNCION_ACTUAL);
|
| }
|
| }
|
|
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline void CSwingBar::SetProperties(color color_buy_swing, color color_sell_swing, string text_buy_swing_, string text_sell_swing_,
|
| string font_, int8_t font_size_, int max_elements_array_)
|
| {
|
| ICTSwing_SetProperties(m_handle_real, color_buy_swing, color_sell_swing, text_buy_swing_, text_sell_swing_, font_, font_size_, max_elements_array_);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline void CSwingBar::OnNewBar()
|
| {
|
| ICTSwing_OnNewBar(m_handle_real);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline bool CSwingBar::GetSwingPrev(const int range_obtencion)
|
| {
|
| return ICTSwing_GetSwingPrev(m_handle_real, range_obtencion);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline Swings CSwingBar::GetSwingsAlcistas(const int pos_idx)
|
| {
|
| return ICTSwing_GetSwingsAlcistas(m_handle_real, pos_idx);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline Swings CSwingBar::GetSwingsBasjitas(const int pos_idx)
|
| {
|
| return ICTSwing_GetSwingsBasjitas(m_handle_real, pos_idx);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline int CSwingBar::SizeSwingAlcistas()
|
| {
|
| return ICTSwing_SizeSwingAlcistas(m_handle_real);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline int CSwingBar::SizeSwingBajistas()
|
| {
|
| return ICTSwing_SizeSwingBajistas(m_handle_real);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline int CSwingBar::GetCloseSwingAlcistaIndex(datetime target_time, MODE_CLOSET_INDEX mode)
|
| {
|
| return ICTSwing_GetCloseSwingAlcistaIndex(m_handle_real, target_time, mode);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline int CSwingBar::GetCloseSwingBajistaIndex(datetime target_time, MODE_CLOSET_INDEX mode)
|
| {
|
| return ICTSwing_GetCloseSwingBajistaIndex(m_handle_real, target_time, mode);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline int CSwingBar::GetCloseSwingIndex(datetime target_time, MODE_CLOSET_INDEX mode, string &tipo)
|
| {
|
| return ICTSwing_GetCloseSwingIndex(m_handle_real, target_time, mode, tipo);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline bool CSwingBar::HayUnNuevoSwing()
|
| {
|
| return ICTSwing_HayUnNuevoSwing(m_handle_real);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline int CSwingBar::HayUnNuevoSwing(ENUM_TYPE_SWING type)
|
| {
|
| return ICTSwing_HayUnNuevoSwing(m_handle_real, type);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline Swings CSwingBar::GetSwingLowMasCeracanoPorPrecioYTime(double target_price, ENUM_TYPE_CERCANOS_SWING mode)
|
| {
|
| return ICTSwing_GetSwingLowMasCeracanoPorPrecioYTime(m_handle_real, target_price, mode);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline Swings CSwingBar::GetSwingHighMasCeracanoPorPrecioYTime(double target_price, ENUM_TYPE_CERCANOS_SWING mode)
|
| {
|
| return ICTSwing_GetSwingHighMasCeracanoPorPrecioYTime(m_handle_real, target_price, mode);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline void CSwingBar::MiniumElement(int min)
|
| {
|
| ICTSwing_MiniumElement(m_handle_real, min);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline int CSwingBar::MiniumElement()
|
| {
|
| return ICTSwing_MiniumElement(m_handle_real);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline void CSwingBar::SwingHighColor(color new_value)
|
| {
|
| ICTSwing_SwingHighColor(m_handle_real, new_value);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline color CSwingBar::SwingHighColor()
|
| {
|
| return ICTSwing_SwingHighColor(m_handle_real);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline void CSwingBar::SwingLowColor(color new_value)
|
| {
|
| ICTSwing_SwingLowColor(m_handle_real, new_value);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline color CSwingBar::SwingLowColor()
|
| {
|
| return ICTSwing_SwingLowColor(m_handle_real);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline datetime CSwingBar::GetTimeByIndex(const int index, ENUM_TYPE_SWING type)
|
| {
|
| return ICTSwing_GetTimeByIndex(m_handle_real, index, type);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline double CSwingBar::GetPriceByIndex(const int index, ENUM_TYPE_SWING type)
|
| {
|
| return ICTSwing_GetPriceByIndex(m_handle_real, index, type);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline int CSwingBar::GetIndexByTime(const datetime time, ENUM_TYPE_SWING type)
|
| {
|
| return ICTSwing_GetIndexByTime(m_handle_real, time, type);
|
| }
|
|
|
|
|
| //+------------------------------------------------------------------+
|
| inline void CSwingBar::AddLogFlags(const uint8_t flags)
|
| {
|
| CLoggerBase::AddLogFlags(flags);
|
| ICTSwing_AddLogFlag(m_handle_real, flags);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| void CSwingBar::RemoveLogFlags(const uint8_t flags)
|
| {
|
| CLoggerBase::RemoveLogFlags(flags);
|
| ICTSwing_RemoveLogFlag(m_handle_real, flags);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline bool CSwingBar::SwingIsMayor(const int swing_index, int num_swings, ENUM_TYPE_SWING type, bool consecutive)
|
| {
|
| return ICTSwing_SwingIsMayor(m_handle, swing_index, num_swings, type, consecutive);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| inline bool CSwingBar::SwingIsMinor(const int swing_index, int num_swings, ENUM_TYPE_SWING type, bool consecutive)
|
| {
|
| return ICTSwing_SwingIsMinor(m_handle, swing_index, num_swings, type, consecutive);
|
| }
|
|
|
|
|
| //+------------------------------------------------------------------+
|
| inline bool CSwingBar::IsNewBarConcept()
|
| {
|
| return ICTSwing_IsNewBarConcept(m_handle_real);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline bool CSwingBar::ShowAll()
|
| {
|
| return ICTSwing_ShowAll(m_handle_real);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline bool CSwingBar::HideAll()
|
| {
|
| return ICTSwing_HideAll(m_handle_real);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline bool CSwingBar::DeleteAll()
|
| {
|
| return ICTSwing_DeleteAll(m_handle_real);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline void CSwingBar::SetFlagMostrarObjetos(bool mostrar)
|
| {
|
| ICTSwing_SetFlagMostrarObjetos(m_handle_real, mostrar);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline void CSwingBar::ForzeToActulizeCurrentTick()
|
| {
|
| ICTSwing_ForzeToActulizeCurrentTick(m_handle_real);
|
| }
|
|
|
|
|
| //+------------------------------------------------------------------+
|
| //| Swing bar default |
|
| //+------------------------------------------------------------------+
|
| /*
|
| - USo: esta clase se debera de usar al momento de crear una copia (CreateByHandle)..
|
| */
|
| //---
|
| class CSwingBarDefault : public CSwingBar
|
| {
|
| public:
|
| CSwingBarDefault() {}
|
| ~CSwingBarDefault() {}
|
| void Create(string symbol, ENUM_TIMEFRAMES timeframe, long chart_id, int subwin, bool show_concept, MqlParam ¶metros[]) override { }
|
| };
|
|
|
|
|
| //+------------------------------------------------------------------+
|
| //| Swing bar pure |
|
| //+------------------------------------------------------------------+
|
| class CSwingBarPure : public CSwingBar
|
| {
|
| public:
|
| CSwingBarPure() {}
|
| ~CSwingBarPure() {}
|
| // Lo dejamos Inutilizable, dado que es una clase FIJA no podemos cambiar el tipo
|
| //---
|
| void Create(string symbol, ENUM_TIMEFRAMES timeframe, long chart_id, int subwin, bool show_concept, MqlParam ¶metros[]) override;
|
|
|
| //---
|
| bool Destroy() override;
|
| };
|
|
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| void CSwingBarPure::Create(string symbol, ENUM_TIMEFRAMES timeframe, long chart_id, int subwin, bool show_concept, MqlParam ¶metros[])
|
| {
|
| if(m_handle != INVALID_HANDLE)
|
| Destroy(); // Si tenmos un swing activo lo eliminamos
|
|
|
| //---
|
| m_handle = ICTSwingPure_Create(symbol, timeframe, chart_id, subwin, show_concept, parametros, m_handle_real);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| // Nota, creo que no deberia de dar el error de funcion puramente virutal llamada.. no lo es.. por lo que al momento de desutrir este objeto
|
| // Se llamara al destrucutro de CSwingBar (Desotry)
|
| // Overrideo esto por que la propiedad "m_type_get_swing" NECESITO que se mantenga para no causar errore en getter TypeSwing
|
| bool CSwingBarPure::Destroy(void)
|
| {
|
| if(!m_delete)
|
| {
|
| LogCaution("El obejeto no puede ser eliminado", FUNCION_ACTUAL);
|
| return false;
|
| }
|
|
|
| if(m_handle == INVALID_HANDLE)
|
| {
|
| LogWarning("El obejeto a eliminar ya es invalido", FUNCION_ACTUAL);
|
| return false;
|
| }
|
|
|
| //--- Eliminamos el swing
|
| ICTSwingPure_Delete(m_handle, m_handle_real);
|
|
|
| //--- Reset variables
|
| m_handle = INVALID_HANDLE;
|
| m_handle_real = INVALID_HANDLE;
|
| return true;
|
| }
|
|
|
|
|
|
|
| //+------------------------------------------------------------------+
|
| //| Swing bar zigzag |
|
| //+------------------------------------------------------------------+
|
| class CSwingBarZigZag : public CSwingBar
|
| {
|
| public:
|
| CSwingBarZigZag() {}
|
| ~CSwingBarZigZag() {}
|
| //---
|
| void Create(string symbol, ENUM_TIMEFRAMES timeframe, long chart_id, int subwin, bool show_concept, MqlParam ¶metros[]) override;
|
|
|
| //---
|
| inline double GetPriceZigZagAct();
|
| inline ENUM_ZIGZAG_DIRECTION GetDirectionZigZagAct();
|
| inline datetime GetLastTimeZigZag();
|
| inline bool NewZigZagResize();
|
|
|
| //---
|
| bool Destroy() override;
|
| inline void SetParo() override { ICTSwingZigZag_SetParo(m_handle); }
|
| };
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| void CSwingBarZigZag::Create(string symbol, ENUM_TIMEFRAMES timeframe, long chart_id, int subwin, bool show_concept, MqlParam ¶metros[])
|
| {
|
| if(m_handle != INVALID_HANDLE)
|
| Destroy(); // Si tenemos un swing activo lo eliminamos
|
|
|
| //---
|
| m_handle = ICTSwingZigZag_Create(symbol, timeframe, chart_id, subwin, show_concept, parametros, m_handle_real);
|
| }
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| // Nota, creo que no deberia de dar el error de funcion puramente virutal llamada.. no lo es.. por lo que al momento de desutrir este objeto
|
| // Se llamara al destrucutro de CSwingBar (Desotry)
|
| // Overrideo esto por que la propiedad "m_type_get_swing" NECESITO que se mantenga para no causar errore en getter TypeSwing
|
| bool CSwingBarZigZag::Destroy(void)
|
| {
|
| if(!m_delete)
|
| {
|
| LogCaution("El obejeto no puede ser eliminado", FUNCION_ACTUAL);
|
| return false;
|
| }
|
|
|
| if(m_handle == INVALID_HANDLE)
|
| {
|
| LogWarning("El obejeto a eliminar ya es invalido", FUNCION_ACTUAL);
|
| return false;
|
| }
|
|
|
| //--- Eliminamos el swing
|
| ICTSwingZigZag_Delete(m_handle, m_handle_real);
|
|
|
| //--- Reset variables
|
| m_handle = INVALID_HANDLE;
|
| m_handle_real = INVALID_HANDLE;
|
| return true;
|
| }
|
|
|
|
|
| //+------------------------------------------------------------------+
|
| inline double CSwingBarZigZag::GetPriceZigZagAct()
|
| {
|
| return ICTSwingZigZag_GetPriceZigZagAct(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline ENUM_ZIGZAG_DIRECTION CSwingBarZigZag::GetDirectionZigZagAct()
|
| {
|
| return ICTSwingZigZag_GetDirectionZigZagAct(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline datetime CSwingBarZigZag::GetLastTimeZigZag()
|
| {
|
| return ICTSwingZigZag_GetLastTimeZigZag(m_handle);
|
| }
|
|
|
| //+------------------------------------------------------------------+
|
| inline bool CSwingBarZigZag::NewZigZagResize()
|
| {
|
| return ICTSwingZigZag_NewZigZagResize(m_handle);
|
| }
|
|
|
| //+-------------------------------------------------------------------------------------+
|
| //| En base a ciertos paraemtros, crea un array del tipo MqlParam |
|
| //| Para la configuracion del swing del tipo ZigZag |
|
| //| Inputs: |
|
| //| - period_ : Periodo del ZigZag. |
|
| //| - range_ : Rango de obtencion previo (para el calculo del ZigZag). |
|
| //| - ocultar_zz : Booleano, que indicara si es necesario ocultar el indicador ZigZag . |
|
| //| Out: |
|
| //| - params: Array dinamico del tipo MqlParams, donde se configuraran los parametros |
|
| //+-------------------------------------------------------------------------------------+
|
| void ZZToParams(int16_t period_, int range_, bool ocultar_zz, MqlParam ¶m[])
|
| {
|
| ArrayResize(param, 3);
|
| param[0].integer_value = period_;
|
| param[1].integer_value = range_;
|
| param[2].integer_value = (long)ocultar_zz;
|
| }
|
|
|
| //+-------------------------------------------------------------------------------------+
|
| //| En base a ciertos paraemtros, crea un array del tipo MqlParam |
|
| //| Para la configuracion del swing del tipo PURE. |
|
| //| Inputs: |
|
| //| - lenth_antes : Velas anteriores del swing, que se necesitaran |
|
| // para considerar un swing. |
|
| //| - lenth_despues : Velas posteriores del swing, que se necesitaran |
|
| // para considerar un swing. |
|
| //| - type_mode : Modo del swing, si es estricto se buscara consecutivadad |
|
| //| De lo contrario solo que la vela swing sea el pico o o puntero mas |
|
| //| bajo. |
|
| //| Out: |
|
| //| - params: Array dinamico del tipo MqlParams, donde se configuraran los parametros. |
|
| //+-------------------------------------------------------------------------------------+
|
| void PureToParmas(int16_t lenth_antes, int16_t lenth_despues, MODE_BUSQUEDA_SWING type_mode, MqlParam ¶m[])
|
| {
|
| ArrayResize(param, 3);
|
| param[0].integer_value = lenth_despues;
|
| param[1].integer_value = lenth_antes;
|
| param[2].integer_value = type_mode;
|
| }
|
|
|
|
|
| //---
|
| #endif // ICTLIBRARY_CONCEPTS_SWING_SWINGS_MQH
|
| //+------------------------------------------------------------------+
|