This script is a custom trading view indicator that helps to identify potential buy and sell signals based on the RSI (Relative Strength Index) and SMA (Simple Moving Average) indicators. The script also identifies potential reversals using a combination of RSI and price action. It plots buy, sell, and reversal signals on the chart along with an SMA line. Additionally, it provides alerts based on the buy, sell, and reversal conditions.

Changes made to the original script:

Fixed the undeclared identifier 'c' error by calculating the difference between the current closing price and the previous closing price: c = close - close.

Added an "ADD Value Floating Label" to the chart. The label shows the difference between the current and previous closing prices (ADD value) along with a "Bullish" or "Bearish" indicator based on the value of 'c'. The label is positioned at the top right of the visible chart area and remains static.

Here's a summary of the major components of the script:

Input settings: Define the input parameters for RSI and SMA.
Calculation of RSI and SMA: Compute the RSI and SMA values based on the input parameters.
Color definitions: Define colors for different conditions and levels.
Condition definitions: Define various conditions for buy, sell, reversal, and other criteria.
Buy and sell conditions: Determine buy and sell signals based on RSI, SMA, and price action.
Reversal conditions: Identify potential reversals using RSI and price action.
Plot signals: Display buy, sell, and reversal signals on the chart.
Bar colors: Color the bars based on the identified signals.
Plot SMA: Display the SMA line on the chart.
Alert conditions: Set up alerts for buy, sell, and reversal conditions.
ADD Value Floating Label: Add a label to the chart showing the ADD value and a "Bullish" or "Bearish" indicator.
Release Notes:
Moved ADD Label up 10 units from previous day high. It was kind of in the way prior.
Release Notes:
This script corrects the ADD Advance Decline Readings WITH ACCURATE ADD readings as well as moves them to a separate pane. I am still trying to find a way to move the BUY/SELL & Reversal Signals back to the Main Chart, but for now they reside in the ADD pane. Thank you!
Release Notes:
Removal of the ADD Label on the Main Chart:

In the previous version of the script, the ADD indicator was plotted on the main chart with a label (+ or -) indicating its direction. In the current version, this label has been removed from the main chart by commenting out the following line:

Copy code
// plot(a, title='ADD', color=dircol, linewidth=4)
This change ensures that the ADD label (+ or -) no longer appears on the main chart, but the ADD indicator and its associated up and down arrows for reversals remain in the separate ADD frame.

The removal of the ADD label (INCORRECT READING/CALCULATION) was the only change made in the current version compared to the previous version of the script. All other functionality, including the calculation of various technical indicators, buy/sell signals, and reversal signals, remains the same in both versions.

This is a much CLEANER, more accurate indicator now.

indicator(title='CHASES BUY/SELL INDICATOR + ADVANCE DECLINE', shorttitle='BUY/SELL + ADD', precision=2, overlay=false)

// ADD Indicator
a ='USI:ADD', '5', hlc3)
dircol = a > a ? :

//plot(a, title='ADD', color=dircol, linewidth=4)
m10 = ta.sma(a, 10)
plot(m10,, 0), linewidth=2)

// Input settings
rsi_length =, title='RSI Length', step=1)
rsi_upper =, title='Higher Value of RSI', step=1)
rsi_lower =, title='Lower value of RSI', step=1)
sma_length =, title='SMA Length', step=1)

// Calculate RSI and SMA
rsi = ta.rsi(close, rsi_length)
sma = ta.sma(close, sma_length)

// Define colors
color_below_sma =, 30)
color_above_sma =, 30)
color_between =, 30)

// Set color based on conditions
sma_color = rsi >= rsi_upper or rsi <= rsi_lower ? color_between : (high < sma ? color_below_sma : color_above_sma)

// Define distances and gaps
dist_sma = 1
candle_length = 1
gap_above_sma = sma + dist_sma
gap_below_sma = sma - dist_sma
gap_value = open / 100 * candle_length

// Define conditions
min_candle_size_buy = high - low > gap_value
min_candle_size_sell = high - low > gap_value
bull = open < close and high - low > 2 * gap_value and close > (high + open) / 2
bear = open > close and high - low > 2 * gap_value and close < (low + open) / 2

