Download MetaTrader 5

Need Help to total orders closed current day?

To add comments, please log in or register
Sherif Hasan
7307
Sherif Hasan  

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
7307
Sherif Hasan  

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  

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