How To make an EA only open order 10 minute after market opens for the day, and close all order 10 minutes before market close for the day

 

Hello trader, i have already build the function that will send the market and pending order, i just need someone to write a conditional statement for me that will check if the
market has open for the day 10 minute ago, the the function will run and placed the order.
and once it is remaining 10 minute for the market to close for the day i want to select the orders by ticket and closed them.

for example

if(itIsTenMinutePassMarketOpenTimeForToday){

runMarketEntryFunction();

}

if(itIsRemainingTenMinuteBeforeMarketClosedForToDay){

if(OrderSelect(1234567890,SELECT_BY_TICKET,MODE_TRADES)){

OrderClose(1234567890);

}

}
Reason: