Indicator · Pine Script v5 · On the chart

Swoosh Indicator

by harryguiacorn· code credited to FxCloudTrader - Harry Gui

Swoosh Indicator is an overlay that marks directional conditions on the price chart.

View on GitHub

GitHub stars219on the repository
Pine versionv5runs as is
Lines of code89
Settings10inputs
LicenceNone statedfile: MPL-2.0
Last update1 year ago8 May 2025

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

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

Swoosh Indicator.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © FxCloudTrader - Harry Gui

//@version=5
indicator(title="Swoosh Indicator", overlay=true)

// Inputs
var grp1 = "Moving Averages"
bool display_ma = input.bool(false, 'Display Moving Averages', group = grp1)
averageData = input.source(close, title="Average Data Source", group = grp1)

// SMA inputs can be set by the user
l_sma_line_1 = input.int(5, title="SMA 1", inline = "ma_1", group = grp1)
l_sma_line_2 = input.int(10, title="SMA 2", inline = "ma_1", group = grp1)
l_sma_line_3 = input.int(50, title="SMA 3", inline = "ma_2", group = grp1)
l_sma_line_4 = input.int(100, title="SMA 4", inline = "ma_2", group = grp1)

// Calculate SMAs 
sma_5 = ta.sma(averageData, l_sma_line_1)
sma_20 = ta.sma(averageData, l_sma_line_2)
sma_50 = ta.sma(averageData, l_sma_line_3)
sma_100 = ta.sma(averageData, l_sma_line_4)

// Plot SMAs on chart if display setting is on
plot(sma_5, color=color.blue, title="SMA 5", linewidth = 2, display = display_ma?display.all:display.none)
plot(sma_20, color=color.green, title="SMA 20", linewidth = 2, display = display_ma?display.all:display.none)
plot(sma_50, color=color.red, title="SMA 50", linewidth = 2, display = display_ma?display.all:display.none)
plot(sma_100, color=color.black, title="SMA 100", linewidth = 2, display = display_ma?display.all:display.none)

// If the SMAs are stacked up in the right order, i.e. sma 5 is above sma 20 and sma 20 is above 50 while sma 50 is above 100, then they're stacked in the right order
sma_stacked_up = sma_5 > sma_20 and sma_20 > sma_50 and sma_50 > sma_100
sma_stacked_dn = sma_5 < sma_20 and sma_20 < sma_50 and sma_50 < sma_100

[macdLine, signalLine, histLine] = ta.macd(close, 12, 26, 9)
macd_up = macdLine > signalLine
macd_dn = macdLine < signalLine

// plot(macdLine, color=color.blue)
// plot(signalLine, color=color.orange)
// plot(histLine, color=color.red, style=plot.style_histogram)

// Vortex Indicator https://www.investopedia.com/terms/v/vortex-indicator-vi.asp
bool enable_vortex = input.bool(false, 'Enable Vortex Indicator', inline = "Vortex_1", group = "Vortex")
// showVortexInput   = input.bool(false, "Display Vortex",   inline = "Vortex1", group = "Vortex")
period_ = input.int(14, title="Length", minval=2, inline = "Vortex_2", group = "Vortex")
vi_band_up = input.float(1.05, title="Upper band", inline = "Vortex3", group = "Vortex", step = 0.01)
vi_band_dn = input.float(0.95, title="Lower band", inline = "Vortex3", group = "Vortex", step = 0.01)
VMP = math.sum( math.abs( high - low[1]), period_ )
VMM = math.sum( math.abs( low - high[1]), period_ )
STR = math.sum( ta.atr(1), period_ )
VIP = VMP / STR
VIM = VMM / STR
// plot(VIP, title="VI +", color=#2962FF)
// plot(VIM, title="VI -", color=#E91E63)
VI_up = VIP > VIM and VIP > vi_band_up
VI_dn = VIP < VIM and VIM < vi_band_dn
// cond_VI_up = enable_vortex?VI_up:false
// cond_VI_dn = enable_vortex?VI_dn:false

bool cond_VI_up = if enable_vortex and VI_up
    true
bool cond_VI_dn = if enable_vortex and VI_dn
    true

