TG Trade Service Manager MT5
- Bibliotecas
- Daciana Elena Chirica
- Versión: 1.0
- Activaciones: 15
Presentamos "TG Trade Service Manager" - su solución todo-en-uno para la gestión de operaciones sin fisuras tanto en entornos MQL4 como MQL5. Con un enfoque en la velocidad, fiabilidad y comodidad, esta poderosa biblioteca simplifica las complejidades de la ejecución y gestión de operaciones, facultando a los desarrolladores con una interfaz única para una mayor eficiencia.
Características principales:
-
Interfaz unificada: TG Trade Service Manager" proporciona una interfaz unificada paraMQL4 y MQL5, agilizando los procesos de gestión de operaciones en todas las plataformas.
-
Gestión de errores y registro: Los sólidos mecanismos de gestión y registro de errores garantizan que tanto las transacciones exitosas como los mensajes de error se registren meticulosamente, proporcionando a los desarrolladores una visión completa de las actividades comerciales.
-
Opciones flexibles de Stop Loss y Take Profit: Los desarrolladores se benefician de opciones flexibles de stop loss y take profit adaptadas a sus preferencias. Con dos métodos distintos disponibles para establecer los niveles de stop loss y take profit, los desarrolladores pueden elegir entre definir los precios directamente o especificar las distancias en puntos. La biblioteca gestiona de forma inteligente los cálculos para colocar las órdenes stop loss y take profit a las distancias deseadas, eliminando la necesidad de cálculos manuales y simplificando los flujos de trabajo de gestión de operaciones.
#import "TG_TradeServiceLib.ex5" //or path to library long Buy(double lots, int stopLossPoints, int takeProfitPoints, string symbol, int magic, string comment = NULL); long Buy(double lots, double stopLossPrice, double takeProfitPrice, string symbol, int magic, string comment = NULL); long Sell(double lots, int stopLossPoints, int takeProfitPoints, string symbol, int magic, string comment = NULL); long Sell(double lots, double stopLossPrice, double takeProfitPrice, string symbol, int magic, string comment = NULL); long BuyLimit(double price, double lots, double stopLossPrice, double takeProfitPrice, string symbol, int magic, string comment = NULL); long BuyLimit(double price, double lots, int stopLossPoints, int takeProfitPoints, string symbol, int magic, string comment = NULL); long SellLimit(double price, double lots, double stopLossPrice, double takeProfitPrice, string symbol, int magic, string comment = NULL); long SellLimit(double price, double lots, int stopLossPoints, int takeProfitPoints, string symbol, int magic, string comment = NULL); long BuyStop(double price, double lots, double stopLossPrice, double takeProfitPrice, string symbol, int magic, string comment = NULL) ; long BuyStop(double price, double lots, int stopLossPoints, int takeProfitPoints, string symbol, int magic, string comment = NULL); long SellStop(double price, double lots, double stopLossPrice, double takeProfitPrice, string symbol, int magic, string comment = NULL); long SellStop(double price, double lots, int stopLossPoints, int takeProfitPoints, string symbol, int magic, string comment = NULL); long MarketExecution(int operation, double lots, int stopLossPoints, int takeProfitPoints, string symbol, int magic, string comment = NULL); long MarketExecution(int operation, double lots, double stopLossPrice, double takeProfitPrice, string symbol, int magic, string comment = NULL); bool Close(long ticket, double lots, int slippage); bool Close(long ticket, int slippage); bool CloseBatch(int magic, string symbol, int type = -1); bool DeletePending(long ticket); bool DeleteBatch(int magic, string symbol, int type = -1) ; bool ModifyMarket(long ticket, int stopLossPoints, int takeProfitPoints) ; bool ModifyMarket(long ticket, double stopLossPrice, double takeProfitPrice); bool ModifyMarketBatch(int magic, double stopLossPrice, double takeProfitPrice, string symbol, int type = -1); bool ModifyMarketBatch(int magic, int stopLossPoints, int takeProfitPoints, string symbol, int type = -1); bool ModifyPending(ulong ticket, double stopLossPrice, double takeProfitPrice, double price = 0, datetime expiration = 0); bool ModifyPending(ulong ticket, int stopLossPoints, int takeProfitPoints, double price = 0, datetime expiration = 0); long Pending(int operation, double price, string symbol, int magic, double lots, int stopLossPoints, int takeProfitPoint, string comment = NULL, datetime expiration = 0); #import
ANTES DE UTILIZARLA DEBE IMPORTAR LA LIBRERÍA COMO EN MI EJEMPLO ANTERIOR Como usar Ejemplos
//abrirá una operación con StopLoss = 125 puntos, TakeProfit = 125 puntos long resultTicket = MarketExecution( (int)ORDER_TYPE_BUY, // tipo de pedido 0.01, // lotes 125, //stopLoss(en puntos) 125, //sacarBeneficio(en puntos) _Symbol, //símbolo (opcional) 1, /número mágico(opcional) "MyFirstTrade"); //comentario (opcional) if(resultTicket <= 0) //normalmente si la ejecución falla dará como resultado -1 { //Código de gestión de fallos //devolver false/dormir/etc } //Resto de la implementación del algoritmo
Nota: No utilizo valores negativos para stopLoss, la librería calcula todo por sí misma.
Ejemplo 2 usando price(double) como parámetros:
//abrirá una operación con StopLoss = 125 puntos, TakeProfit = 125 puntos long resultTicket = MarketExecution( (int)ORDER_TYPE_BUY, // tipo de pedido 0.01, // lotes 1.08300, //stopLoss(PRECIO) 1.08800, //tomarBeneficio(PRECIO) _Symbol, //símbolo (opcional) 1, /número mágico(opcional) "MyFirstTrade"); //comentario (opcional) if(resultTicket <= 0) //normalmente si la ejecución falla dará como resultado -1 { //Código de gestión de fallos //devolver false/dormir/etc } //Resto de la implementación del algoritmo
Ejemplos de registro
Errores
2024.01.31 18:44:02.346 TradeServiceLibScriptTests (EURUSD,H4) [INFO] | [Trade.mqh::CTrade::CheckStopLossTakeProfitCorrectness] | For order ORDER_TYPE_BUY TakeProfit=-1.08366 must be greater than 1.08469 (Bid=1.08468 + SYMBOL_TRADE_STOPS_LEVEL=1 points)
2024.01.31 18:44:02.346 TradeServiceLibScriptTests (EURUSD,H4) [ERROR] | [Trade.mqh::CTrade::PositionOpen::496] | Invalid stops ORDER_TYPE_BUY MarketPrice: 1.085, Bid:1.08468, Ask:1.08470 SL: 1.08366, TP: -1.08366
INFO:
2024.01.31 18:23:35.607 TradeServiceLibScriptTests (EURUSD,H4) [INFO] | [Trade.mqh::CTrade::OrderSend] | CTrade::OrderSend: compra de mercado 0.01 EURUSD [hecho a 1.08514]
2024.01.31 18:41:49.329 TradeServiceLibScriptTests (EURUSD,H4) [INFO] | [Trade.mqh::CTrade::OrderSend] | CTrade::OrderSend: market buy 0.01 EURUSD sl: 1.08397 tp: 1.08597 [hecho en 1.08497]
2024.01.31 18:42:13.301 TradeServiceLibScriptTests (EURUSD,H4) [INFO] | [Trade.mqh::CTrade::OrderSend] | CTrade::OrderSend: market buy 0.01 EURUSD sl: 1.08391 [hecho en 1.08489]
2024.01.31 18:43:39.998 TradeServiceLibScriptTests (EURUSD,H4) [INFO] | [Trade.mqh::CTrade::OrderSend] | CTrade::OrderSend: market buy 0.01 EURUSD sl: 1.08366 [hecho en 1.08464]
