Download MetaTrader 5
To add comments, please log in or register
Create Forum topics and improve your rating!
Andrey Bulezyuk
3043
Andrey Bulezyuk 2014.01.04 08:46 

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
17989
Simon Gniadkowski 2014.01.04 10:11  
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
145
Konstantinos Maleas 2014.01.04 21:15  

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
6297
Tjipke de Vries 2014.01.04 22:43  
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
14199
whroeder1 2014.01.05 02:16  
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
239
JDeel 2014.01.05 02:42  

Try this:

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