Quote:
|
Originally Posted by fxdk
Is there a method in mql4 for checking whether the last trade resulted in profit or loss, after it's closed?
I'm trying OrderSelect() and OrderProfit() with the HistoryTotal() using an array.. but the OrderProfit seems to be referring to the 'open order' , so it's not giving me the results im wanting.
On average, my system has 5 consecutive wins, to 1 lose. What im wanting to do is, after a losing trade, i want to increase the number of lots used as the chances are the next trade after it will be a win.
I therefore need to check what the last closed trade resulted in, before modifying the number of lots.
Any help would be appreciated...
|
fxdk,
to check the profit of the last closed order use this code:
int total = HistoryTotal();
OrderSelect(total-1,SELECT_BY_POS,
MODE_HISTORY);
Alert(OrderProfit()); //This is the last closed order profit or loss