mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-20 14:18:22 +00:00
Merge branch 'dev'
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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())}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
+12
-3
@@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user