Calculate the range as the difference between the high and low prices.
The maxRange input to specify the maximum allowable range that defines a sideways market.
The background color is set to blue during sideways market conditions, and it's transparent to some extent (transp=90). When the market is not sideways, the background color is not changed.
The indicator marks the start and end of the session with red triangles.
When the price range (high - low) is within the specified threshold, the indicator will indicate a sideways market with a blue background.