Indicator · Pine Script v4 · On the chart

[RS] Simple Forecast - Keltner Worms

by ricardosantos79· code credited to RicardoSantos

This indicator plots multiple auto-multiplying Keltner Channels across different lookback lengths (5, 10, 25, 50, 100, and 200 periods) directly on the main price chart.

View on GitHub

GitHub stars261on the repository
Pine versionv4older, still runs
Lines of code61
Settings1inputs
LicenceNone statedfile: MPL-2.0
Last update4 years ago13 Nov 2021

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

61 lines of Pine Script v4 from [RS]Simple Forecast - Keltner Worms.pinescript, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

[RS]Simple Forecast - Keltner Worms.pinescript
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © RicardoSantos

//@version=4
study(title="[RS]Simple Forecast - Keltner Worms", shorttitle="KC", overlay=true, resolution="")

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

f_kc(_src, _length)=>
    _ma = ema(_src, _length)
    _rangema = rma(tr(true), _length)
    var _auto_mult = 0
    for _i = _auto_mult to 9999
        if abs(_src - _ma) > (_rangema * _auto_mult)
            _auto_mult := _auto_mult + 1
            continue
        else
            break

    _upper = _ma + _rangema * _auto_mult
    _lower = _ma - _rangema * _auto_mult
    [_ma, _upper, _lower]

[p005ma, p005upper, p005lower] = f_kc(src, 5)
[p010ma, p010upper, p010lower] = f_kc(src, 10)
[p025ma, p025upper, p025lower] = f_kc(src, 25)
[p050ma, p050upper, p050lower] = f_kc(src, 50)
[p100ma, p100upper, p100lower] = f_kc(src, 100)
[p200ma, p200upper, p200lower] = f_kc(src, 200)

c = color.blue

p005u = plot(p005upper, color=#0094FF, title="Upper", offset=5, show_last=5)
plot(p005ma, color=#0094FF, title="Basis", offset=5, show_last=5)
p005l = plot(p005lower, color=#0094FF, title="Lower", offset=5, show_last=5)
fill(p005u, p005l, color=#0094FF, transp=95, title="Background")

p010u = plot(p010upper, color=#0094FF, title="Upper", offset=10, show_last=5)
plot(p010ma, color=#0094FF, title="Basis", offset=10, show_last=5)
p010l = plot(p010lower, color=#0094FF, title="Lower", offset=10, show_last=5)
fill(p010u, p010l, color=#0094FF, transp=95, title="Background")

p025u = plot(p025upper, color=#0094FF, title="Upper", offset=25, show_last=15)
plot(p025ma, color=#0094FF, title="Basis", offset=25, show_last=15)
p025l = plot(p025lower, color=#0094FF, title="Lower", offset=25, show_last=15)
fill(p025u, p025l, color=#0094FF, transp=95, title="Background")

p050u = plot(p050upper, color=#0094FF, title="Upper", offset=50, show_last=25)
plot(p050ma, color=#0094FF, title="Basis", offset=50, show_last=25)
p050l = plot(p050lower, color=#0094FF, title="Lower", offset=50, show_last=25)
fill(p050u, p050l, color=#0094FF, transp=95, title="Background")

p100u = plot(p100upper, color=#0094FF, title="Upper", offset=100, show_last=50)
plot(p100ma, color=#0094FF, title="Basis", offset=100, show_last=50)
p100l = plot(p100lower, color=#0094FF, title="Lower", offset=100, show_last=50)
fill(p100u, p100l, color=#0094FF, transp=95, title="Background")

p200u = plot(p200upper, color=#0094FF, title="Upper", offset=200, show_last=100)
plot(p200ma, color=#0094FF, title="Basis", offset=200, show_last=100)
p200l = plot(p200lower, color=#0094FF, title="Lower", offset=200, show_last=100)
fill(p200u, p200l, color=#0094FF, transp=95, title="Background")

Overview

[RS] Simple Forecast - Keltner Worms calculates exponential moving averages and range-based band offsets, dynamically adjusting the channel multiplier to encompass price moves. The resulting channels are projected forward into future bars using positive plot offsets to visualize projected price boundaries. The primary setting allows users to change the input price source. It provides visual volatility channels rather than explicit buy or sell trade signals.

Details

Published by

ricardosantos79 on GitHub

Code credit

RicardoSantos, as written in the script's header

Type

Indicator, Pine Script v4

Draws

On the price chart

Category

Volatility & bands, Moving averages

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.

Settings

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

SettingTypeDefaultVariable
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

Hampel Filter

by everget
948 stars

The Hampel Filter indicator identifies and filters out price outliers to smooth price data directly on the main chart. It calculates the rolling median and Median Absolute Deviation (MAD) of the chosen source series over a specified length. When a data point e

Indicator v4 Moving averagesVolatility & bands
Updated 10 days ago · GPL-3.0 GitHub repository of Hampel Filter

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 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

Snag - VWAP

by dearvn
257 stars

This indicator plots a custom Anchored Volume-Weighted Average Price (VWAP) directly on the price chart along with optional standard deviation bands. Users can anchor the VWAP to standard time periods like sessions, weeks, or months, or to corporate events suc

Indicator v5 Moving averagesVolatility & bands Repaints
Updated 6 weeks ago · None stated GitHub repository of Snag - VWAP

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