• LIMITED TIME ONLY: Take $40 off VIP with code: BTD40.

Trend Intensity Index (TII) For ThinkOrSwim

cherif

Member
VIP
Trend Intensity Index tradingview. is it possible to translate it to a thinkorswim code?
 
Last edited by a moderator:

horserider

Well-known member
VIP
Trend Intensity Index For ThinkOrSwim
Just put this together. No idea if it is correct. From original TTI formula. You can try it. Others are welcome to modify or correct.

Code:
# TII put together from original TII formula by Horserider . 9/12/2019

declare lower;

def length =60;
def halflength = 30;
 def sma = average(Close, length);

def Dev = Close - SMA;
def posdev = dev > 0;
def negdev =dev < 0;

def SDpos = sum(posDev, halflength);
def SDneg = sum(negDev, halflength);

def TII = 100 * (SDpos) / (SDpos + SDneg);

def signalline = expAverage(TII, halflength);

plot TTIline = TII;
plot sl = signalline;
 
Last edited by a moderator:

Similar threads

Top