In this script, the buy and sell criteria are based on the Relative Strength Index (RSI) values calculated for two different timeframes: the 15-minute RSI and the hourly RSI. These timeframes are used together to check signals when certain thresholds are crossed, providing confirmation across both short-term and longer-term momentum.
Buy Criteria:
Condition 1:
Hourly RSI > 60: This means the longer-term momentum shows strength.
15-minute RSI crosses above 60: This shows that the shorter-term momentum is catching up and confirms increasing strength.
Condition 2:
15-minute RSI > 60: This indicates that the short-term trend is already strong.
Hourly RSI crosses above 60: This confirms that the longer-term trend is also gaining strength.
Both conditions aim to capture the moments when the market shows increasing strength across both short and long timeframes, signaling a potential buy opportunity.
Sell Criteria:
Condition 1:
Hourly RSI < 40: This indicates that the longer-term trend is weakening.
15-minute RSI crosses below 40: The short-term momentum is also turning down, confirming the weakening trend.
Condition 2:
15-minute RSI < 40: The short-term trend is already weak.
Hourly RSI crosses below 40: The longer-term trend is now confirming the weakness, indicating a potential sell.
These conditions work to identify when the market is showing weakness in both short-term and long-term timeframes, signaling a potential sell opportunity.
ADX Confirmation :
The Average Directional Index (ADX) is a key tool for measuring the strength of a trend. It can be used alongside the RSI to confirm whether a buy or sell signal is occurring in a strong trend or during market consolidation. Here's how ADX can be integrated:
ADX > 25: This indicates a strong trend. Using this threshold, you can confirm buy or sell signals when there is a strong upward or downward movement in the market.
Buy Example: If a buy signal (RSI > 60) is triggered and the ADX is above 25, this confirms that the market is in a strong uptrend, making the buy signal more reliable.
Sell Example: If a sell signal (RSI < 40) is triggered and the ADX is above 25, it confirms a strong downtrend, validating the sell signal.
ADX < 25: This suggests a weak or non-existent trend. In this case, RSI signals might be less reliable since the market could be moving sideways.
Final Approach:
The RSI criteria help identify potential overbought and oversold conditions in both short and long timeframes.
The ADX confirmation ensures that the signals generated are happening during strong trends, increasing the likelihood of successful trades by filtering out weak or choppy market conditions.
This combination of RSI and ADX can help traders make more informed decisions by ensuring both momentum and trend strength align before entering or exiting trades.