loop through OrdersHistoryTotal() filtering by OrderSymbol() and summing up OrderProfit() + OrderSwap() for all applicable trades.
1005phillip:
loop through OrdersHistoryTotal() filtering by OrderSymbol() and summing up OrderProfit() + OrderSwap() for all applicable trades.
Im sorry, I explained it wrong.
I am looking for current pair equity.
so lets say i have 4 trades open I want to know when combined if they are in profit or loss.
bauerjj10:
Im sorry, I explained it wrong.
I am looking for current pair equity.
so lets say i have 4 trades open I want to know when combined if they are in profit or loss.
Nevermind Figured it out, Thanks
Try this: Sums profit/loss values for current open orders.
double ProfitOpenOrders() { double value=0; for (int i=0; i<OrdersTotal(); i++) { if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) if((OrderSymbol()==Symbol()) && OrderMagicNumber() == MagicNumber) { value+=OrderProfit(); } } return(value); }
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
I am trying to figure out if there is a way in MT4 to return the profit value of a specific pair.
Exactly what the AccountProfit() returns, except only each individual pair's profit.
Thanks