Theory:
Although T3 is widely used, some of the details on how it is calculated are less known. T3 has, internally, 6 "levels" or "steps" that it uses for its calculation.
This version:
Instead of showing the final T3 value, this indicator shows those intermediate steps. This shows the "building steps" of T3 and can be used for trend assessment as well as for possible support / resistance values.
CODE:
CSS:
#// This source code is subject to the terms of the Mozilla Public License 2.0
#https://www.tradingview.com/script/HNzSGutO-T3-Striped-Loxx/
#indicator("T3 Striped [Loxx]",
# Converted and mod by Sam4Cok@Samer800 - 09/2022
############## theme ########################################
DefineGlobalColor("Sky0" , CreateColor(0, 255, 255)); # >=90
DefineGlobalColor("Sky1" , CreateColor(0, 221, 255)); # >=90
DefineGlobalColor("Sky2" , CreateColor(4, 188, 217)); # >=80
DefineGlobalColor("Sky3" , CreateColor(4, 156, 179)); # >=70
DefineGlobalColor("Sky4" , CreateColor(4, 127, 145)); # >=60
DefineGlobalColor("Sky5" , CreateColor(4, 103, 117)); # >=50
DefineGlobalColor("Magenta0" , CreateColor(255, 0, 255)); # >=40
DefineGlobalColor("Magenta1" , CreateColor(216, 0, 255)); # >=40
DefineGlobalColor("Magenta2" , CreateColor(187, 4, 219)); # >=30
DefineGlobalColor("Magenta3" , CreateColor(155, 5, 181)); # >=20
DefineGlobalColor("Magenta4" , CreateColor(123, 3, 143)); # >=10
DefineGlobalColor("Magenta5" , CreateColor(100, 2, 117)); # >=0
#_iT3(src, per, hot, clean)=>
script _iT3 {
input src = close;
input per = 14;
input hot = 0;
input clean = "T3 New";
def bar = BarNumber();
def a = hot;
def _c1 = -a * a * a;
def _c2 = 3 * a * a + 3 * a * a * a;
def _c3 = -6 * a * a - 3 * a - 3 * a * a * a;
def _c4 = 1 + 3 * a + a * a * a + 3 * a * a;
def alpha;
if (clean == "T3 New") {
alpha = 2.0 / (2.0 + (per - 1.0) / 2.0);
} else {
alpha = 2.0 / (1.0 + per);
}
def _t30;
def _t31;
def _t32;
def _t33;
def _t34;
def _t35;
def out1;
_t30 = if bar < 2 then src else (_t30[1]) + alpha * (src - (_t30[1]));
_t31 = if bar < 2 then src else (_t31[1]) + alpha * (_t30 - (_t31[1]));
_t32 = if bar < 2 then src else (_t32[1]) + alpha * (_t31 - (_t32[1]));
_t33 = if bar < 2 then src else (_t33[1]) + alpha * (_t32 - (_t33[1]));
_t34 = if bar < 2 then src else (_t34[1]) + alpha * (_t33 - (_t34[1]));
_t35 = if bar < 2 then src else (_t35[1]) + alpha * (_t34 - (_t35[1]));
out1 = _c1 * _t35 + _c2 * _t34 +
_c3 * _t33 + _c4 * _t32;
plot lev0 = _t30;
plot lev1 = _t31;
plot lev2 = _t32;
plot lev3 = _t33;
plot lev4 = _t34;
plot lev5 = _t35;
plot out = out1;
}
input src = close;
input per = 21; # "Period"
input t3hot = 0.4; # "T3 Hot"
input t3swt = {Default "T3 New", "T3 Original"};
input T3Line = yes;
input BandLines = no;
input BandCloud = yes;
input colorbars = no; # "Color bars?"
input showSigs = no; # "Show signals?"
def na = Double.NaN;
def lev0 = _iT3(src, per, t3hot, t3swt).lev0;
def lev1 = _iT3(src, per, t3hot, t3swt).lev1;
def lev2 = _iT3(src, per, t3hot, t3swt).lev2;
def lev3 = _iT3(src, per, t3hot, t3swt).lev3;
def lev4 = _iT3(src, per, t3hot, t3swt).lev4;
def lev5 = _iT3(src, per, t3hot, t3swt).lev5;
def out = _iT3(src, per, t3hot, t3swt).out;
def colorout = if lev0 < lev1 and lev0 > lev5 then 0 else
if lev0 > lev5 then 1 else -1;
plot pl0 = lev0; # "level 0"
plot pl1 = lev1; # "level 1"
plot pl2 = lev2; # "level 2"
plot pl3 = lev3; # "level 3"
plot pl4 = lev4; # "level 4"
plot pl5 = lev5; # "level 5"
plot pout = out;
pout.SetHiding(!T3Line);
pout.AssignValueColor(if colorOut > 0 then CreateColor(33,87,243) else
if colorOut < 0 then Color.DARK_ORANGE else Color.GRAY);
pout.SetLineWeight(2);
pl0.SetHiding(!BandLines);
pl0.AssignValueColor(if colorOut > 0 then GlobalColor("Sky0") else
if colorOut < 0 then GlobalColor("Magenta0") else Color.GRAY);
pl1.SetHiding(!BandLines);
pl1.AssignValueColor(if colorOut > 0 then GlobalColor("Sky1") else
if colorOut < 0 then GlobalColor("Magenta1") else Color.GRAY);
pl2.SetHiding(!BandLines);
pl2.AssignValueColor(if colorOut > 0 then GlobalColor("Sky2") else
if colorOut < 0 then GlobalColor("Magenta2") else Color.GRAY);
pl3.SetHiding(!BandLines);
pl3.AssignValueColor(if colorOut > 0 then GlobalColor("Sky3") else
if colorOut < 0 then GlobalColor("Magenta3") else Color.GRAY);
pl4.SetHiding(!BandLines);
pl4.AssignValueColor(if colorOut > 0 then GlobalColor("Sky4") else
if colorOut < 0 then GlobalColor("Magenta4") else Color.GRAY);
pl5.SetHiding(!BandLines);
pl5.AssignValueColor(if colorOut > 0 then GlobalColor("Sky5") else
if colorOut < 0 then GlobalColor("Magenta5") else Color.GRAY);
#### Signals
def goLong = lev0 crosses above lev5;
def goShort = lev0 crosses below lev5;
plot ArLong = if showSigs and goLong then low else na;
plot ArShort = if showSigs and goShort then high else na;
ArLong.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
ArLong.SetDefaultColor(Color.YELLOW);
ArLong.SetLineWeight(2);
ArShort.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
ArShort.SetDefaultColor(Color.PINK);
ArShort.SetLineWeight(2);
#### Cloud
AddCloud(if BandCloud then pl0 else na, pl1, GlobalColor("Sky1"),GlobalColor("Magenta1"));
AddCloud(if BandCloud then pl1 else na, pl2, GlobalColor("Sky2"),GlobalColor("Magenta2"));
AddCloud(if BandCloud then pl2 else na, pl3, GlobalColor("Sky3"),GlobalColor("Magenta3"));
AddCloud(if BandCloud then pl3 else na, pl4, GlobalColor("Sky4"),GlobalColor("Magenta4"));
AddCloud(if BandCloud then pl4 else na, pl5, GlobalColor("Sky5"),GlobalColor("Magenta5"));
#### BarColor
AssignPriceColor(if ColorBars then if colorOut > 0 then CreateColor(33,87,243) else
if colorOut < 0 then Color.DARK_ORANGE else Color.GRAY else Color.CURRENT);
### END
Last edited by a moderator: