Which alternative there is to have the amount of commissions and swap to a closed position in the historical tester?
The instruction ord.getCommission () gives the value 0.0
List<IOrder> ordersAll = history.getOrdersHistory(_instrument, timeLoadOrder(), ora());
for (IOrder ord:ordersAll)
{
String label = ord.getLabel();
if (!label.substring(0, _label.length()).equals(_label))
{
continue;
}
else
{
if (cmd(ord) < 2)
{
if (ord.getState() == IOrder.State.CLOSED)
{
totale += ord.getProfitLossInAccountCurrency() - ord.getCommission();
print ("Load Order closed: " + ord.getLabel() + " profit: " + df2.format(ord.getProfitLossInAccountCurrency()) + " commission: " + df2.format(ord.getCommission()));
}
}
}
}
result:
EUR/USD : Load Order closed: EURUSD1437034789915_L1 profit: 0,55 commission: 0
JForex Live 2.45.12
Api 2.12.21
Thanks.