RSI-Adaptive T3 [ChartPrime] For ThinkOrSwim

rkwchu

New member
VIP
Author states: The RSI-Adaptive T3 is a precision trend-following tool built around the legendary T3 smoothing algorithm developed by Tim Tillson, designed to enhance responsiveness while reducing lag compared to traditional moving averages. Current implementation takes it a step further by dynamically adapting the smoothing length based on real-time RSI conditions — allowing the T3 to “breathe” with market volatility. This dynamic length makes the curve faster in trending moves and smoother during consolidations.

⯁ Visual Trend Direction & Transitions
  • The T3 line changes color dynamically:
  • Color Up (default: blue) → bullish curvature
  • Color Down (default: orange) → bearish curvature
  • Plot fill between T3 and delayed T3 creates a gradient ribbon to show momentum expansion/contraction.
  • Directional shift markers are plotted when T3 crosses its own delayed value — helping traders spot trend flips or pullback entries.
⯁ Adaptive Volatility Bands
Optional upper/lower bands are plotted around the T3 line using a user-defined volatility window (default: 100).
Bands widen when volatility rises, and contract during compression — similar to Bollinger logic but centered on the adaptive T3.
Shaded band zones help frame breakout setups or mean-reversion zones.

IK3JSnV.png


Here is the original Tradingview code:
https://www.tradingview.com/script/C3xYkl1b-RSI-Adaptive-T3-ChartPrime/


For the new ThinkOrSwim code, you must scroll down to the next post
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Can you please convert the TradingView study "RSI-adaptive T3" created by (ChartPrime) to ThinkorSwim platform?
https://www.tradingview.com/script/C3xYkl1b-RSI-Adaptive-T3-ChartPrime/

Code:
# "RSI-adaptive T3" created by ChartPrime — modified by DrDre on 6/11/25

declare upper;

input price = close;
input rsiLength = 14;
input minLen = 5;
input maxLen = 50;
input volFactor = 0.7;
input showBands = yes;
input bandLength = 100;

# --- Manual RSI Calculation (Wilder's Smoothing) ---
def change = price - price[1];
def up = Max(change, 0);
def down = Max(-change, 0);
def avgUp = CompoundValue(1,
if IsNaN(avgUp[1]) then up
else (avgUp[1] * (rsiLength - 1) + up) / rsiLength,
up);
def avgDn = CompoundValue(1,
if IsNaN(avgDn[1]) then down
else (avgDn[1] * (rsiLength - 1) + down) / rsiLength,
down);
def rsi = if avgDn != 0 then 100 - (100 / (1 + avgUp / avgDn)) else 50;

# --- Adaptive Length from RSI ---
def rsiScale = 1 - rsi / 100;
def adaptLen = Round(minLen + (maxLen - minLen) * rsiScale);
def alpha = 2 / (adaptLen + 1);

# --- Recursive T3 Smoothing via CompoundValue ---
def e1 = CompoundValue(1, alpha * price + (1 - alpha) * e1[1], price);
def e2 = CompoundValue(1, alpha * e1 + (1 - alpha) * e2[1], e1);
def e3 = CompoundValue(1, alpha * e2 + (1 - alpha) * e3[1], e2);
def e4 = CompoundValue(1, alpha * e3 + (1 - alpha) * e4[1], e3);
def e5 = CompoundValue(1, alpha * e4 + (1 - alpha) * e5[1], e4);
def e6 = CompoundValue(1, alpha * e5 + (1 - alpha) * e6[1], e5);

# --- T3 Calculation ---
def c1 = -Power(volFactor, 3);
def c2 = 3 * Power(volFactor, 2) + 3 * Power(volFactor, 3);
def c3 = -6 * Power(volFactor, 2) - 3 * volFactor - 3 * Power(volFactor, 3);
def c4 = 1 + 3 * volFactor + Power(volFactor, 3) + 3 * Power(volFactor, 2);
def t3 = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3;
def t3Lag = t3[2];

# --- Manual Std Dev via EMA of Squared Deviations ---
def alpha2 = 2 / (bandLength + 1);
def t3Mean = CompoundValue(1, alpha2 * t3 + (1 - alpha2) * t3Mean[1], t3);
def variance = CompoundValue(1, alpha2 * Power(t3 - t3Mean, 2) + (1 - alpha2) * variance[1], 0);
def stdDev = Sqrt(variance);

# --- Plotting ---
plot T3Line = t3;
T3Line.AssignValueColor(if t3 > t3Lag then Color.CYAN else Color.ORANGE);
T3Line.SetLineWeight(2);

plot LagLine = t3Lag;
LagLine.SetDefaultColor(Color.LIGHT_GRAY);
LagLine.SetStyle(Curve.SHORT_DASH);

plot UpperBand = if showBands then t3 + stdDev else Double.NaN;
plot LowerBand = if showBands then t3 - stdDev else Double.NaN;
UpperBand.SetDefaultColor(Color.CYAN);
LowerBand.SetDefaultColor(Color.CYAN);
AddCloud(UpperBand, LowerBand, Color.CYAN, Color.CYAN);

plot Cross = if Crosses(t3, t3Lag, CrossingDirection.ANY) then t3 else Double.NaN;
Cross.SetPaintingStrategy(PaintingStrategy.POINTS);
Cross.SetLineWeight(3);
Cross.SetDefaultColor(Color.YELLOW);

AddLabel(yes, "Adaptive Len: " + adaptLen, if t3 > t3Lag then Color.CYAN else Color.ORANGE);
 
Last edited by a moderator:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
342 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top