Indicator · Pine Script v6 · Own pane

Intraday Spark Chart [AstrideUnicorn]

by regalouisei· code credited to AstrideUnicorn

This indicator calculates and plots the intraday percentage change of the current or a user-selected asset relative to its daily opening price in a separate pane.

View on GitHub

Repaints

GitHub stars2on the repository
Pine versionv6current
Lines of code112
Settings6inputs
LicenceNone statedfile: MPL-2.0
Last update8 months ago25 Feb 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

112 lines of Pine Script v6 from pinescript/editors_picks/intraday-spark-chart-astrideunicorn.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

intraday-spark-chart-astrideunicorn.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © AstrideUnicorn

//@version=6
indicator("Intraday Spark Chart [AstrideUnicorn]", "ISC", overlay=false, scale=scale.right, max_lines_count=500, max_labels_count=500)

// Input for asset selection. This allows user to display other asset intraday price action to perform intermarket analysis.
targetSymbol = input.symbol("", "Asset", tooltip="Leave empty for current symbol.", group = "Main")

// Visual settings for controlling colors and transparencies of the indicator elements.

outlineTransparency = input.int(0, title="Plot Transp.", minval=0, maxval=100, step=1, group = "Visual", tooltip="Main plot transparency: 0 - non transparent, 100 - fully transparent.")
areaTransparency = input.int(80, title="Fill Transp.", minval=0, maxval=100, step=1, group = "Visual", tooltip="Area fill transparency: 0 - non transparent, 100 - fully transparent.")
positiveColor = input.color(#4CAF50, title = "Positive", group = "Visual", tooltip="Color when price is above the daily open")
negativeColor = input.color(#F44336, title = "Negtative", group = "Visual", tooltip="Color when price is below the daily open")
neutralColor = input.color(#787B86, title = "Neutral", group = "Visual", tooltip="Color for the static elements and information.")

// Timeframe check. If timeframe is higher than 4 hours display a warning instead of the indicator.
var table tfWarning = table.new(position.middle_center, 1, 1)
isIntraday = timeframe.in_seconds() <= 4 * 60 * 60
showWarning = not isIntraday
if showWarning
    table.cell(tfWarning, 0, 0, "This is an intraday indicator. Please, switch to a lower timeframe.", text_color=neutralColor)

// Get pricing data for selected asset.
assetClose = request.security(targetSymbol == "" ? syminfo.tickerid : targetSymbol, 
  timeframe.period, close, lookahead=barmerge.lookahead_off)

dailyOpen = isIntraday ? request.security(targetSymbol == "" ? syminfo.tickerid : targetSymbol, "D", open,
  lookahead=barmerge.lookahead_on) : na
// lookahead_on is needed to align daily open prices with the corresponding intraday timeframe pricing data. 

// Calculate percentage changes using selected asset's data
percentChange = isIntraday ? (assetClose - dailyOpen) / dailyOpen * 100 : na

// Day identification
isNewDay = isIntraday ? ta.change(time("D")) : 0


// Calculate the average daily range as a percentage of the daily opening price 
// to adjust the indicator's plotting area and to position the elements on it.
dailyATR = request.security(targetSymbol, "1D", ta.sma(100*(high-low)/open,500))

// Vertical lines for day separators
if isIntraday and isNewDay != 0
    line.new(bar_index, -1.1*dailyATR, bar_index, 1.1*dailyATR, color=neutralColor, width=1, style=line.style_dotted, xloc=xloc.bar_index)

// Baseline
plot(isIntraday ? 0 : na, "Zero Line", color= neutralColor, linestyle = plot.linestyle_dotted)

// Main plots
outlineColor = not isIntraday ? color.new(color.white, 100) : 
           isNewDay !=0 ? color.new(color.black, 100) : 
           percentChange > 0 ? color.new(positiveColor, outlineTransparency) : 
           color.new(negativeColor, outlineTransparency)

areaColor = not isIntraday ? color.new(color.white, 100) : 
           isNewDay !=0 ? color.new(color.black, 100) : 
           percentChange > 0 ? color.new(positiveColor, areaTransparency) : 
           color.new(negativeColor, areaTransparency)

plot(percentChange, "Plot", color=outlineColor, linewidth=2, style=plot.style_line)
plot(percentChange, "Fill", color=areaColor, linewidth=1, style=plot.style_area)

// Daily open price label
if isIntraday and isNewDay !=0
    label.new(
      bar_index, dailyATR, 
      text="Op:"+str.tostring(dailyOpen, format.mintick), 
      color=color.new(color.gray, 100), 
      textcolor=color.new(neutralColor,0), 
      style=label.style_label_left, 
      size=size.small, 
      yloc=yloc.price
     )

// Daily percentage change label system
var label[] dayLabels = array.new_label(0)
var int currentDayLabelIndex = -1

if isIntraday

    isPositive = percentChange >= 0
    if isNewDay !=0
        if array.size(dayLabels) > 0 and currentDayLabelIndex >= 0
            prevDayPct = percentChange[1]
            prevIsPositive = prevDayPct >= 0
            str_arrow = prevIsPositive ? "▲" : "▼"
            label.set_text(array.get(dayLabels, currentDayLabelIndex),str_arrow + str.format("{0, number, +#.##%;-#.##%}", prevDayPct/100))
            label.set_textcolor(array.get(dayLabels, currentDayLabelIndex), prevIsPositive ? color.new(positiveColor,0) : color.new(negativeColor,0))
            label.set_color(array.get(dayLabels, currentDayLabelIndex), prevIsPositive ? color.new(positiveColor,100) : color.new(negativeColor,100))
        
        
        lbl = label.new(bar_index, 0.75*dailyATR, text = str.format("{0, number, +#.##%;-#.##%}", percentChange/100), 
          color=color.new(isPositive ? positiveColor : negativeColor, 100), 
          textcolor=isPositive ? color.new(positiveColor,0) : color.new(negativeColor,0), style=label.style_label_left, size=size.small, yloc=yloc.price)
        array.push(dayLabels, lbl)
        currentDayLabelIndex := array.size(dayLabels) - 1
    

    if barstate.islast and array.size(dayLabels) > 0 and currentDayLabelIndex >= 0
        str_arrow_current = isPositive ? "▲" : "▼"
        label.set_text(array.get(dayLabels, currentDayLabelIndex), str_arrow_current + str.format("{0, number, +#.##%;-#.##%}", percentChange/100))
        label.set_textcolor(array.get(dayLabels, currentDayLabelIndex), isPositive ? color.new(positiveColor,0) : color.new(negativeColor,0))


// Create and manage the ticker indication table
var table tickerTable = table.new(position = position.bottom_right, columns = 1, rows = 1, border_width = 1)

// Update the ticker table on the Last bar
if barstate.islast and targetSymbol !=  ticker.standard(syminfo.tickerid) and isIntraday
    table.cell(tickerTable, column = 0, row = 0, text = str.tostring(targetSymbol), text_color = isIntraday and targetSymbol==""? color.new(color.black, 100) : color.new(neutralColor,0), text_size = size.normal)

Overview

Intraday Spark Chart [AstrideUnicorn] color-codes positive and negative returns dynamically and draws vertical day separator dotted lines. The plot height and separator boundaries are scaled using a 500-period average daily range calculation. It includes custom asset selection for intermarket comparison and displays a warning message on timeframes above four hours. The indicator utilizes daily security requests with lookahead enabled to align daily open values.

Details

Published by

regalouisei on GitHub

Code credit

AstrideUnicorn, as written in the script's header

Type

Indicator, Pine Script v6

Draws

Separate pane below the chart

Category

Sessions & time

Markets

Any symbol

Timeframes

M1-M5, M15-H1

Risk Notes

  • Reads higher-timeframe data with lookahead on, so the history can show signals that were not there in real time

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
AssetsymboltargetSymbol
Plot Transp.int0outlineTransparency
Fill Transp.int80areaTransparency
Positivecolor#4CAF50positiveColor
Negtativecolor#F44336negativeColor
Neutralcolor#787B86neutralColor
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.

Similar Pine Scripts

This indicator plots a Supertrend-based trend-following setup in a separate pane and skips conditions it treats as a sideways market. A volatility range is built from an ATR value, with RMA, SMA, EMA, or WMA smoothing, or from a fixed point distance. Optional

Indicator v5 TrendVolatility & bands
Updated 1 year ago · MPL-2.0 GitHub repository of Trend Following Setup - Sideways Market Skipper
549 stars

Range Volume Change compares volume inside a chosen session window with the same window on the previous day and plots that change as a percentage. It accumulates volume during the window and, when enabled, volume outside it, drawing growing columns in a separa

Indicator v5 VolumeSessions & time Repaints
Updated 10 months ago · None stated GitHub repository of Range Volume Change
257 stars

Donald SPX - Options Trading is an indicator designed to assist SPX index option traders by tracking session benchmarks and multi-timeframe moving average data. It calculates a 200-period weighted moving average (WMA) and requests multi-timeframe bar data from

Indicator v5 Moving averagesScreeners & dashboards Repaints
Updated 6 weeks ago · None stated GitHub repository of Donald SPX - Options Trading

Bar date/time

by be-thomas
65 stars

This indicator plots each bar's opening time as a numeric series in a separate pane. It uses Pine Script's built-in time value and draws one plot, not an overlay on price. There are no inputs, so the line follows the chart's bar timestamps without filters or o

Indicator v4 Sessions & time
Updated 4 days ago · GPL-3.0 GitHub repository of Bar date/time
46 stars

This indicator summarizes higher-timeframe candle range statistics by time of day and shows them in a table in a separate pane. It groups candles into slots for 5-minute, 15-minute, 1-hour, 4-hour, 8-hour, or 12-hour periods over a chosen lookback in days, and

Indicator v5 Screeners & dashboardsSessions & time Repaints
Updated 7 weeks ago · None stated GitHub repository of HTF Candle Stats by Time of Day
10 stars

This indicator plots the active hours of major global trading sessions including Tokyo, Berlin, London, Sydney, and New York. It dynamically adjusts session times based on whether the instrument is classified as a traditional market or crypto. The script uses

Indicator v4 Sessions & time
Updated 5 years ago · None stated GitHub repository of My Trading Sessions

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers