Make sure that in the Account History tab that all history is showing (click on it, then right click anywhere inside of it -> All History)
Don't forget to include the Commission and Swap.double sum = OrderProfit() + OrderCommisssion() + OrderSwap();
tempproloss = tempproloss + sum;
I've never used the bottom code before and it's a weekend so I can't test it, but this could be your open P&L, and that's why it's 0.0:
AccountInfoDouble(ACCOUNT_PROFIT);
Make sure that in the Account History tab that all history is showing (click on it, then right click anywhere inside of it -> All History)
I've never used the bottom code before and it's a weekend so I can't test it, but this could be your open P&L, and that's why it's 0.0:
Hi @Alexander Martinez Thank you for your reply and yes All History is showing in the history tab
Don't forget to include the Commission and Swap.
This saved the day, I wasnt adding the commissions and swaps , after adding this Now I am getting the exact P&L perfectly , Thank you

Hi @Alexander Martinez Thank you for your reply and yes All History is showing in the history tab
Don't forget to include the Commission and Swap.
This saved the day, I wasnt adding the commissions and swaps , after adding this Now I am getting the exact P&L perfectly , Thank you

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all.
I am trying to calculate total Profit/Loss of the account but everything I have tried so far has only resulted in failure
its a demo account with deposit : 100K
Profit/Loss : (negative)-31009.63
No active trade
Here is what I have attempted till now :
Then I tried calculating Profit/Loss of all historic trades like this :
Then I tried calculating Profit/Loss Of all orders including deposits etc , like this :
Then I got the Deposit value in a variable and then I tried Calculating Profit/Loss of all closed trades (Not including the deposit etc) and then Subtracted it from Deposit amount , like this :
Been struggling with this for quite some time, but couldn't figure out a way to make it work , can someone please point out What am I missing ?
Thank you.