log in     sign up for free
 
By living the philosophy that my winners are always in front of me, it is not so painful to take a loss. If I make a mistake, so what!
Marty Schwartz
 
 
Home
systems (284)
 
Special offer: buy MetaStock (try for free)   |   Reuters QuoteCenter Real-Time Data (get a free month)   |   EOD Data
 
Formula Library
 
AmiBroker
MetaTrader
MetaStock
TradeStation
Wealth-Lab
NinjaTrader
 
add your formula
System Library
 
 
Account login
Your email:
Password:
 
Log in
New to s4t? Sign up.
If you forgot your password click here.
Search the Web
 
Custom Search

Trend Detection Index

Formula for: TradeStation

indicator


 

 

Views:  2715

Added: August 13, 2008
 
Rate this code:  Rate: 1 Rate: 2 Rate: 3 Rate: 4 Rate: 5

2

1 ratings
 

email this link

 
 
Tags: TradeStation, indicator
 
Your Ad Here
In my article in this issue (October 2001 Stocks & Commodities), I present the trend detection index (TDI), which can be used to help detect when a trend has begun and when it has come to an end.
--M.H. Pee

Here's how to calculate the TDI in TradeStation EasyLanguage:

 

 



Code:

Type : Indicator, Name : Trend Detection Index

inputs:
Price( Close ),
Length( 20 ) ;

variables:
Length2( 2 * Length ),
Mom( 0 ),
MomAbs( 0 ),
MomSum( 0 ),
MomSumAbs( 0 ),
MomAbsSum( 0 ) ,
MomAbsSum2( 0 ),
TDL( 0 ),
MktPos( 0 ) ;
Mom = Price - Price[Length] ;
MomAbs = AbsValue( Mom ) ;
MomSum = Summation( Mom, Length ) ;
MomSumAbs = AbsValue( MomSum ) ;
MomAbsSum = Summation( MomAbs, Length ) ;
MomAbsSum2 = Summation( MomAbs, Length2 ) ;

{Plot TDL for the index itself.}
TDL = MomSumAbs - ( MomAbsSum2 - MomAbsSum ) ;
{Plot MktPos for outright buy and sell signals}
MktPos = Iff( TDL[1] > 0, Iff( MomSum[1] > 0, 1, -1 ), MktPos[1] );
Plot1( MktPos,"Position");

 






Author: M. H. Pee
Source: http://www.traders.com

 

View similar (indicator for TradeStation):

Volume Weighted Average Price - SMA
Support and Resistance Indicator
DIMA Averages
Adaptive Stochastic Oscillator
Tether Line
Osc Normalization
Market Mood Indicator
MACD of MFI
Draw Linear Regression Lines For Two Past Periods
eVwma
...
 
 
all formulas for TradeStation
all formulas

 

 

Email to friend

Top

 

     
However we try to maintain hiqhest possible level of service - most formulas, oscillators, indicators
and systems are submitted by anonymous users.
Therefore S4T™ does not take any responsibility for it's quality.
If you use any of this information, use it at your own risk. You are responsible for your own trading decisions.
Be sure to verify that any information you see on these pages is correct, and is applicable to your particular trade.
In no case will S4T™ be responsible for your trading gains or losses.
 
Privacy note | (c) copyrights systems4trading.com 2006-2012