1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
52 lines of Pine Script v6 from test-v6-features.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.
test-v6-features.pine
//@version=6
indicator("Pine Script v6 Test Features", overlay=true)
// Test 1: Dynamic Requests (v6 Feature)
symbols = array.from("AAPL", "GOOGL", "MSFT")
for symbol in symbols
// Dynamic symbol requests - now possible in v6!
price = request.security(symbol, "1D", close)
log.info("Price for " + symbol + ": " + str.tostring(price))
// Test 2: Enhanced Text Features (v6 Feature)
if barstate.islast
// Use exact point sizes for text
label.new(bar_index, high, "Bold Text",
text_size = 16, // Exact points instead of size.large
text_formatting = text.format_bold)
label.new(bar_index, low, "Italic Text",
text_size = 14,
text_formatting = text.format_italic)
// Combined formatting
label.new(bar_index, (high + low) / 2, "Bold & Italic",
text_size = 18,
text_formatting = text.format_bold + text.format_italic)
// Test 3: Boolean Optimizations with Short-circuit Evaluation (v6 Feature)
myArray = array.new<float>()
if close > open
array.push(myArray, close)
// Short-circuit evaluation - more efficient in v6!
if array.size(myArray) > 0 and array.first(myArray) > 0
// array.first() only evaluated if size > 0
label.new(bar_index, high * 1.01, "Safe Array Access!")
// Test 4: Negative Array Indices (v6 Feature)
if array.size(myArray) >= 2
// Access last element with negative index
lastValue = array.get(myArray, -1) // Last element
secondLast = array.get(myArray, -2) // Second to last
if lastValue > secondLast
label.new(bar_index, low * 0.99, "Upward trend detected")
// Test 5: Strategy Order Trimming (v6 Feature)
// In v6, strategies no longer error at 9000 trades
// They automatically trim oldest orders instead
plot(close)
Overview
Pine Script v6 Test Features requests the daily close for a fixed list of stock symbols and writes those prices to the log. On the last bar it draws labels using exact point sizes and bold or italic text. It stores bullish closes in an array, reads recent values with negative indices, and adds a label when the latest value is higher. It also plots the chart close. There are no inputs and no trade signals.
Dynamic daily security requests for listed symbols
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
The Adaptive Laguerre Filter calculates a smoothed, dynamically adjusted trendline plotted directly on the main price chart. It dynamically adjusts its damping factor (alpha) based on recent price range variations and median percentile calculations over a spec
The indicator plots ICT displacement candles on the price chart and can switch to retracement scanning. Displacement requires a move larger than a set share of the 14-bar average high-low range, lasting at least a chosen number of bars, with optional close, pr
This indicator classifies each bar as bull, bear, or sideways from a rolling log return compared with adjustable percentage thresholds. It paints a regime ribbon on the price chart, shows a current-regime banner, and labels state changes after a minimum hold.
This script plots three moving averages on the price chart: a fast EMA or SMA with 10 periods, a slow EMA or SMA with 20 periods, and a trend EMA or SMA with 100 periods. It signals trend changes by drawing a white cross when the fast moving average crosses ab
This indicator calculates an ATR trailing stop line derived from the highest high minus an average true range multiple over a specified lookback period. It plots the trailing stop line directly on the price chart and colors price bars based on whether the clos
1833 Tracker is an overlay indicator that visualizes historical buy and sell transactions executed by ARK Invest ETFs for the stock on the main price chart. It displays trade dates using green buy and red sell labels positioned relative to price bars, indicati