TDI (Trend Detection Index) tka 4-2005 metastock code

Vragen en suggesties over handelssystemen en indicatoren

Moderator: Perry

TDI (Trend Detection Index) tka 4-2005 metastock code

Berichtdoor mvs » do 21 apr 2005, 13:09

Hallo,

In tka 4-2005 staat de TDI indicator, met de bijhorende meta code,
in metastock ben ik niet zo thuis.

Kan iemand hem of heeft iemand hem al omgetoverd naar EL-code?

Metastock-formules: Trend Detection Index:
x: = Input("Tijdspanne",5,50,20);
am: = Abs(C-Ref(C,-(x-1)));
td: = Sum(C-Ref(C,-(x-1)),x);
tdi: = (Abs(td)+Sum(am,x))-Sum(am,(2*x));
status: = If(tdi>0, If(td>0,1,-1), PREV);
tdi;
td;
status*LastValue(Highest(Max(Abs(tdi),Abs(td))))


bvd,

Martin
mvs
 
Berichten: 64
Geregistreerd op: zo 08 jun 2003, 14:05
Woonplaats: Bergambacht z-h

Berichtdoor Dirk » do 21 apr 2005, 13:23

Beste Martin,

Bij deze:

Dick.



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

variables:
Length2( 2 * Length ),
Mom( 0 ),
MomAbs( 0 ),
MomSum( 0 ),
MomSumAbs( 0 ),
MomAbsSum( 0 ) ,
MomAbsSum2( 0 ),
TDI( 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 ) ;

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

#BeginSystem('Trend Change');
if MktPos =1 then buy;
if MktPos =-1 then Sell;
#End;
Dirk
 
Berichten: 28
Geregistreerd op: wo 07 aug 2002, 16:30
Woonplaats: Rosmalen

Berichtdoor mvs » vr 22 apr 2005, 0:29

Dirk,

Hartelijk dank voor je code, werkt prima, na een kleine aanpassing.

De trend is namelijk (bij mij) niet goed te zien. Soms is de TDI groter dan 1000 punten (bv nasdaq) dan word er een onzichterbare trend weer gegeven.

Dirk, bedankt.


Ik heb hem zo aangepast:

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

variables:
Length2( 2 * Length ),
Mom( 0 ),
MomAbs( 0 ),
MomSum( 0 ),
MomSumAbs( 0 ),
MomAbsSum( 0 ) ,
MomAbsSum2( 0 ),
TDI( 0 ),
MktPos( 0 ),
HH (0),
LL (0);

Mom = Price - Price[Length] ;
MomAbs = AbsValue( Mom ) ;
MomSum = Summation( Mom, Length ) ;
MomSumAbs = AbsValue( MomSum ) ;
MomAbsSum = Summation( MomAbs, Length ) ;
MomAbsSum2 = Summation( MomAbs, Length2 ) ;
HH = Highest(TDI,10000);
LL = Lowest (TDI,10000);
TDI = MomSumAbs - ( MomAbsSum2 - MomAbsSum ) ;
{Plot MktPos for outright buy and sell signals}
MktPos = Iff( TDI[1] > 0, Iff( MomSum[1] > 0, HH, LL ), MktPos[1] );
Plot1( MktPos,"Position");
Plot2 (TDI, "TD Index") {for the index itself.};
Plot3 (MomSum, "Direction Indicator");

#BeginSystem('Trend Change');
if MktPos >0 then buy;
if MktPos <0 then Sell;
#End;
mvs
 
Berichten: 64
Geregistreerd op: zo 08 jun 2003, 14:05
Woonplaats: Bergambacht z-h


Keer terug naar Handelssystemen + Indicatoren

Wie is er online

Gebruikers op dit forum: Geen geregistreerde gebruikers en 3 gasten

cron