Yea its easy...
On the 'ACCOUNT HISTORY' tab of your platform. It the one right next the 'TRADES' tab, it keeps record of all your wins and losses.
miawluttu:
I meant, is there a function where we can find if the previous closed trade is a profit/loss, so that we can use it in our EAs? May be use in in something like not to trade in a certain time when the last trade is a loss. Thanks.
I meant, is there a function where we can find if the previous closed trade is a profit/loss, so that we can use it in our EAs? May be use in in something like not to trade in a certain time when the last trade is a loss. Thanks.
Have you ever considered searching the documentation for "history"? Don't mean to be rude, but it's right there in the documentation. I'll give you a hint .. order select.
Here's what you need
#define PLUS 1
#define MINUS 2
int TradeHistory(){
int cnt=HistoryTotal(),tkt;datetime ord;
for(int i=0;i<cnt;i++){
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)){
if(OrderCloseTime()>ord){
tkt=OrderTicket();
ord=OrderCloseTime();
}
}
}
if(OrderSelect(tkt,SELECT_BY_TICKET,MODE_HISTORY)){
if(OrderProfit()>=0)return(PLUS);else return(MINUS);
}
return(-1);
}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
Hi,
Is there any way/code in MT4 that we can use to track wether the previous trade is a loss or a profit?
Thanks.
ML