If your function works perfect, then, it will give you the total profit or loss ...
if in loss, for sure the value will be in negative.
This is my own function I use ... You may try it if you like ... It is almost the same like yours !
double Profit(){ double Pft=0; int total=OrdersTotal(); for (int cnt=0 ; cnt<total ; cnt++){ if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)==true) if(OrderMagicNumber()==magic && OrderSymbol()==Symbol() && (OrderType()==OP_BUY || OrderType()==OP_SELL)){ Pft = Pft + OrderProfit() + OrderCommission() + OrderSwap(); } } return(Pft); }
Osama Shaban:
thanks
If your function works perfect, then, it will give you the total profit or loss ...
if in loss, for sure the value will be in negative.
This is my own function I use ... You may try it if you like ... It is almost the same like yours !

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
how do i calculate total loss using a function similar to this one below
and if the Profit is negative(i.e trades are in loss) will the function below just return a negative value?
int BuyProfit ()
}