logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
alikair  
#1 Posted : Saturday, May 22, 2010 5:29:35 PM(UTC)
alikair

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 1/29/2008(UTC)
Posts: 10

I am looking for a formula that would allow me to back test intra-bar the RSI indicator. What I am trying to do is convert RSI numbers to actual prices so that I would know what price RSI(c,2) =5 would be. (daily chart) I searched around and found nothing on this and am afraid there may be nothing like it out there.
johnl  
#2 Posted : Saturday, May 22, 2010 8:03:55 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

You might play around with ValueWhen():

a1:=ValueWhen(1, RSI(c,2) =5,C);

You may not get a hit with RSI(c,2) =5, you might try Cross( RSI(c,2),5)=1)
instead.
alikair  
#3 Posted : Saturday, May 22, 2010 10:53:46 PM(UTC)
alikair

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 1/29/2008(UTC)
Posts: 10

I don't think that will work. I am using a daily chart and need to know what price the the symbol was at when it reached a certain RSI. (that day) I believe the term is INTRA-BAR. So, say a formula tells me when RSI(c,2) = 5 the stock would be at 3.00 and the low of the day was 3.00 or less, then I could back test it as if I entered the trade at 3.00 or RSI(c,2)=5
mstt  
#4 Posted : Sunday, May 23, 2010 7:06:25 PM(UTC)
mstt

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)

Hi Alikair

{RSI Price Lookahead}

R:=Input("RSI Threshold",1,100,5);

D:=Input("RSI Periods ",1,100,2);

K:=Ref(C,-1);

Up:=Wilders(If(C>K,C-K,0),D);

Dn:=Wilders(If(K>C,K-C,0),D);

X:=(D-1)*(Dn*R/(100-R)-Up);

If(X>=0,C+X,C+X*(100-R)/R);

This indicator predicts the CLOSE needed on the next bar for the RSI to match the threshold.

Roy

alikair  
#5 Posted : Monday, May 24, 2010 7:27:48 AM(UTC)
alikair

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 1/29/2008(UTC)
Posts: 10

WOW! thats what if been looking for! Thank you! Did you make this yourself?
mstt  
#6 Posted : Monday, May 24, 2010 3:10:19 PM(UTC)
mstt

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)

Hi Alikair

Yes it is rather good. It's not my creation and sadly I don't recall who the author is. From memory it was posted in a public forum several years ago.

Here's another one that might be useful.

{EMA Lookahead}
A:=Input("EMA Target Value",0,20000,10);
D:=Input("EMA Periods",2,999,10);
F:=2/(1+D);
{Price required for given inputs}
(A-(1-F)*Mov(C,D,E))/F;

Roy

alikair  
#7 Posted : Monday, May 24, 2010 5:13:56 PM(UTC)
alikair

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 1/29/2008(UTC)
Posts: 10

Upon further inspection, it kinda looks as if it might be forward looking. it uses the close of the day. I don't know if it would give fair back testing results. still trying to figure it out
mstt  
#8 Posted : Monday, May 24, 2010 5:47:39 PM(UTC)
mstt

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)

