Download MetaTrader 5
To add comments, please log in or register
All MQL5.community events are grouped together. Have a look at the Wall!
Sherif Hasan
7223
Sherif Hasan 2014.10.02 08:34 

Hi,

I would like to add condition for my EA to place order not exceeding more than 2 orders.

EA place 1st order if its loss again place new order, even it closed with loss no more order.

I want to add condition or how to get total closed order today?

please support me!

Sherif Hasan
7223
Sherif Hasan 2014.10.02 09:35  

tried the following function. but it shows all days closed orders count!

I need of today's closed orders count! please advice me to get!

OrdersHistoryTotal()
darksideofthemoon
57
darksideofthemoon 2014.10.02 09:45  

Confusing info..

Anyway: Make magic number unique for the two trades, i.e. current day number * 10 + (1 or 2).

Then check magic number on last  order from history.. if it reads current day number * 10 +2 your EA is done.

 

Or, if your EA does not run 24/7, you can use a (global) variable that you initialise to zero upon start and count up on each order placed (up to two). 

/
To add comments, please log in or register