Projection Bands [CC]
"Projection Bands [CC]" by cheatcountry, MIT. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: Projection Bands [CC] (v1.0), read 2026-10-12T15:46:25.695Z; source language v5.
Licence: MIT License (MIT) — full text.
Projection Bands [CC] by cheatcountry, ported from Pine v5. Overlay indicator with 3 plots, bar/background colouring, alerts and 5 inputs.
// Copyright (c) 2019-present, Franklin Moormann (cheatcountry)
// Projection Bands [CC] script may be freely distributed under the MIT license.
// ------------------------------------------------------------------------------------------------
// Original author: cheatcountry
// Original title: Projection Bands [CC]
// Licence: MIT (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
indicator('Projection Bands [CC]', max_bars_back=3000, overlay=true)
f_security(_symbol, _res, _src, _repaint) =>
_src[_repaint ? 0 : barstate.isrealtime ? 1 : 0][_repaint ? 0 : barstate.isrealtime ? 0 : 1]
res = input.timeframe(title="Resolution", defval='')
rep = input.bool(title="Allow Repainting?", defval=false)
bar = input.bool(title="Allow Bar Color Change?", defval=true)
inp = input(title='Source', defval=close)
h = f_security(syminfo.tickerid, res, high, rep)
l = f_security(syminfo.tickerid, res, low, rep)
c = f_security(syminfo.tickerid, res, inp, rep)
length = input.int(title='Length', defval=14, minval=1)
mHigh = ta.linreg(h, length, 0) - ta.linreg(h, length, 1)
mLow = ta.linreg(l, length, 0) - ta.linreg(l, length, 1)
upperBand = h
lowerBand = l
for i = 0 to length - 1
currH = nz(h[i])
prevH = nz(h[i - 1])
currL = nz(l[i])
prevL = nz(l[i - 1])
vHigh = currH + nz(mHigh[i]) * i
vLow = currL + nz(mLow[i]) * i
upperBand := math.max(vHigh, upperBand)
lowerBand := math.min(vLow, lowerBand)
middleBand = (upperBand + lowerBand) / 2
slo = c - middleBand
sig = c > upperBand and nz(c[1]) <= nz(upperBand[1]) or c > lowerBand and nz(c[1]) <= nz(lowerBand[1]) ? 1 : c < lowerBand and nz(c[1]) >= nz(lowerBand[1]) or c < upperBand and nz(c[1]) >= nz(upperBand[1]) ? -1 : slo > 0 ? (slo > nz(slo[1]) ? 2 : 1) : slo < 0 ? (slo < nz(slo[1]) ? -2 : -1) : 0
alertcondition(ta.crossover(sig, 1), "Strong Buy Signal", "Strong Bullish Change Detected")
alertcondition(ta.crossunder(sig, -1), "Strong Sell Signal", "Strong Bearish Change Detected")
alertcondition(ta.crossover(sig, 0), "Buy Signal", "Bullish Change Detected")
alertcondition(ta.crossunder(sig, 0), "Sell Signal", "Bearish Change Detected")
pbColor = sig > 1 ? color.green : sig > 0 ? color.lime : sig < -1 ? color.maroon : sig < 0 ? color.red : color.black
barcolor(bar ? pbColor : na)
plot(upperBand, title="UpperBand", linewidth=2, color=pbColor)
plot(middleBand, title="MiddleBand", linewidth=1, color=color.white)
plot(lowerBand, title="LowerBand", linewidth=2, color=pbColor)
This file is under the MIT License; it is a port of the original by cheatcountry, 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.