Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 1/7/2009(UTC) Posts: 5
|
I am trying to formulae TD REI oscillator. Appreciate if someone can assist in coding. Thanks.
X = (current high - high of 2 bars ago) + (current low - low of 2 bars ago)
Y = Cumulative Sum of X (one bar ago to five bars ago)
Hm = highest high in past 5 bars
Lm = lowest low in past 5 bars
TD REI = (Y/(Hm - Lm)) x 100
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 4/27/2005(UTC) Posts: 126 Location: Italy
|
From http://www.linnsoft.com/tour/techind/tdrei.htm:
N:=5; X:= IF(((H>=Ref(L,-5) OR H>=Ref(L,-6)) AND (L<=Ref(H,-5) OR L<=Ref(H,-6)) ) OR ((Ref(H,-2)>=Ref(C,-7) OR Ref(H,-2)>=Ref(C,-8)) AND (Ref(L,-2)<=Ref(C,-7) OR Ref(L,-2)<=Ref(C,-8)))), (H - Ref(H,-2)) + (L - Ref(L,-2)), 0); TDREI = SUM(x,N) / SUM(ABS(X), N); TDREI
Is this correct?
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 1/7/2009(UTC) Posts: 5
|
thanks but there is some missing '(', ')', ':'.
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 1/7/2009(UTC) Posts: 5
|
i HAVE corrected by adding '(', but i get division error by 0 error.
N:=5;
X:= If(((H>=Ref(L,-5) OR H>=Ref(L,-6)) AND (L<=Ref(H,-5) OR L<=Ref(H,-6))) OR ((Ref(H,-2)>=Ref(C,-7) OR Ref(H,-2)>=Ref(C,-8)) AND (Ref(L,-2)<=Ref(C,-7) OR (Ref(L,-2)<=Ref(C,-8)))),
(H - Ref(H,-2)) + (L - Ref(L,-2)),
0);
TDREI:= Sum(X,N) / Sum(Abs(X), N);
TDREI
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 4/27/2005(UTC) Posts: 126 Location: Italy
|
Change
TDREI:= Sum(X,N) / Sum(Abs(X), N); to
TDREI:= Sum(X,N) / max(0.0001,Sum(Abs(X), N));
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 1/7/2009(UTC) Posts: 5
|
Thanks. The zero division error is no longer there.
However, the current TD REI does seem to differ from what i get from Bloomberg. Hmm, have to figure this one out.
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.