Download MetaTrader 5

Last Trade!

To add comments, please log in or register
Andrey Bulezyuk
3468
Andrey Bulezyuk  

Hey Guys, i've built an EA and i want to select the very last closed trade. I've tried everything that is in my skillbox. I've researched the forum and read every function that would help me in the documentary, i can't solve this.

I need the ticket of the very last closed Trade, so the EA can differ between loss/win trade (not a problem if get the ticket) and adjust the lot-size for the next trade.

Thank you! :)

Simon Gniadkowski
Moderator
18023
Simon Gniadkowski  
lawbreaker13:

Hey Guys, i've built an EA and i want to select the very last closed trade. I've tried everything that is in my skillbox. I've researched the forum and read every function that would help me in the documentary, i can't solve this.

I need the ticket of the very last closed Trade, so the EA can differ between loss/win trade (not a problem if get the ticket) and adjust the lot-size for the next trade.

Thank you! :)

Learn to use the search and then you won't have to wait for someone to reply to your post . . .

https://www.mql5.com/en/forum/145866

Konstantinos Maleas
165
Konstantinos Maleas  

You can do it in lot of ways.

1. You can compare the tickets and get the higher one

2. You can store in a variable the last lot size

Tjipke de Vries
6361
Tjipke de Vries  
maleas_k:

You can do it in lot of ways.

1. You can compare the tickets and get the higher one

2. You can store in a variable the last lot size


the last closed trade has not always the highest ticketnumber ....

check OrderCloseTime

whroeder1
15311
whroeder1  
lawbreaker13: i've built an EA and i want to select the very last closed trade. I've tried everything that is in my skillbox.
Show us your code. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
JDeel
238
JDeel  

Try this:

OrderSelect(OrdersHistoryTotal()-1,SELECT_BY_POS,MODE_HISTORY)
To add comments, please log in or register