// Reversal conditions
rev1 = rsi > 68 and open > close and open > gap_above_sma and high - low > gap_value + 0.5 and low != close
rev1a = rsi > 90 and open < close and close > gap_above_sma and high != close and open != low
sell_reversal = rev1 or rev1a

rev2 = rsi < 50 and open < close and open < gap_below_sma and open == low
rev3 = rsi < 30 and open > close and high > gap_below_sma and open != high and barstate.isconfirmed != bear
rev4 = rsi < 85 and close == high and high - low > gap_value and open < close
rsi_cross_under_upper = ta.crossunder(rsi, rsi_upper)
rsi_cross_over_lower = ta.crossover(rsi, rsi_lower) and open < close

// Buy and sell conditions
volume_increase = volume > volume
buy_condition = open < close and open > sma and ta.cross(close, sma) and close > sma
sell_condition = ta.cross(close, sma) and open > close
buy_signal = ta.crossover(close, sma) and close > open and high > high and close > open
sell_signal = ta.crossunder(low, sma) and close < open and low < low and close < open

// Calculate the value of 'c'
c = close - close

// Plot signals
plotshape(sell_signal, title='SELL', style=shape.labeldown,, 30), text='SELL',, 30))
plotshape(buy_signal, title='BUY', style=shape.labelup,, 30), text='BUY',, 30), location=location.belowbar)

// Plot reversals
plotshape(rsi_cross_under_upper, title='Reversal1', style=shape.labeldown,, 20), text='↓',, 20))
plotshape(rsi_cross_over_lower, title='Reversal2', style=shape.labelup,, 20), text='↑',, 20), location=location.belowbar)

// Bar colors
barcolor(buy_signal ?, 0) : sell_signal ?, 30) : rsi_cross_under_upper or rsi_cross_over_lower ?, 0) : na)

// Alert conditions
alertcondition(rsi_cross_under_upper or rsi_cross_over_lower, title='Both Reversal Signal', message='Reversal Alert')
alertcondition(sell_signal or buy_signal, title='Buy & Sell Signal Both', message='Buy/Sell Alert')
alertcondition(buy_signal, title='Only Buy Signal', message='Buy Alert')
alertcondition(sell_signal, title='Only Sell Signal', message='Sell Alert')
alertcondition(rsi_cross_under_upper, title='Reversal from Top', message='Down Reversal Alert')
alertcondition(rsi_cross_over_lower, title='Reversal from Down', message='Up Reversal Alert')
Release Notes:
Let's highlight the key differences and what this updated script can do compared to the prior version:

Improved Visualization in ADD Pane:

In this updated script, the ADD indicator and BUY/SELL signals are correctly plotted within the ADD pane. This provides a more organized and visually appealing view of key trading information.
Clearer Buy and Sell Signals:

The script now clearly marks BUY signals with green triangles ('↑') and SELL signals with red triangles ('↓'), making it easier for traders to identify potential entry and exit points.
Enhanced Reversal Signals:

Reversal signals are marked with '↑' and '↓' symbols in the ADD pane, providing additional insights into potential trend changes.
Bar Color Coding:

The script color-codes bars in the main chart to highlight different conditions. Green bars indicate BUY signals, maroon bars indicate SELL signals, and yellow bars indicate reversal signals. This helps traders quickly assess the current market conditions.
Alert System:

The script includes an alert system that can notify traders when specific conditions are met. It can send alerts for both reversals and BUY/SELL signals, allowing traders to stay informed even when they are not actively monitoring the chart.
Customizable Parameters:

The script offers customizable input parameters for RSI length, RSI upper and lower values, and SMA length, allowing traders to adapt the indicator to their preferred trading strategies.
Technical Analysis Features:

The script incorporates various technical analysis features, such as RSI, SMA, and gap-related conditions, to help traders make informed trading decisions.
Consolidated Information:

All key trading information, including the ADD indicator, BUY/SELL signals, and reversals, are now conveniently displayed in one chart. This consolidated view simplifies analysis and decision-making.
Overall, this updated script enhances the visualization, clarity, and functionality of the indicator, making it a valuable tool for traders seeking to identify potential entry and exit points in the market.
Open-source script

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.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?