In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.
EG when a market is oversold on the 4h, look for buy signals. That way you only take the trades when the market is over extended.
If the market is ranging sideways, it won't ever get oversold/overbought, therefore cutting out rangebound chop.