Looking forward to the market help.

 
Hello, everybody. Now I want to display the message.
- When the last transaction is greater than 0, it will announce a profit.
- When less than 0 will be reported as a lost.

Can anyone help me write code in programming to get that message? Please help me

Thank you very much.



 
Pieu Hoang A: Can anyone help me write code in programming to get that message? Please help me
Help you with what? You haven't stated a problem.
You have only four choices: We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using SRC) and the nature of your problem.
 
whroeder1:
Help you with what? You haven't stated a problem.
You have only four choices:We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using SRC) and the nature of your problem.

Thank you very much. 


I'm programming a robot. If the last command in the hole history, the following command will double. If that order returns, it will return to the initial value. Code in the MQL4

 

Yes.

if(OrderProfit()<0
 {
  // Loss
 }

if(OrderProfit()>0)
 {
  // Profit
 }
 
Marco vd Heijden:

Yes.


Thank u very much....!


if(OrderSelect(OrderTicket(),SELECT_BY_TICKET,MODE_HISTORY))

  {

   Print("Profit of the last transaction in the history = "+OrderProfit());

  }

  else

  {

  Print("Not..................!");

  }

But it not show for me.

 

if(OrderSelect(OrderTicket(),SELECT_BY_TICKET,MODE_HISTORY))

This doesn't make sense unless you are re-selecting an order for some reason.

When selecting an order by ticket number, MODE_HISTORY and MODE_TRADES are ignored. ie if the above trade is an open order it will still be selected even if you have specified  MODE_HISTORY.