MQLArticles/PosMgmt/TSL/Basic/TrailingDef.mqh
87 行
3.1 KiB
MQL5
Rawパーマリンク通常表示履歴
Nique_372
2026-10-24 17:50:46 -05:00
//+------------------------------------------------------------------+
//| TrailingDef.mqh |
//| Copyright 2026, Niquel Mendoza. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, Niquel Mendoza."
#property link "https://www.mql5.com"
#property strict
#ifndef MQLARTICLES_POSMGMT_TSL_BASIC_TRAILINGDEF_MQH
#define MQLARTICLES_POSMGMT_TSL_BASIC_TRAILINGDEF_MQH
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
Nique_372
2026-10-28 17:19:08 -05:00
#include "..\\..\\..\\Account\\MoneyStatus\\Manager.mqh"
Nique_372
2026-10-25 09:14:49 -05:00
#include "..\\..\\..\\Utils\\FA\\Atr\\All.mqh"
Nique_372
2026-10-24 17:50:46 -05:00
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
namespace TSN
{
//+------------------------------------------------------------------+
//| Trailing Stop |
//+------------------------------------------------------------------+
//---
struct pack(8) InfoTrailing
{
ulong ticket; // Ticket de la posicion
double open_price; // Precio de apuerta
double price_a_superar; // Precio next superar
double price_base; // minimo para empzar
double last_stop_loss_price; //
ENUM_POSITION_TYPE pos_type; // Tipo
bool extra;
};
//---
enum ENUM_TYPE_EXECUTION_TSL
{
TSL_EXECUTION_ON_BAR,
TSL_EXECUTION_ON_TICK
};
//---
enum ENUM_GENBYELO_TS_ERR
{
Nique_372
2026-11-05 17:09:00 -05:00
//--- Propio
Nique_372
2026-10-24 17:50:46 -05:00
GENBYELO_TS_ERR_NOT,
GENBYELO_TS_ERR_SELECT_POSITION,
GENBYELO_TS_ERR_SYMBOL_IS_NOT_A_CONFIGURED,
Nique_372
2026-11-02 15:21:28 -05:00
GENBYELO_TS_ERR_POSITION_NOT_FOUND,
Nique_372
2026-10-24 17:50:46 -05:00
};
//---
class CTrailingStop;
//+------------------------------------------------------------------+
//| Macros |
//+------------------------------------------------------------------+
#define TSNMQLA_TrailignStop_CheckStopLossSafeVenta(s_temp, stoploss_nuevo) (stoploss_nuevo > s_temp)
#define TSNMQLA_TrailignStop_CheckStopLossSafeCompra(s_temp, stoploss_nuevo) (stoploss_nuevo < s_temp)
Nique_372
2026-11-01 15:00:25 -05:00
#ifndef TSNMQLA_CTRAILING_STOP_RESERVE_ARR
#define TSNMQLA_CTRAILING_STOP_RESERVE_ARR (8)
#endif // TSNMQLA_CTRAILING_STOP_RESERVE_ARR
Nique_372
2026-10-24 17:50:46 -05:00
//--- Activelo para que ya no se impriman logs de err para el user..
//#define GENBYLEO_TRAILINGSTOP_DESACTIVE_ERR_LOGS
Nique_372
2026-11-02 15:21:28 -05:00
//---
#ifndef TSNMQLA_TRAILING_CHECK_R
#define TSNMQLA_TRAILING_CHECK_R \
if(m_trailings_s >= m_trailings_r) \
{ \
m_trailings_r += (m_trailings_r>>1) + 4; \
ArrayResize(m_trailings, m_trailings_r, m_trailings_r); \
}
#endif // TSNMQLA_TRAILING_CHECK_R
Nique_372
2026-10-24 17:50:46 -05:00
//---
}
#endif // MQLARTICLES_POSMGMT_TSL_BASIC_TRAILINGDEF_MQH