You have to select the order by its ticket from history orders.
Then you get the profit (in $) by OrderProfit()
Then you get the profit (in $) by OrderProfit()
mtbb805: TpAmount+=OrderTicket(OrderProfit);
- When you post code please use the SRC button! Please edit your post.
General rules and best pratices of the Forum. - General - MQL5 programming forum - OrderTicket(whatever) is bogus. Perhaps you should read the manual.
OrderProfit - Trade Functions - MQL4 Reference - Select an order by ticket first. Remember net profit = OrderProfit() + OrderSwap() + OrderCommission()
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 have a scirpt that will close all trades.. At the end it prints that the trade was closed successfully... Can i add this line of code (TpAmount+=OrderTicket(OrderProfit);) and get the profit/loss of the trade just closed and have it add to my previous TpAmount variable?
here is the code...
{ Print("* ",OrderSymbol(),", ticket: ",OrderTicket()," closed.");
TpAmount+=OrderTicket(OrderProfit);
break;
}