You're right - it IS forward looking, but not in the way you suggest. It uses yesterday's CLOSE to tell you what future price (today's CLOSE) will be needed to produce the requested RSI value. The whole idea of the indicator is that it accurately predicts a future price. It uses a logical calculation to do this, not guesswork or reading tea-cups. At least try working through one or two examples and I'm sure you'll see that the indicator does what it purports to do. At that point you can rephrase your request for help if the indicator isn't what you had in mind.

Roy

alikair  
#9 Posted : Monday, May 24, 2010 6:02:15 PM(UTC)
alikair

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 1/29/2008(UTC)
Posts: 10

I am experimenting with using this indicator with the previous bars info ref (rsi lookback,-1) it seems to be working.
alikair  
#10 Posted : Tuesday, May 25, 2010 5:58:08 PM(UTC)
alikair

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 1/29/2008(UTC)
Posts: 10

Thanks again Roy. I guess my message didn't get posted in time. Yes, it works great if you use yesterday close. Thanks again!
siligard  
#11 Posted : Thursday, May 27, 2010 3:45:58 PM(UTC)
siligard

Rank: Newbie

Groups: Registered, Registered Users
Joined: 2/7/2006(UTC)
Posts: 8
Location: Greece

Hi all.
Roy, the math formula for the RSI Price Lookahead indicator you posted
was discovered by me. I made it publicly available under the name RevEngRSI via my June 2003 article
Reverse Engineering RSI in the S&C magazine
(see: http://www.traders.com/D...ligardos/siligardos.html">http://www.traders.com/Documentation/FEEDbk_docs/2003/06/Abstracts_new/Siligardos/siligardos.html)
(see also: http://www.traders.com/D...ersTips/TradersTips.html">http://www.traders.com/Documentation/FEEDbk_docs/2003/06/TradersTips/TradersTips.html).

Here is the original MSFL formula:
----------------------------
{Reverse Engineering RSI}
value:=Input("RSI value", 1, 100,50);
WildPer:=Input("Wilder Time Periods",1, 100,14);
ExpPer:=2*WildPer-1;

{Average Up Close}
AUC:=Mov( If(C>Ref(C,-1), C-Ref(C,-1), 0), ExpPer, E);
{Average Down Close}
ADC:=Mov( If(Ref(C,-1)>C, Ref(C,-1)-C, 0), ExpPer, E);

x:=(WildPer-1)*(ADC*value/(100-value)-AUC);
RevEngRSI:=If(x>=0, C+x, C+x*(100-value)/value);
RevEngRSI
------------------------
Regards,

Giorgos

mstt  
#12 Posted : Thursday, May 27, 2010 4:13:21 PM(UTC)
mstt

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)

Hi Giorgos

My appologies for not taking note of who created the formula. I'll rectify that by including a credit in my adaptaion of the code in any future posting. Back in 2003 I wasn't as aware of the importance of acknowledging public-domain code as I should have been and as a result I now have a number of formulas of unknown origin. Thanks for bringing this to my attention and for your contributions to the pool of MetaStock knowledge and skills.

Regards, Roy

siligard  
#13 Posted : Thursday, May 27, 2010 4:33:55 PM(UTC)
siligard

Rank: Newbie

Groups: Registered, Registered Users
Joined: 2/7/2006(UTC)
Posts: 8
Location: Greece

mstt wrote:

Hi Giorgos

My appologies for not taking note of who created the formula. I'll rectify that by including a credit in my adaptaion of the code in any future posting. Back in 2003 I wasn't as aware of the importance of acknowledging public-domain code as I should have been and as a result I now have a number of formulas of unknown origin. Thanks for bringing this to my attention and for your contributions to the pool of MetaStock knowledge and skills.

Regards, Roy



No need to apologize Roy. You simply can't be aware of the origin of all the formulas you encounter. Neither am I. [:)].
You phrase " It's not my creation and sadly I don't recall who the author is " is more than enough in such a case.

Since however I recall who is the creator of the math in the formula I think it was necessary to mention it
[:)].

Giorgos
alikair  
#14 Posted : Thursday, May 27, 2010 8:38:30 PM(UTC)
alikair

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 1/29/2008(UTC)
Posts: 10

Does anyone know if this indicator has the same problem as the regular RSI when it comes to using the explorer? The problem I am referring to I have only read about and don't know if its correct. it's when using RSI with 2 day time period, the results are wrong due to the way it calculates wilder's smoothing
mstt  
#15 Posted : Thursday, May 27, 2010 9:16:34 PM(UTC)
mstt

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)

Hi Alikair

The problem you speak of is really a USER problem, not an RSI or MetaStock problem. The root cause is that exponential moving averages of any sort (Wilders, Dema, Tema, EMA, Zero-Lag EMA etc.) require at least five times as much data than that specified by the Periods parameter in order to generate a stable and accurate result. If left to it's own devices the Explorer will only deliver about 30% of extra data (if you're lucky) above what's indicated by the highest Periods parameter in the exploration's code. EMAs require roughly 400% more data than that because of the way they're constructed. It's up to the user to change the Explorer from " Load Minimum Records" to "Load [censored]X Records" to get rid of "the problem".

Some formulas will work quite happily with minimum data records loaded, but formulas that use any one of the 30 odd functions that themselves are or use an EMA of one sort or another cannot "get up to speed" without significantly more data being made available.

Besides perceived problems with MAs, explorations using ANY Nth parameter function, with minimum or too few records available, is very likely to give N/A results. The Alert() function should also be regarded as an Nth parameter function rather than a Periods parameter function - it can generate N/A results when using minimum or too few records also.

So "the problem" is very easy to fix - just allow the Explorer access to sufficient data so that it can do it's job properly.

Roy

alikair  
#16 Posted : Friday, May 28, 2010 7:10:21 AM(UTC)
alikair

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 1/29/2008(UTC)
Posts: 10

Thanks Roy. Good to know this stuff.
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.