close all orders

Please help me with closing all buy and sell orders simultaneously with single click in mql5.

Thanks 

Sumit Roy :

Please help me with closing all buy and sell orders simultaneously with single click in mql5.

Thanks 

I apologize for asking this, but what is your job?

Ahmet Metin Yilmaz:

I apologize for asking this, but what is your job?

What's that question ?
Alain Verleyen :
What's that question ?

It was to ensure empathy.

Ahmet Metin Yilmaz:

I apologize for asking this, but what is your job?

Sorry for late Reply.... Actually i am trying to build a trading strategy in which i want to close all position simultaneously when certain conditions are met.

Thanks

Sumit Roy:

Sorry for late Reply.... Actually i am trying to build a trading strategy in which i want to close all position simultaneously when certain conditions are met.

Thanks

And , did you do smth for this? Or did you try ?

If yes share your work here 

someone can show you right way to do .

Ahmet Metin Yilmaz:

And , did you do smth for this? Or did you try ?

If yes share your work here 

someone can show you right way to do .

i don't know how to attach the code here. can you help me?

//if condition true ???
for(int i = OrdersTotal()-1; i >= 0 ; i--)
{
   OrderSelect(i, SELECT_BY_POS);
   int CloseO = OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),3);  
}
bind that code to chart event if you want to use button clicks
Sumit Roy:

i don't know how to attach the code here. can you help me?

You can paste your code with pressing Alt+S here.