Indicator · Pine Script v6 · Own pane

Grid Bot Supertrend Channel [psyll]

by cullyk· code credited to Copyright

This indicator builds a Supertrend-style channel from ATR and the median price, then tracks the highest and lowest prices between trend flips.

View on GitHub

Repaints

GitHub stars2on the repository
Pine versionv6current
Lines of code70
Settings14inputs
LicenceMIT
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

70 lines of Pine Script v6 from plugins/Grid Bot [Grid range plugin] Supertrend Channel [psyll].pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

Grid Bot [Grid range plugin] Supertrend Channel [psyll].pine
//@version=6
// Author: Psyll.com
// Email: info@psyll.com
// Website: https://psyll.com
// Copyright: Copyright © 2025 psyll.com. All rights reserved.
indicator('Grid Bot [Grid range plugin] Supertrend Channel [psyll]', overlay = false)
decimal_places = 0
tick_size = syminfo.mintick
while tick_size < 1
    tick_size := tick_size * 10
    decimal_places := decimal_places + 1
    decimal_places
settings_group = 'Settings #################################################'
supertrend_length = input.int(14, 'Lenght', group = settings_group, display = display.none)
supertrend_mult = input(2, 'Mutlipler', group = settings_group, display = display.none)
supertrend_offset = input.float(1, 'Offset', group = settings_group, display = display.none)
smooth = input.int(1, 'Smoothness', minval = 1, group = settings_group, display = display.none)
width_min = input.float(0, 'Min width', group = settings_group, display = display.none)
width_max = input.float(99999, 'Max width', group = settings_group, display = display.none)
width_min_half = width_min / 2
width_max_half = width_max / 2
tf_group = 'Timeframe ###############################################'
tf_confirmation_wait = input.bool(defval = true, title = 'Wait for confirm', group = tf_group, inline = tf_group, display = display.none)
tf_no_repaint_security = input.bool(defval = true, title = 'No repaint', group = tf_group, inline = tf_group, display = display.none)
tf_barmerge_lookahead = input.bool(defval = false, title = 'Lookahead', group = tf_group, inline = tf_group, display = display.none)
tf_barmerge_gaps = input.bool(defval = false, title = 'Gaps', group = tf_group, inline = tf_group, display = display.none)
tf_type = input.string(title = 'Type', options = ['Static', 'Custom'], defval = 'Static', group = tf_group, display = display.none)
tf_static = input.timeframe(defval = '', title = 'Static', group = tf_group, display = display.none)
tf_custom = str.tostring(input.int(1, 'Custom', group = tf_group, display = display.none))
tf_type_value = switch tf_type
    'Static' => tf_static
    'Custom' => tf_custom
tf_security(source) =>
    request.security(syminfo.tickerid, tf_type_value, tf_no_repaint_security ? source[barstate.isrealtime ? 1 : 0] : source, gaps = tf_barmerge_gaps ? barmerge.gaps_on : barmerge.gaps_off, lookahead = tf_barmerge_lookahead ? barmerge.lookahead_on : barmerge.lookahead_off)[tf_no_repaint_security ? barstate.isrealtime ? 0 : 1 : 0]
display_group = 'Display ##################################################'
price_color = input.color(color.black, 'Candles color', display = display.none, group = display_group)
plotcandle(open, high, low, close, color = price_color, bordercolor = price_color, wickcolor = price_color, display = display.pane)
upper = 0.
lower = 0.
os = 0
max = 0.
min = 0.
src = tf_security(close)
atr = tf_security(ta.atr(supertrend_length)) * supertrend_mult
up = tf_security(hl2) + atr
dn = tf_security(hl2) - atr
upper := src[1] < upper[1] ? math.min(up, upper[1]) : up
lower := src[1] > lower[1] ? math.max(dn, lower[1]) : dn
os := src > upper ? 1 : src < lower ? 0 : os[1]
spt = os == 1 ? lower : upper
max := ta.cross(src, spt) ? nz(math.max(max[1], src), src) : os == 1 ? math.max(src, max[1]) : math.min(spt, max[1])
min := ta.cross(src, spt) ? nz(math.min(min[1], src), src) : os == 0 ? math.min(src, min[1]) : math.max(spt, min[1])
avg = math.avg(max, min)
grid_high = max + supertrend_offset
grid_low = min - supertrend_offset
grid_middle = (grid_high + grid_low) / 2
if grid_high - grid_low < width_min
    grid_high := grid_middle + width_min_half
    grid_low := grid_middle - width_min_half
    grid_low
