Indicator · Pine Script v6 · On the chart

Ichimoku & SuperTrend

by dcaoyuan

This indicator draws a classic Ichimoku cloud on the price chart.

View on GitHub

GitHub stars55on the repository
Pine versionv6current
Lines of code36
Settings0inputs
LicenceApache-2.0
Last update6 months ago20 Apr 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

36 lines of Pine Script v6 from public/indicators/test7.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.

test7.pine
//@version=6
indicator("Ichimoku & SuperTrend", overlay=true)

// --- Ichimoku Cloud ---
conversionPeriods = 9
basePeriods = 26
laggingSpan2Periods = 52
displacement = 26

donchian(len) => math.avg(ta.lowest(len), ta.highest(len))

conversionLine = donchian(conversionPeriods)
baseLine = donchian(basePeriods)
leadLine1 = math.avg(conversionLine, baseLine)
leadLine2 = donchian(laggingSpan2Periods)

// Plot Lines
plot(conversionLine, color=color.new(color.blue, 0), title="Tenkan-sen (Conversion)")
plot(baseLine, color=color.new(color.red, 0), title="Kijun-sen (Base)")

// Plot Cloud
p1 = plot(leadLine1, offset = displacement, color=color.new(color.green, 90), title="Lead 1")
p2 = plot(leadLine2, offset = displacement, color=color.new(color.red, 90), title="Lead 2")
fill(p1, p2, color = leadLine1 > leadLine2 ? color.new(color.green, 80) : color.new(color.red, 80), title="Cloud")

// --- SuperTrend ---
atrPeriod = 10
factor = 3.0
[supertrend, direction] = ta.supertrend(factor, atrPeriod)

// Plot SuperTrend
//plot(supertrend, color = direction < 0 ? color.green : color.red, linewidth=3, title="SuperTrend")

// Display Key Levels
//plotchar(supertrend, "SuperTrend Support", "", location.absolute, color=direction < 0 ? color.green : color.red)
//plotchar(baseLine, "Kijun-sen (Support)", "", location.absolute, color=color.red)

Overview

Ichimoku & SuperTrend plots the Tenkan-sen and Kijun-sen as Donchian midpoints and fills the cloud between the two leading spans, displaced 26 bars ahead, green when Lead 1 is above Lead 2 and red otherwise. Conversion, base, span, and displacement lengths are fixed in the code, and there are no user inputs. A SuperTrend value is calculated from ATR but its plot statements are commented out, so it does not appear on the chart.

Details

Published by

dcaoyuan on GitHub

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Trend

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

aicharttradingvibepinescripttechnical-analysispinestock

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

948 stars

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

Indicator v4 TrendMoving averages
Updated 10 days ago · GPL-3.0 GitHub repository of Adaptive Laguerre Filter
575 stars

This indicator detects equal highs and lows by comparing prices within user-defined left and right bars using a tolerance percentage. It plots horizontal lines on the price chart for equal highs in one color and lows in another. A screener allows input of mult

Indicator v5 Support & resistanceTrend
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Equal Highs and Lows with Screener
330 stars

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

Indicator v4 TrendMoving averages
Updated 2 months ago · None stated GitHub repository of 3 EMA/SMA + Cross [Alorse]
318 stars

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

Indicator v5 TrendVolatility & bands
Updated 2 months ago · MIT GitHub repository of ATR Trailing Stoploss

All Candlestick Patterns

by shunjizhan
292 stars

All Candlestick Patterns detects and highlights a wide range of bullish, bearish, and neutral candlestick patterns directly on the price chart. It features optional trend filtering using either a 50-period simple moving average or a combination of 50-period an

Indicator v4 Candlestick patternsTrend
Updated 3 years ago · None stated GitHub repository of All Candlestick Patterns

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