Consolidation based strategy

Please help me code these conditions for an options strategy:

  1. The price is consolidating in a range for the previous 10 candles in 5-minute timeframe.

  2. A buy signal is generated when a candle breaks out from the range.

@trade4lyf Check out the below image to learn how to create the conditions: