Trend Direction Force Index (TDFI) For ThinkOrSwim

ccrkk

New member
VIP
I found this trend trading indicator on Tradingview and was wondering if someone could possibly convert it into a TOS study. I scrolled though charts on Tradingview with the indicator and it really did a nice job of keeping you out of trades while in a sideways market with the ".05" high/low filter. Would like to test it out on TOS to analyze it further and conduct more backtest on it. Any help would be greatly appreciated.
 
Last edited by a moderator:

Zuben

New member

Trend Direction Force Index (TDFI) For ThinkOrSwim​

Trend Direction Force Index Indicator analyzes and transforms past market data into potential trade signals. This indicator is well-known for its unique way of demonstrating the trade signals which can be read and understood by traders with any level of experience. Moreover, this supports all sorts of time frame charts.

Code:
# thinkscript version of Tradingview's Trend Direction Force Index (TDFI)
# by Zuben

declare lower;
input lookback = 13;
input mmaLength = 13;
input smmaLength = 13;
input mmaMode = AverageType.EXPONENTIAL;
input smmaMode = AverageType.EXPONENTIAL;
input nLength = 3;
input filterHigh = 0.05;
input filterLow = -0.05;
input price = close;

def mma = MovingAverage(mmaMode, price*1000, mmaLength);
def smma = MovingAverage(smmaMode, mma, smmaLength);
#for TEMA: comment out the two above lines and uncomment the following
#def mma = TEMA(price*1000, mmaLength);
#def smma = TEMA(mma, smmaLength);
def impetmma = mma - mma[1];
def impetsmma = smma - smma[1];
def divma = AbsValue(mma - smma);
def averimpet = (impetmma + impetsmma) / 2;
def tdf = Power(divma, 1) * Power(averimpet, nLength);
def tdfi = tdf / Highest(AbsValue(tdf), lookback * nLength);

plot signal = tdfi;
plot fh = filterHigh;
plot fl = filterLow;
plot zl = 0;

signal.SetDefaultColor(GetColor(4));
fh.SetDefaultColor(GetColor(2));
fl.SetDefaultColor(GetColor(2));
zl.SetDefaultColor(GetColor(7));

signal.DefineColor("Positive", Color.UPTICK);
signal.DefineColor("Negative", Color.DOWNTICK);
signal.AssignValueColor(if signal > fh then signal.color("Positive") else if signal < fl then signal.color("Negative") else Color.ORANGE);
 
Last edited by a moderator:

Trading51

Active member
2019 Donor
@Zuben Is it possible to add two sets of inputs? How owuld i go about that thanks.

input filterHigh = 0.05;
input filterLow = -0.05;

input filterHigh = 1.00;
input filterLow = -1.00;
 

Zuben

New member
@Trading51, This indicator is range-bound between 1 and -1, so setting those as a secondary high/low filter would just put a boundary at the top and bottom. From what I understand, the very low filters are to keep you ought of sideways markets. When it's above/below those filters, it indicates movement/momentum out of the sideways move.

But a secondary filter may have good use at a .5/-.5 range, which would give you a better idea of the strength of the move.
 

dmillz

Member
VIP
@Trading51, This indicator is range-bound between 1 and -1, so setting those as a secondary high/low filter would just put a boundary at the top and bottom. From what I understand, the very low filters are to keep you ought of sideways markets. When it's above/below those filters, it indicates movement/momentum out of the sideways move.

But a secondary filter may have good use at a .5/-.5 range, which would give you a better idea of the strength of the move.
I love this indicator so far. So your saying i should have both .5 and 1 ? im trying to achieve less signals
 
Last edited:

Similar threads

Top