Cancel Pending Order at Start of New Candle

 

I'm new to programming with MT4 and was wondering how I could cancel a pending order if its not filled by the end of a candle? I'm on an ECN broker so it can't be placed in the OrderSend function. Any ideas would be greatly appreciated.