Indicator · Pine Script v4 · On the chart

Ichimoku + SuperTrend + 3MA + Bollinger Bands

by 7PH· code credited to PowerHat

Combines Ichimoku Cloud, SuperTrend, Bollinger Bands, and three moving averages into a single overlay indicator.

View on GitHub

GitHub stars3on the repository
Pine versionv4older, still runs
Lines of code91
Settings17inputs
LicenceNone statedfile: MPL-2.0
Last update4 years ago17 Feb 2022

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

91 lines of Pine Script v4 from main.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

main.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © PowerHat

//@version=4

// Title
study(title="Ichimoku + SuperTrend + 3MA + Bollinger Bands", shorttitle="ICH + ST + 3MA + BB", overlay=true)

// cyan:       #B2EBF2
// blue:       #3179F5
// purple 3:   #e91e63
// purple 2:   #9c27b0
// purple 1:   #673ab7



// Ichimoku
conversionPeriods = input(9, minval=1, title="Conversion Line Length")
basePeriods = input(26, minval=1, title="Base Line Length")
laggingSpan2Periods = input(52, minval=1, title="Leading Span B Length")
displacement = input(26, minval=1, title="Displacement")
donchian(len) => avg(lowest(len), highest(len))
conversionLine = donchian(conversionPeriods)
baseLine = donchian(basePeriods)
leadLine1 = avg(conversionLine, baseLine)
leadLine2 = donchian(laggingSpan2Periods)
plot(conversionLine, color=#e91e63, title="Conversion Line")
plot(baseLine, color=#9c27b0, title="Base Line", display=display.none)
plot(close, offset=- displacement + 1, color=#673ab7, title="Lagging Span", display=display.none)
pp1 = plot(leadLine1, offset=(displacement - 1), color=#A5D6A7, title="Leading Span A", display=display.none)
pp2 = plot(leadLine2, offset=(displacement - 1), color=#EF9A9A, title="Leading Span B", display=display.none)
fill(pp1, pp2, color=(leadLine1 > leadLine2 ? #FFFFFF : #666666), transp=75)



// SuperTrend
atrPeriod = input(10, "ATR Length")
factor = input(3, "Factor")
[supertrend, direction] = supertrend(factor, atrPeriod)
bodyMiddle = plot((open + close) / 2, display=display.none)
upTrend = plot(direction < 0 ? supertrend : na, "Up Trend", color=#B2EBF2, style=plot.style_linebr)
downTrend = plot(direction < 0? na : supertrend, "Down Trend", color=#3179F5, style=plot.style_linebr)
fill(bodyMiddle, upTrend, color.new(#B2EBF2, 90), fillgaps=false)
fill(bodyMiddle, downTrend, color.new(#3179F5, 90), fillgaps=false)


// Inputs
len_bb = input(20, minval=1, title="BB Length")
mult = input(2.0, minval=0.001, maxval=50, title="StdDev")
bbp = input (100, minval=3, title ="BBand Pinch length")
myMAc = input(false, "Tick On: EMA. Off: SMA")
len_fast = input(type=input.integer, defval=50,  minval=1, title="MA Fast Length")
resfast = input(title="MA Timeframe", type=input.resolution, defval="")
len_std = input(type=input.integer, defval=100, minval=2, title="MA Standard Length")
resstd = input(title="MA Timeframe", type=input.resolution, defval="")
len_slow = input(type=input.integer, defval=200, minval=3, title="MA Slow Length")
resslow = input(title="MA Timeframe", type=input.resolution, defval="")

src = input(close, title="Source")


// BB
basis = sma(src, len_bb)
dev = mult * stdev(src, len_bb)
bbbw = bbw(close, len_bb, mult)
upper = basis + dev
lower = max(0.1, basis - dev)
Lowestbbw = lowest(bbbw, bbp)[1]

plot(basis, color=#2962ff, title="BB Basis", transp=80, display=display.none)
p1 = plot(upper, color=#2962ff, title="BB Upper", transp=100)
p2 = plot(lower, color=#2962ff, title="BB Lower", transp=100)
plot(bbbw <= Lowestbbw ? upper : na, style = plot.style_linebr, linewidth=5, color=color.blue, transp=25, title='BBand Pinch Coloru')
plot(bbbw <= Lowestbbw ? lower : na, style = plot.style_linebr, linewidth=5, color=color.blue, transp=25, title='BBand Pinch Colord')
fill(p1, p2, color=iff(bbbw <= Lowestbbw, #2962ff, na), transp=50, title= "Pinch Background")


// MA 50
fastmaOut = myMAc ? ema(src, len_fast) : sma(src, len_fast)
fastMARes = security(syminfo.tickerid, resfast, fastmaOut, barmerge.gaps_off, barmerge.lookahead_off)    
plot(fastMARes, style=plot.style_line, color=#673ab7, title="Fast MA", linewidth=1, transp=75, display=display.none) 

// MA 100
standardmaOut = myMAc ? ema(src, len_std) : sma(src, len_std)
stdMARes = security(syminfo.tickerid, resstd, standardmaOut, barmerge.gaps_off, barmerge.lookahead_off)
plot(stdMARes, style=plot.style_line, color=#9c27b0, title="Standard MA", linewidth=1, transp=50, display=display.none)

// MA 200
slowmaOut = myMAc ? ema(src, len_slow) : sma(src, len_slow)
slowMARes = security(syminfo.tickerid, resslow, slowmaOut, barmerge.gaps_off, barmerge.lookahead_off)
plot(slowMARes, style=plot.style_line, color=#e91e63, title="Slow MA", linewidth=3, transp=25)

Overview

Ichimoku + SuperTrend + 3MA + Bollinger Bands plots trend direction, volatility bands, and key averages directly on the price chart. The indicator features a Bollinger Band pinch detector that highlights periods of low volatility, configurable moving average types (EMA or SMA), and multi-timeframe capabilities for the fast, standard, and slow moving averages.

Details

Published by

7PH on GitHub

Code credit

PowerHat, as written in the script's header

Type

Indicator, Pine Script v4

Draws

On the price chart

Category

Trend, Moving averages, Volatility & bands

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

tradingtechnical-analysistechnical-analysis-indicatorstradingviewtradingview-pine-scripts

Settings

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

SettingTypeDefaultVariable
Conversion Line Lengthint9conversionPeriods
Base Line Lengthint26basePeriods
Leading Span B Lengthint52laggingSpan2Periods
Displacementint26displacement
ATR Lengthint10atrPeriod
Factorint3factor
BB Lengthint20len_bb
StdDevfloat2.0mult
BBand Pinch lengthint100bbp
Tick On: EMA. Off: SMAboolfalsemyMAc
MA Fast Lengthint50len_fast
MA Timeframetimeframeresfast
Show all 17 settings
SettingTypeDefaultVariable
MA Standard Lengthint100len_std
MA Timeframetimeframeresstd
MA Slow Lengthint200len_slow
MA Timeframetimeframeresslow
Sourcesourceclosesrc
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

318 stars

This indicator plots four customizable moving averages directly on the main price chart using default lengths of 3, 8, 21, and 50 periods. It fills the space between adjacent averages in green or maroon depending on trend alignment. Additionally, it computes B

Indicator v5 Moving averagesTrend
Updated 2 months ago · MIT GitHub repository of Multiple Moving Averages

NVDA Trend Ribbon

by longsurf-ai
277 stars

This indicator plots three exponential moving averages and ATR volatility envelopes on the price chart. It compares the fast and slow EMAs to shade a trend ribbon and marks confirmed upward and downward crossovers with triangle labels. Settings change the thre

Indicator v6 TrendMoving averages
Updated yesterday · MIT GitHub repository of NVDA Trend Ribbon

Bollinger Bands Force

by harryguiacorn
219 stars

This indicator modifies standard Bollinger Bands to measure directional trend force based on line alignment. It calculates a simple moving average basis along with upper and lower volatility bands. When all three lines move upward or downward simultaneously, i

Indicator v5 Volatility & bandsTrend
Updated 1 year ago · None stated GitHub repository of Bollinger Bands Force

Adaptive MA Slope

by capissimo
114 stars

This indicator calculates Kaufman's Adaptive Moving Average (KAMA) on a chosen price source and determines trend direction based on the slope across a configurable lookback window. Signals can be filtered by short-term volatility expansion using ATR comparison

Indicator v4 Moving averagesTrend
Updated 1 year ago · None stated GitHub repository of Adaptive MA Slope

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