PMax on Rsi w T3
"PMax on RSI with Tillson T3" by KivancOzbilgic, MPL-2.0. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: PMax on RSI with Tillson T3 (v1.0), read 2026-10-12T16:05:23.575Z; source language v4.
Licence: Mozilla Public License 2.0 (MPL-2.0) — full text. The source is published with it, modifications included, under the same licence.
PMax on RSI with Tillson T3 by KivancOzbilgic, ported from Pine v4. Pane indicator with 4 plots, 2 marker series, 3 fills, 2 levels and 10 inputs.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © KivancOzbilgic
//developer: @KivancOzbilgic
//author: @KivancOzbilgic
// ------------------------------------------------------------------------------------------------
// Original author: KivancOzbilgic
// Original title: PMax on RSI with Tillson T3
// Licence: MPL-2.0 (the header above is the original notice, kept verbatim)
// Pine version: 4
// 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
// Converted by the FloScript converter from a Pine-compatible v4 source.
indicator("PMax on Rsi w T3", "PmR3", overlay=false, precision=2)
src = input(hl2, title="Source")
Multiplier = input.float(title="ATR Multiplier", step=0.1, defval=3)
length = input.int(8, "Tillson T3 Length", minval=1)
T3a1 = input.float(0.7, "TILLSON T3 Volume Factor", step=0.1)
Periods = input.int(10, title="ATR Length")
rsilength = input.int(14, minval=1, title="RSI Length")
showrsi = input.bool(title="Show RSI?", defval=true)
showsupport = input.bool(title="Show Moving Average?", defval=true)
showsignalsk = input.bool(title="Show Crossing Signals?", defval=true)
highlighting = input.bool(title="Highlighter On/Off ?", defval=true)
i = close >= close[1] ? close - close[1] : 0
i2 = close < close[1] ? close[1] - close : 0
Wwma_Func(src, rsilength) =>
wwalpha = 1 / rsilength
WWMA = 0.0
WWMA := wwalpha * src + (1 - wwalpha) * nz(WWMA[1])
WWMA = Wwma_Func(src, rsilength)
AvUp = Wwma_Func(i, rsilength)
AvDown = Wwma_Func(i2, rsilength)
AvgUp = ta.sma(i, rsilength)
AvgDown = ta.sma(i2, rsilength)
k1 = high > close[1] ? high - close[1] : 0
k2 = high < close[1] ? close[1] - high : 0
k3 = low > close[1] ? low - close[1] : 0
k4 = low < close[1] ? close[1] - low : 0
AvgUpH = (AvgUp * (rsilength - 1) + k1) / rsilength
AvgDownH = (AvgDown * (rsilength - 1) + k2) / rsilength
AvgUpL = (AvgUp * (rsilength - 1) + k3) / rsilength
AvgDownL = (AvgDown * (rsilength - 1) + k4) / rsilength
rs = AvUp / AvDown
rsi = rs == -1 ? 0 : 100 - 100 / (1 + rs)
rsh = AvgUpH / AvgDownH
rsih = rsh == -1 ? 0 : 100 - 100 / (1 + rsh)
rsl = AvgUpL / AvgDownL
rsil = rsl == -1 ? 0 : 100 - 100 / (1 + rsl)
TR = math.max(rsih - rsil, math.abs(rsih - rsi[1]), math.abs(rsil - rsi[1]))
atr = ta.sma(TR, Periods)
plot(showrsi ? rsi : na, "RSI", color=#8E1599)
band1 = hline(70, "Upper Band", color=#C0C0C0)
band0 = hline(30, "Lower Band", color=#C0C0C0)
fill(band1, band0, color=color.new(#9915FF, 90), title="Background")
T3e1 = ta.ema(rsi, length)
T3e2 = ta.ema(T3e1, length)
T3e3 = ta.ema(T3e2, length)
T3e4 = ta.ema(T3e3, length)
T3e5 = ta.ema(T3e4, length)
T3e6 = ta.ema(T3e5, length)
T3c1 = -T3a1 * T3a1 * T3a1
T3c2 = 3 * T3a1 * T3a1 + 3 * T3a1 * T3a1 * T3a1
T3c3 = -6 * T3a1 * T3a1 - 3 * T3a1 - 3 * T3a1 * T3a1 * T3a1
T3c4 = 1 + 3 * T3a1 + T3a1 * T3a1 * T3a1 + 3 * T3a1 * T3a1
T3 = T3c1 * T3e6 + T3c2 * T3e5 + T3c3 * T3e4 + T3c4 * T3e3
MAvg = T3
Pmax_Func(rsi, length) =>
longStop = MAvg - Multiplier * atr
longStopPrev = nz(longStop[1], longStop)
longStop := MAvg > longStopPrev ? math.max(longStop, longStopPrev) : longStop
shortStop = MAvg + Multiplier * atr
shortStopPrev = nz(shortStop[1], shortStop)
shortStop := MAvg < shortStopPrev ? math.min(shortStop, shortStopPrev) : shortStop
dir = 1
dir := nz(dir[1], dir)
dir := dir == -1 and MAvg > shortStopPrev ? 1 : dir == 1 and MAvg < longStopPrev ? -1 : dir
PMax = dir == 1 ? longStop : shortStop
PMax = Pmax_Func(rsi, length)
plot(showsupport ? MAvg : na, color=color.black, linewidth=2, title="T3")
pALL = plot(PMax, color=color.new(color.red, 0), linewidth=2, title="PMax")
alertcondition(ta.cross(MAvg, PMax), title="Cross Alert", message="PMax - Moving Avg Crossing!")
alertcondition(ta.crossover(MAvg, PMax), title="Crossover Alarm", message="Moving Avg BUY SIGNAL!")
alertcondition(ta.crossunder(MAvg, PMax), title="Crossunder Alarm", message="Moving Avg SELL SIGNAL!")
alertcondition(ta.cross(src, PMax), title="Price Cross Alert", message="PMax - Price Crossing!")
alertcondition(ta.crossover(src, PMax), title="Price Crossover Alarm", message="PRICE OVER PMax - BUY SIGNAL!")
alertcondition(ta.crossunder(src, PMax), title="Price Crossunder Alarm", message="PRICE UNDER PMax - SELL SIGNAL!")
buySignalk = ta.crossover(MAvg, PMax)
plotshape(buySignalk and showsignalsk ? PMax * 0.995 : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.new(color.green, 0), textcolor=color.white)
sellSignallk = ta.crossunder(MAvg, PMax)
plotshape(sellSignallk and showsignalsk ? PMax * 1.005 : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.new(color.red, 0), textcolor=color.white)
mPlot = plot(rsi, title="", style=plot.style_circles, linewidth=0, display=display.none)
longFillColor = highlighting ? (MAvg > PMax ? color.green : na) : na
shortFillColor = highlighting ? (MAvg < PMax ? color.red : na) : na
fill(mPlot, pALL, title="UpTrend Highligter", color=longFillColor)
fill(mPlot, pALL, title="DownTrend Highligter", color=shortFillColor)
This file is under the Mozilla Public License 2.0; it is a port of the original by KivancOzbilgic, 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.