MT5 expert advisor - how close all opened positions by EA

 

Hi,

I need a function  (close_all_orders)   that close all opened positions by the EA.

The idea is to close all opened positions by EA after the end of day 

void OnTick()
{

if(Hour()==16 && Min()==55)
 close_all_opened();

else ExtExpert.OnTick(); 

}