How to get price of last order ticket?

 

I want to get price of last order to calculate something, how to get that price of last order (ticket)?

 
Cycle all orders and compare orderopentime.
Return the ticket with highest opentime.
Select that order by ticket.
 
Please give me some example 
 

You are looking for help, so please show you attempt, otherwise yours is not a problem but simply an ask for something, and is not allowed on the forum.

 
Fabio Cavalloni:

You are looking for help, so please show you attempt, otherwise yours is not a problem but simply an ask for something, and is not allowed on the forum.

It is allowed, but such requests are often ignored.

Those who actually make the effort to do something instead of just asking how to do it will be more likely to get help.

This question has been asked and answered hundreds of times in the forum and people get bored with replying to the same question over and over again when a simple search can reveal the answer..

 

I did not mean coding I mean  some flow cause I don't know what is "Cycle all order". If you don't wish to help then just ignore my tread. 

To Keith Watford:

Actually I try to search but found none, event try to think myself. anyway if some one want to ignore it is fine though. but thank you for your reply.

 
Frankie Sila:

I did not mean coding I mean  some flow cause I don't know what is "Cycle all order". If you don't wish to help then just ignore my tread. 


I explained steps that you need to do in order to achieve your desidered result.

If you do not understand what I mean with "cycle all orders" probably you have not knowledge in coding, so you are asking for free code by someone.

Even if I don't like to share free code, because it's not right and useless if you have not knowledge in coding, I share an example to you.

double LastOrderPrice() {
   double price = 0;
   datetime open = 0;
   for( int i=OrdersTotal()-1; i>=0; i-- ) {
      if( !OrderSelect(i,SELECT_BY_POS) ) continue;
      if( OrderOpenTime() > open ) { price = OrderOpenPrice(); open = OrderOpenTime(); }
   }
   return(price);
}
 
Frankie Sila:

To Keith Watford:

Actually I try to search but found none, event try to think myself. anyway if some one want to ignore it is fine though. but thank you for your reply.

That's strange as a simple search with "last order ticket" shows page after page of results.

search

Search - MQL5.community
Search - MQL5.community
  • www.mql5.com
Searching is based on morphology and is insensitive to case. All letters, no matter of their case, will be processed as lowercase. By default, our search engine shows pages, that...
Reason: