forked from nique_372/ICTLibraryEasy
277 lines
15 KiB
MQL5
277 lines
15 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| Defines.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_BASE_DEFINES_MQH
|
|
#define ICTLIBRARYEASY_SRC_BASE_DEFINES_MQH
|
|
|
|
//--- Incluimos Utils and graphics objetos del repositorio publico MQLArticles
|
|
#include "..\\..\\..\\MQLArticles\\Utils\\GraphicObjects.mqh"
|
|
|
|
/*
|
|
Recomiendo encarecidamente no modificar esto, dado que tiene que coincidir exactamente con la libreria .ex5, de lo contario aparecera un errro
|
|
cannont import ....
|
|
*/
|
|
//+------------------------------------------------------------------+
|
|
//| Bloques |
|
|
//+------------------------------------------------------------------+
|
|
//---
|
|
enum ENUM_CONCEPT_UN_BLOQUE_TYPE
|
|
{
|
|
CONCEPT_UN_PDA_OB = 0,
|
|
CONCEPT_UN_PDA_FVG = 1,
|
|
CONCEPT_UN_PDA_IMBALANCE = 2,
|
|
CONCEPT_UN_PDA_RDRB = 3,
|
|
CONCEPT_UN_PDA_GAP = 4,
|
|
CONCEPT_UN_PDA_BREAKER_BLOCK = 5,
|
|
CONCEPT_UN_PDA_iFVG = 6,
|
|
CONCEPT_UN_PDA_iIMBALANCE = 7,
|
|
CONCEPT_UN_PDA_iRDRB = 8,
|
|
CONCEPT_UN_PDA_iGAP = 9,
|
|
CONCEPT_UN_PDA_BPR_FVG = 10,
|
|
CONCEPT_UN_PDA_BPR_IMBALANCE = 11,
|
|
CONCEPT_UN_PDA_BPR_RDRB = 12,
|
|
CONCEPT_UN_PDA_BPR_GAP = 13,
|
|
};
|
|
|
|
|
|
//---
|
|
enum ENUM_STYLE_DIBUJO_IMBALANCES
|
|
{
|
|
fvg_1_vela, // Draw on 3 candles
|
|
fvg_se_actuliza, // Draw to current time
|
|
};
|
|
|
|
//---
|
|
enum ENUM_MODO_OBTENCION_IMBALANCE
|
|
{
|
|
defined_pattern, //Only Pattern
|
|
defined_pattern_with_market_book,//Pattern with Market Book
|
|
defined_pattern_with_tick_volume//Pattern with TickVolume
|
|
};
|
|
|
|
|
|
//---
|
|
enum ENUM_TYPE_ROPTRUA_CONFIRMAR_OB
|
|
{
|
|
BREAKUP_SWING,//Breakout of a bullish/bearish swing
|
|
BREAKUP_VELA_ROPTURA_SWING //Breakout of the candle that swept away liquidity
|
|
};
|
|
|
|
//---
|
|
struct Bloques
|
|
{
|
|
string name; // Nombre del bloque
|
|
string name_mitad_line; // Nombre de la linea de la mitad
|
|
double price1; // Precio 1 del bloque
|
|
double price2; // Precio 2 del bloque
|
|
double mitad_price; // Precio de la mitad
|
|
datetime time1; // Tiempo 1 del bloque
|
|
datetime time2; // Tiempo 2 del bloque
|
|
datetime time1_verificacion; // Tiempo 1 de verificacion del bloque
|
|
|
|
|
|
//---
|
|
Bloques()
|
|
: name(NULL), name_mitad_line(NULL), price1(0.0), price2(0.0),
|
|
mitad_price(0.0), time1(0), time2(0), time1_verificacion(0) {}
|
|
|
|
Bloques(const Bloques& other)
|
|
{
|
|
this = other;
|
|
}
|
|
|
|
//---
|
|
inline double GetAltura() const { return ::MathAbs(price1 - price2); }
|
|
inline int GetAncho() const { return int(time2 - time1);}
|
|
|
|
//---
|
|
void Print() const
|
|
{
|
|
::Print("-----------------------------------");
|
|
::Print("Name: ", name);
|
|
::Print("time 1: ", time1);
|
|
::Print("time 2: ", time2);
|
|
::Print("price 1: ", price1);
|
|
::Print("price 2: ", price2);
|
|
::Print("time1 de verificacion: ", time1_verificacion);
|
|
}
|
|
|
|
//---
|
|
__forceinline void Reset()
|
|
{
|
|
::ZeroMemory(this);
|
|
}
|
|
};
|
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Sesiones |
|
|
//+------------------------------------------------------------------+
|
|
enum ENUM_TYPE_DRAW_RANGE_SESSION
|
|
{
|
|
draw_session_range_only_rect, //Dibujar solo el rectangulo
|
|
draw_session_range_lines_and_rect //Dibujar el rectangulo y lineas extras
|
|
};
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Swing |
|
|
//+------------------------------------------------------------------+
|
|
#define ADD_ALL -1 //Añadir todo al array
|
|
|
|
//---
|
|
enum ENUM_TYPE_SWING
|
|
{
|
|
SWING_ALCISTA,
|
|
SWING_BAJISTA
|
|
};
|
|
|
|
//---
|
|
enum ENUM_GET_SWING
|
|
{
|
|
PURE_SWINGS, //Swings
|
|
ZIGZAG //ZigZag
|
|
};
|
|
|
|
//---
|
|
enum MODE_BUSQUEDA_SWING
|
|
{
|
|
MODE_SWING_STRICT, //Strict search mode
|
|
MODE_SWING_NO_STRICT //Non-strict search mode
|
|
};
|
|
|
|
//---
|
|
enum ENUM_TYPE_SWING_DECENDET
|
|
{
|
|
T_SWING_HH = 0,
|
|
T_SWING_HL,
|
|
T_SWING_LL,
|
|
T_SWING_LH
|
|
};
|
|
|
|
//---
|
|
enum ENUM_TYPE_CERCANOS_SWING
|
|
{
|
|
SWING_MAYOR_A_TARGET_PRICE = 0,
|
|
SWING_MENOR_A_TARGET_PRICE = 1
|
|
};
|
|
|
|
//--- ZigZag
|
|
enum ENUM_ZIGZAG_DIRECTION
|
|
{
|
|
ZZ_DIRECTION_BULL,
|
|
ZZ_DIRECTION_BEAR
|
|
};
|
|
|
|
//---
|
|
struct Swings
|
|
{
|
|
//--- Propiedades del swing
|
|
string name;
|
|
double price;
|
|
datetime time;
|
|
|
|
//---
|
|
double extra_value;
|
|
double extra_value2;
|
|
ENUM_TYPE_SWING_DECENDET type_decent; //Enum opcional por defecto en CSwing no se llena no se usa pero en otras clases se puede alamcer si es hh o ll si es que se necesita
|
|
bool swing_is_disabled;
|
|
|
|
|
|
//---
|
|
Swings(const Swings& other)
|
|
{
|
|
this = other;
|
|
}
|
|
|
|
Swings()
|
|
: time(0), price(0.00), name(NULL),
|
|
swing_is_disabled(false), type_decent(WRONG_VALUE), extra_value(0.00), extra_value2(0.00)
|
|
{
|
|
}
|
|
|
|
|
|
//--- Funciones
|
|
// Reset
|
|
void Reset()
|
|
{
|
|
time = 0;
|
|
extra_value = 0.00;
|
|
extra_value2 = 0.00;
|
|
price = 0.00;
|
|
swing_is_disabled = false;
|
|
name = NULL;
|
|
}
|
|
|
|
// Contains
|
|
__forceinline bool ContainsTime(datetime time_start, datetime time_end, bool considerar_igual = false) const
|
|
{
|
|
return ContainsRangeTime(this.time, time_start, time_end, considerar_igual);
|
|
}
|
|
|
|
__forceinline bool ContainsPrice(double min_price, double max_price) const
|
|
{
|
|
return this.price > min_price && this.price < max_price;
|
|
}
|
|
|
|
// Impresion
|
|
void Print() const
|
|
{
|
|
::Print("---------------------------------");
|
|
::Print("Swing Time: ", time);
|
|
::Print("Swing Price: ", price);
|
|
::Print("Swing disabled: ", swing_is_disabled);
|
|
::Print("Swing Name: ", name);
|
|
}
|
|
|
|
// A string
|
|
__forceinline string ToString() const
|
|
{
|
|
return name + " | " + TimeToString(time) + " | " + DoubleToString(price, _Digits) + " | " + IntegerToString(int(swing_is_disabled));
|
|
}
|
|
};
|
|
|
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Market struct |
|
|
//+------------------------------------------------------------------+
|
|
enum ENUM_TYPE_MARLET_STRUCT_TREND
|
|
{
|
|
ICT_MARKET_STRUCT_TREND_CAMBIO_A_ALCISTA = 0,
|
|
ICT_MARKET_STRUCT_TREND_ALCISTA = 1,
|
|
ICT_MARKET_STRUCT_TREND_CAMBIO_A_BAJISTA = 2,
|
|
ICT_MARKET_STRUCT_TREND_BAJISTA = 3,
|
|
ICT_MARKET_STRUCT_TREND_INVALID = 4
|
|
};
|
|
|
|
struct MarketStruct //Bos-Choch-Equals
|
|
{
|
|
string name;
|
|
string name_text;
|
|
double price;
|
|
datetime time1;
|
|
datetime time2;
|
|
ENUM_TYPE_SWING_DECENDET type;
|
|
|
|
void Reset()
|
|
{
|
|
ZeroMemory(this);
|
|
}
|
|
};
|
|
|
|
enum ENUM_TYPE_ROPTURA
|
|
{
|
|
ROPTURA_HACIA_ARRIBA,
|
|
ROPTURA_HACIA_ABAJO
|
|
};
|
|
|
|
|
|
|
|
#endif // ICTLIBRARYEASY_SRC_BASE_DEFINES_MQH
|
|
//+------------------------------------------------------------------+
|