In TradingView, you may want to take a signal (like RSI oversold or MACD crossover) from one indicator and use it inside another indicator or strategy. Pine Script does not let you directly access another script’s variables, but you can still do it in two ways:
- Recalculate the condition inside your script – just compute RSI, MACD, or other signals again.
- Use an external input – create an indicator that plots a signal, then connect your strategy or another indicator to that signal with
input.source
.
Method 1: Recalculate Inside Your Script #
The easiest way is to calculate the condition again in your own script.
Example: RSI condition in a strategy
//@version=5
strategy("Strategy with RSI Condition", overlay=false)
rsiValue = ta.rsi(close, 14)
if rsiValue < 30
strategy.entry("Buy", strategy.long)
This strategy buys when RSI is below 30, without using any external indicator.
Method 2: Use Another Indicator as a Source #
If you want to keep logic separate, one script can make the signal, and another can use it.
Step 1: Create a signal indicator
//@version=5
indicator("RSI Signal", overlay=false)
rsiVal = ta.rsi(close, 14)
signal = rsiVal < 30 ? 1.0 : 0.0
plot(signal, title="RSI < 30")
This indicator plots 1
when RSI < 30, and 0
otherwise.
Step 2: Create a strategy or indicator that reads the signal
//@version=5
strategy("Strategy Using RSI Signal", overlay=false)
rsiSignal = input.source(close, title="RSI Signal Source")
if rsiSignal == 1.0
strategy.entry("Buy", strategy.long)
How to use:

- Add both the indicator and the strategy / indicator to your chart.
- In the strategy/indicator settings, set Source to the plot from the RSI Signal indicator.
- The strategy or indicator will now trade whenever that external condition is true.
Key Points #
- You cannot directly read variables from another script.
- To reuse conditions:
- Either recompute them inside your script, or
- Plot them as signals (like
0
/1
) in one indicator and useinput.source
in another.
- Strategies can only use one external input at a time.
- External signals must be numeric values, not booleans.
Summary #
You can use indicator conditions across indicators and strategies in TradingView by either recalculating them inside your script, or by creating a signal indicator and connecting it with input.source
. For extra flexibility, you can add selectors to switch between conditions. These methods make your scripts more modular, reusable, and easier to manage.