Merge branch 'dev'

This commit is contained in:
Viacheslav Demydiuk
2025-10-08 16:30:01 +03:00
4 changed files with 17 additions and 11 deletions
+1 -1
View File
@@ -89,7 +89,7 @@ namespace MtApi.Monitors
{ {
//get closed orders from history with actual values //get closed orders from history with actual values
var historyOrders = ApiClient.GetOrders(OrderSelectSource.MODE_HISTORY) ?? []; var historyOrders = ApiClient.GetOrders(OrderSelectSource.MODE_HISTORY) ?? [];
closedOrders = closeOrdersTemp.Where(cot => historyOrders.Find(a => a.Ticket == cot.Ticket) != null).ToList(); closedOrders = historyOrders.Where(cot => closeOrdersTemp.Find(a => a.Ticket == cot.Ticket) != null).ToList();
} }
} }
+4 -7
View File
@@ -1,9 +1,6 @@
using System; using MtApi;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using MtApi;
using MtApi.Monitors; using MtApi.Monitors;
using System.Globalization;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace TestApiClientUI namespace TestApiClientUI
@@ -1088,12 +1085,12 @@ namespace TestApiClientUI
{ {
if (e.Opened != null) if (e.Opened != null)
{ {
PrintLog($"{sender.GetType()}: Opened orders - {string.Join(", ", e.Opened.Select(o => o.Ticket).ToList())}"); PrintLog($"{sender.GetType()}: Opened orders - {string.Join(", ", e.Opened.Select(o => new { o.Ticket, o.Symbol, o.OpenPrice, o.OpenTime }).ToList())}");
} }
if (e.Closed != null) if (e.Closed != null)
{ {
PrintLog($"{sender.GetType()}: Closed orders - {string.Join(", ", e.Closed.Select(o => o.Ticket).ToList())}"); PrintLog($"{sender.GetType()}: Closed orders - {string.Join(", ", e.Closed.Select(o => new { o.Ticket, o.Symbol, o.ClosePrice, o.CloseTime }).ToList())}");
} }
} }
BIN
View File
Binary file not shown.
+12 -3
View File
@@ -3795,16 +3795,25 @@ bool OrderCloseAll()
{ {
if (OrderSelect(i, SELECT_BY_POS)) if (OrderSelect(i, SELECT_BY_POS))
{ {
int type = OrderType(); int type = OrderType();
bool order_closed = true;
switch(type) switch(type)
{ {
//Close opened long positions //Close opened long positions
case OP_BUY: OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red ); case OP_BUY:
{
order_closed = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
break; break;
}
//Close opened short positions //Close opened short positions
case OP_SELL: OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red ); case OP_SELL:
{
order_closed = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red );
break; break;
}
} }
if (order_closed == false)
Print("Failed to close order ", OrderTicket());
} }
} }