Fix agent volume
This commit is contained in:
@@ -461,22 +461,24 @@ public static class TradingBox
|
||||
foreach (var position in positions)
|
||||
{
|
||||
// Add entry volume
|
||||
totalVolume += position.Open.Quantity * position.Open.Price;
|
||||
totalVolume += position.Open.Quantity * position.Open.Price * position.Open.Leverage;
|
||||
|
||||
// Add exit volumes from stop loss or take profits if they were executed
|
||||
if (position.StopLoss.Status == TradeStatus.Filled)
|
||||
{
|
||||
totalVolume += position.StopLoss.Quantity * position.StopLoss.Price;
|
||||
totalVolume += position.StopLoss.Quantity * position.StopLoss.Price * position.StopLoss.Leverage;
|
||||
}
|
||||
|
||||
if (position.TakeProfit1.Status == TradeStatus.Filled)
|
||||
{
|
||||
totalVolume += position.TakeProfit1.Quantity * position.TakeProfit1.Price;
|
||||
totalVolume += position.TakeProfit1.Quantity * position.TakeProfit1.Price *
|
||||
position.TakeProfit1.Leverage;
|
||||
}
|
||||
|
||||
if (position.TakeProfit2 != null && position.TakeProfit2.Status == TradeStatus.Filled)
|
||||
{
|
||||
totalVolume += position.TakeProfit2.Quantity * position.TakeProfit2.Price;
|
||||
totalVolume += position.TakeProfit2.Quantity * position.TakeProfit2.Price *
|
||||
position.TakeProfit2.Leverage;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user