Open order on new candel help

 
Does anyone have an example of how to place an order on the next new candle? I'm trying to create a buy/sell line that will place a trade on the next candle as soon as a given function = true.

I really appreciate any help!
 
Reason: