This script uses the logic that within a trending market, there is no such thing as overbought and oversold..
BUY / SELL alert triggers when ADX > 100, and RSI is > 70 (buy) or < 30 (sell). I only consider taking a trade when BUY / SELL alert is triggered, but also only when there is a clear strong trend (you can use MA or Price Action for this). The logic does not work when market is not trending!
Test it out and let me know how it is working for you.