if grid_high - grid_low > width_max
    grid_high := grid_middle - width_max_half
    grid_low := grid_middle + width_max_half
    grid_low
grid_middle := ta.sma(grid_middle, smooth)
grid_high := ta.sma(grid_high, smooth)
grid_low := ta.sma(grid_low, smooth)
plot(grid_high, 'High', color.green, display = display.all)
plot(grid_middle, 'Middle', color.silver, display = display.pane)
plot(grid_low, 'Low', color.red, display = display.all)

Overview

Grid Bot Supertrend Channel [psyll] plots a grid high, grid low and midpoint, shifted by an offset, and can filter the channel by minimum and maximum width. Length, multiplier, smoothness and a selectable timeframe change the calculation. Optional security settings control confirmation, gaps and lookahead. It draws candles and the channel in a separate pane and does not place orders.

Details

Published by

cullyk on GitHub

Code credit

Copyright, as written in the script's header

Type

Indicator, Pine Script v6

Draws

Separate pane below the chart

Category

Trend, Volatility & bands, Support & resistance

Markets

Any symbol

Timeframes

Any timeframe

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
Lenghtint14supertrend_length
Mutliplerint2supertrend_mult
Offsetfloat1supertrend_offset
Smoothnessint1smooth
Min widthfloat0width_min
Max widthfloat99999width_max
Wait for confirmbooltruetf_confirmation_wait
No repaintbooltruetf_no_repaint_security
Lookaheadboolfalsetf_barmerge_lookahead
Gapsboolfalsetf_barmerge_gaps
TypestringStatictf_type
Statictimeframetf_static
Show all 14 settings
SettingTypeDefaultVariable
Customint1Custom
Candles colorcolorcolor.blackprice_color
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

SuperTrend

by SiegerTerpstra
5 stars

This indicator calculates and plots dynamic SuperTrend volatility bands around median price to identify market trend direction. It signals bullish conditions when price stays above the green support line and bearish conditions when price falls below the red re

Indicator v6 TrendVolatility & bands
Updated 9 months ago · None stated GitHub repository of SuperTrend
4 stars

This indicator is a live strategy scanner for cryptocurrency pairs. It runs six strategies on the current chart, tracks their wins and losses, and rates them to show the best one for this pair and timeframe. It uses ATR for adaptive TP/SL, auto-scales based on

Indicator v5 Oscillators & momentumVolatility & bands
2 stars

This indicator tracks market direction by combining Bollinger Bands breakouts with ATR-adjusted pivot point channels. It establishes a primary trend line based on price breaking outer Bollinger Bands filtered by ATR, then validates the movement with a secondar

Indicator v4 TrendVolatility & bands
Updated 5 years ago · None stated GitHub repository of DeFi Follow Line Trend Signal

The Keltner Center Of Gravity Channel Mutations Indicator calculates adaptive channel metrics based on Donchian range Fibonacci levels (38.2% and 61.8%) and Average True Range (ATR) offsets. The lookback period automatically adjusts according to the active tim

Indicator v5 Volatility & bandsVolume
Updated 8 months ago · None stated GitHub repository of Keltner Center Of Gravity Channel Mutations Indicator

[RS]Donchian Fans

by ricardosantos79
261 stars

This indicator plots Donchian Channel boundary lines along with dynamic fan projections directly on the price chart. It calculates the highest high, lowest low, and median price over a customizable lookback period. Whenever price establishes a new channel high

Indicator v4 Support & resistanceTrend
Updated 4 years ago · None stated GitHub repository of [RS]Donchian Fans

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