Connect your scripts to more external inputs

May 3, 2023

We’re ready to announce that our Indicator on indicator feature now supports multiple external inputs, up from the previous limit of one. These multiple external inputs can even originate from different indicators.

Here’s a sample strategy script with two input.source() calls:

//@version=5
strategy("Value Area Strategy", overlay = true)

sourceLongInput = input.source(low, "Enter Long after crossing")
sourceShortInput = input.source(high, "Enter Short after crossing")

buyEntry = ta.crossover(close, sourceLongInput)
sellEntry = ta.crossunder(close, sourceShortInput)

if buyEntry
    strategy.entry("LongEntry", strategy.long)
if sellEntry
    strategy.entry("SellEntry", strategy.short)

plot(sourceLongInput, "Long entry source")
plot(sourceShortInput, "Short entry source", color.red)

You could, for example, link this strategy with sources from the “Session Volume Profile” built-in indicator by selecting “Value Area High (VAH)” and “Value Area Low (VAL)” as external inputs from the strategy’s inputs. To do so, first make sure both scripts are loaded on your chart, then bring up the strategy’s “Settings/Inputs” tab and select the relevant source from each of its two source input fields’ dropdown menu.

Multiple external inputs will work with Deep Backtesting, so Premium plan holders can test strategies with multiple inputs on all data available in TradingView data storage.

Note that the sources used as external inputs must originate from indicators; they cannot originate from strategies. Also, external input sources can originate from at most ten different indicators.

You will find more information on this feature in the Help Center and in the Pine Script™ User Manual and Reference Manual.

To stay up to date on new Pine Script™ features, keep an eye on the Release notes in the User Manual. The PineCoders account also broadcasts updates from its Squawk Box on Telegram, its Twitter account, and from the Pine Script™ Q&A public chat on TradingView.

We hope you find this highly-requested feature as useful as we think it’ll be, and please do keep sending us your feedback and suggestions so we can make the platform the best it can be. We build TradingView for you, and we’re always keen to hear your thoughts.

— Team TradingView

Look first Then leap

TradingView is built for you, so make sure you're getting the most of our awesome features
Launch Chart