Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 11/24/2005(UTC) Posts: 10
|
I am looking for a basic formula to plot RSI without wilders smothing
Is there a formula that would allow me to do this in Meta Stock?
Any help would be greatly appreciated
RLS
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
RLS
This is the underlying formula for RSI(). Just change it to suit.
{RSI Indicator}
A:=Input("Periods",2,99,10);
B:=C; {target array}
U:=Wilders(If(B>Ref(B,-1),B-Ref(B,-1),0),A);
D:=Wilders(If(B<Ref(B,-1),Ref(B,-1)-B,0),A);
100-(100/(1+(U/D)));
Roy
MetaStock Tips & Tools
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 11/24/2005(UTC) Posts: 10
|
Mstt
Thank you for the fast reply, but the formula you posted still includes Wilders smooting
What I am looking for is the formula for Standard RSI (not including Wilders smoothing)
Is there a way the formula you posted can be re-written to remove the Wilders smoothing function
I am not that great with formulas so I am not sure how to go about removing the wilders smoothing and still get the formula to work
rls
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
RLS
I assumed how to remove Wilders Smoothing would be obvious so I didn't mention it. Try this version. You could simply have set the "periods" parameter to 1 for the same effect (A:=1;).
{RSI Indicator}
A:=Input("Periods",2,99,10);
B:=C; {target array}
U:=If(B>Ref(B,-1),B-Ref(B,-1),0);
D:=If(B<Ref(B,-1),Ref(B,-1)-B,0);
100-(100/(1+(U/D)));
Roy
MetaStock Tips & Tools
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 11/24/2005(UTC) Posts: 10
|
MStt
Once again thank you for the prompt reply
I guess I should have worded my last post better. I tried the formula the way you have it revised but was getting a devide by zero error and thought I just didn't know what I was doing.
However I must still be missing something
I copied and pasted your revised formula and I am still getting the "Division by zero" error
rls
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 9/8/2004(UTC) Posts: 2,266
Was thanked: 1 time(s) in 1 post(s)
|
Replace the last line of code by:
[code:1:9bc136e9bb]100-(100/(1+(U/Max(D,.00001))));[/code:1:9bc136e9bb]
Patrick :mrgreen:
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 11/24/2005(UTC) Posts: 10
|
Patrick
your code on the last line took care of the division by zero error, but now the indicator is displaying a just a flat line.
Here is how I have it written.
{RSI Indicator}
A:=Input("Periods",2,99,10);
B:=C; {target array}
U:=If(B>Ref(B,-1),B-Ref(B,-1),0)=10;
D:=If(B<Ref(B,-1),Ref(B,-1)-B,0)=10;
100-(100/(1+(U/Max(D,.00001))));
rls
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 9/8/2004(UTC) Posts: 2,266
Was thanked: 1 time(s) in 1 post(s)
|
:eek:
Make sure you plot the indicator in its own window ... I don't see why you would get a flat line.
Patrick :mrgreen:
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 11/24/2005(UTC) Posts: 10
|
Its in its own window
More information
While trying to figure this out I changed the the "10" at the end of the If statements to "0" and got a fast binary wave, but any other value gives a flat line.
Somehow its not seeing the number of periods correclty
{RSI Indicator}
A:=Input("Periods",2,99,10);
B:=C; {target array}
U:=If(B>Ref(B,-1),B-Ref(B,-1),0)=0;
D:=If(B<Ref(B,-1),Ref(B,-1)-B,0)=0;
100-(100/(1+(U/Max(D,.00001))));
rls
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 11/24/2005(UTC) Posts: 10
|
Finally got it figured out
Here is the correct "working" version of my formula for "Standard RSI" (Wilders smothing removed)
To get the number of periods to work the "Wilders" function had to be replaced with the "Sum" function as shown here. I Can't beleive I was not seeing the fact that I still needed a function to call the number of periods, but like I said I am not that good with the formulas.
Try this as a custom indicator and compare it to the the RSI built into Meta Stock using the same number of periods and you will see the difference, especially where crosses below 30 and above 70 are concerned.
{RSI Indicator}
A:=Input("Periods",2,99,14);
B:=C; {target array}
U:=Sum(If(B>Ref(B,-1),B-Ref(B,-1),0),A);
D:=Sum(If(B<Ref(B,-1),Ref(B,-1)-B,0),A);
100-(100/(1+(U/Max(D,.00001))));
mstt
Thank You for your help in getting me the underlying formula
Patrick
Thank you for help with the Division by zero error
RLS
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
RLS
You've just takes some whorthwhile steps towards improving your formula language skills. Keep up the good work.
Roy
MetaStock Tips & Tools
|
|
|
|
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.