cond_arrow_up = if sma_stacked_up and macd_up and enable_vortex and cond_VI_up
    true
else if sma_stacked_up and macd_up
    true
else 
    false

plotshape(cond_arrow_up, color = color.green, style=shape.arrowup, location = location.belowbar)
plotshape(sma_stacked_dn and macd_dn, color = color.red, style=shape.arrowdown, location = location.abovebar)

signal_valid = if sma_stacked_up and macd_up
    color.new(color.green, 70)
else if sma_stacked_dn and macd_dn
    color.new(color.red, 70)
// else 
//     color.new(color.gray, 70)

signal_valid_1 = if sma_stacked_up and macd_up and enable_vortex and cond_VI_up
    color.new(color.green, 70)
else if sma_stacked_dn and macd_dn and enable_vortex and cond_VI_dn
    color.new(color.red, 70)
// else 
//     color.new(color.gray, 70)
// bgcolor(signal_valid, title="Crosses Background")
// bgcolor(signal_valid_1, title="Crosses Background")

Overview

Swoosh Indicator checks whether four simple moving averages are stacked in order and whether the MACD line is above or below its signal line. When both agree, it plots a green up arrow below the bar or a red down arrow above the bar. Moving averages stay hidden unless the user enables them. An optional Vortex filter, off by default, can require plus and minus vortex lines to clear upper and lower bands. The script does not define exits.

Details

Published by

harryguiacorn on GitHub

Code credit

FxCloudTrader - Harry Gui, as written in the script's header

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Moving averages, Oscillators & momentum

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

bollingerbollinger-bandbollinger-bandsichimokuichimoku-cloudichimoku-indicatorpinepinescriptpinescript-guidespinescript-indicators

Settings

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

SettingTypeDefaultVariable
Display Moving Averagesboolfalsedisplay_ma
Average Data SourcesourcecloseaverageData
SMA 1int5l_sma_line_1
SMA 2int10l_sma_line_2
SMA 3int50l_sma_line_3
SMA 4int100l_sma_line_4
Enable Vortex Indicatorboolfalseenable_vortex
Lengthint14period_
Upper bandfloat1.05vi_band_up
Lower bandfloat0.95vi_band_dn
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 RSI Moving Average (ARSIMA) is an overlay indicator that dynamically adjusts its smoothing factor based on the Relative Strength Index (RSI). When the RSI moves toward extreme overbought or oversold conditions, the smoothing factor increases to ma

Indicator v4 Moving averagesOscillators & momentum
Updated 10 days ago · GPL-3.0 GitHub repository of Adaptive RSI Moving Average

This overlay indicator plots a Supertrend from an ATR length and factor, four exponential moving averages, and a selectable VWAP or TWAP taken from a chosen timeframe on the price chart. It also shows MACD and stochastic with adjustable lengths, smoothing, ver

Indicator v5 Oscillators & momentumMoving averages
Updated 1 year ago · MPL-2.0 GitHub repository of Momentum Setup: Vijay Thakare Option Buying Scalping Setup

This indicator plots trade entry and exit signals on the price chart by combining Bollinger Bands with optional filter conditions. It calculates standard Bollinger Bands along with RSI, Aroon, and moving average filters. Reversal signals trigger when price bre

Indicator v4 Volatility & bandsOscillators & momentum
Updated 2 months ago · None stated GitHub repository of Bollinger Bands Winner IND [Alorse]
318 stars

This indicator plots three moving averages on the price chart alongside colored fills between the lines to visualize trend structure. Internally, it calculates a Stochastic RSI oscillator to detect oversold reversals. When the Stochastic %K line rises above 10

Indicator v5 Moving averagesOscillators & momentum
Updated 2 months ago · MIT GitHub repository of TVT 3X Scale In Out
285 stars

Mean Reversion Study is an indicator that identifies trade setups combining exponential moving averages, RSI extremes, and engulfing candlestick patterns. It highlights bullish setups when a bullish engulfing candle forms below the EMA while RSI is oversold, a

Indicator v4 Mean reversionCandlestick patterns
Updated 3 years ago · None stated GitHub repository of Mean Reversion Study

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