From the manual:
TradeProft: The current profit or loss of the trade in units of the account currency, including costs such as spread, rollover, slippage, and commission.
In this context your statement
The profit of trades is only known _after_ they are really closed
confuses me a little because I unterstand the manual's "current" as if TradeProfit shows the actual profit of a trade at any time during the trade. What is right?
And concerning
Update: I just notice a bug in your printf statement - you're printing a float instead of a var.
I think I tried to print a var. From the manual:
For printing float variables with the %f placeholder, typecast them to (var).
Should I better use
print(TO_LOG,"\nTradeProfit: %.2f",(var)TradeProfit);
if TradeProfit is a float?