Does anyone have or can code a script for pending orders on candle close?

 

I am looking for a script or EA that would allow one to place a pending order for the close of the next candle. Also would need to be able to set expiration. There would also have to be a way to have the pending order within a range (e.g. min price and max price to accept the buy or sell order). If anyone has something similar to this or can create this, I would be extremely grateful.

Thank You

Reason: