Untitled
"TASC 2024.05 Ultimate Channels and Ultimate Bands" by PineCodersTASC, MPL-2.0. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: TASC 2024.05 Ultimate Channels and Ultimate Bands (v1.0), read 2026-10-12T15:51:59.091Z; source language v5.
Licence: Mozilla Public License 2.0 (MPL-2.0) — full text. The source is published with it, modifications included, under the same licence.
TASC 2024.05 Ultimate Channels and Ultimate Bands by PineCodersTASC, ported from Pine v5. Overlay indicator with 2 plots, 1 fill and 4 inputs.
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © PineCodersTASC
// TASC Issue: May 2024 - Vol. 42, Issue 5
// Article: Ultimate Channels And Ultimate Bands
// Getting The Lag Out Of Two Classic Indicators
// Article By: John F. Ehlers
// Language: Pine-compatible v5
// Provided By: PineCoders, for tradingview.com
// ------------------------------------------------------------------------------------------------
// Original author: PineCodersTASC
// Original title: TASC 2024.05 Ultimate Channels and Ultimate Bands
// Licence: MPL-2.0 (the header above is the original notice, kept verbatim)
// Pine version: 5
// Fetched: 2026-10-12
// Ported to FloScript by FloSignals; modifications under MPL-2.0.
// Converter: @flosignals/floscript 0.1.0, strict mode, score 100/100
// ------------------------------------------------------------------------------------------------
//@floscript=1
//@version=5
title = 'TASC 2024.05 Ultimate Channels and Ultimate Bands'
stitle = 'UCUB'
indicator(title, stitle, true)
// --- Constants ---
string M00 = 'Channel'
string M01 = 'Bands'
string TT01 = 'Switch between the Ultimate channel and Ultimate bands indicators'
string TT02 = 'The smooth true range (STR) length defining the Ultimate Channel'
// --- Inputs ---
string mode = input.string(M00, 'Mode:', [M00, M01], TT01)
int length0 = input.int(20, 'Length:')
int length1 = input.int(20, 'STR Length:', tooltip=TT02)
float multiplier = input.float(1.0, 'Width Multiplier:')
// --- Functions ---
// @function Applies the UltimateSmoother filter.
// @param src Source series.
// @param period Critical period.
// @returns us Smoothed series.
UltimateSmoother(float src, int period) =>
float a1 = math.exp(-1.414 * math.pi / period)
float c2 = 2.0 * a1 * math.cos(1.414 * math.pi / period)
float c3 = -a1 * a1
float c1 = (1.0 + c2 - c3) / 4.0
float us = src
if bar_index >= 4
us := (1.0 - c1) * src + (2.0 * c1 - c2) * src[1] - (c1 + c3) * src[2] + c2 * nz(us[1]) + c3 * nz(us[2])
us
// @function Uses the UltimateSmoother to calculate
// the center of the channel and the smooth
// true range (STR) that defines the width.
// @param length Critical period for the center.
// @param lengthSTR Critical period for the STR.
// @param mult STR multiplier.
// @returns tuple Upper and lower channel series.
UltimateChannel(int length, int lengthSTR, float mult) =>
float mid = UltimateSmoother(close, length)
float str = UltimateSmoother(ta.tr, lengthSTR) * mult
[mid + str, mid - str]
// @function Uses the UltimateSmoother to calculate
// the center of the band.
// @param length Critical period.
// @param mult Standard deviation multiplier.
// @returns tuple Upper and lower band series.
UltimateBands(float src, int length, float mult) =>
float mid = UltimateSmoother(src, length)
float sd = math.sqrt(ta.sma(math.pow(src - mid, 2), length)) * mult
[mid + sd, mid - sd]
// --- Calculations ---
[uc, lc] = if mode == M00
UltimateChannel(length0, length1, multiplier)
else
UltimateBands(close, length0, multiplier)
// --- Plotting ---
u = plot(uc, 'Upper', color.rgb(30, 150, 250), 2)
l = plot(lc, 'Lower', color.rgb(30, 150, 250), 2)
fill(u, l, color.rgb(30, 150, 250, 95))
This file is under the Mozilla Public License 2.0; it is a port of the original by PineCodersTASC, with the original licence header kept and the changes made for FloScript noted in the file.
- v2
Library refresh 2026-10-14
- v1
Library refresh 2026-10-12
Disclaimer. Scripts are written and published by members, or ported by FloSignals from open-source originals, and are their authors' own work and opinion. FloSignals does not review them for correctness and nothing in a script is financial advice or a recommendation to buy or sell anything — read the Risk Disclaimer. Posting here is under the Community Rules; a script that is not the poster's to post can be reported as the Copyright & Takedowns page says.

Comments (0)
No comments yet. Members can leave one.