in Search

What is the fomula for RSI

Last post 02-27-2007, 6:35 by wabbit. 18 replies.
Sort Posts: Previous Next
  •  01-20-2007, 17:33 22609

    What is the fomula for RSI

    I want to scan the stock based on 2 days RSI (not 14 days) if the RSI is below 10 also if RSI above 90. What will be the formula ??

    Thanks in advance

    Bill

  •  01-21-2007, 4:44 22610 in reply to 22609

    Re: What is the fomula for RSI

    The formula should be: (RSI(C,2)<10) OR (RSI(C,2)>90).

    But in explorer, RSI for 2 or 3 days alway get error. It seem that in the smallest no. of days to be used must be 4.

  •  01-21-2007, 10:29 22611 in reply to 22610

    Re: What is the fomula for RSI

    Thanks Wblam, I will keep in mind. I want to add this scan with RMO. Lets see what happens.
  •  01-21-2007, 11:14 22612 in reply to 22610

    Re: What is the fomula for RSI

    I read this article http://www.tradingmarkets.com/.site/stocks/commentary/editorial/2-Period-RSI.cfm
    They say 2day RSI Produte beter result then 14 day.

    So I ran the following.

        a:=(Fml("Rahul Mohindar Osc (RMO)") > 0) AND

        (Fml("SwingTrd 2")>0) AND

        (Fml("SwingTrd 2")>Fml("SwingTrd 3")) AND
        (RSI(C,2)<10);

         a=1 AND Ref(a,-1)=0

    and Found following matches that return 1.

    AAPL
    CRAY
    GIGA
    RADS
    VOCS

    I am going to watch those stocks in next few days and see what happens.

    Is my formula right  ???

    Thanks

    Bill

  •  01-21-2007, 11:26 22613 in reply to 22612

    Re: What is the fomula for RSI

    WBLIM you are right. 2 day RSI does not work, please ignore my last post. Here are the results of 4day RSI (just RSI)

    Security Name RSI Ticker Symbol Location 
    FASTENAL ORD 1.0000 FAST 
    Forgent Networks, Inc. 1.0000 FORG  
    GARMIN ORD 1.0000 GRMN  
    SANDISK ORD 1.0000 SNDK  
    WHOLE FOODS ORD 1.0000 WFMI 
    YAHOO ORD 1.0000 YHOO 

    Lets see what happens to those stocks in next few day.

  •  01-21-2007, 14:18 22614 in reply to 22613

    Re: What is the fomula for RSI

    billsingh:

    WBLIM you are right. 2 day RSI does not work, please ignore....

    Lets see what happens to those stocks in next few day.

    Everything is so magic, right?  ;)

  •  01-21-2007, 23:22 22615 in reply to 22609

    Re: What is the fomula for RSI

    Hi Bill, I found a solution, create a custom indicator for 2 days RSI, call it RSI2. The formula is as follow:

    U:=If(C>Ref(C,-1),C-Ref(C,-1),0)+If(Ref(C,-1)>Ref(C,-2),Ref(C,-1)-Ref(C,-2),0);
    D:=If(C<Ref(C,-1),Ref(C,-1)-C,0)+If(Ref(C,-1)<Ref(C,-2),Ref(C,-2)-Ref(C,-1),0);
    u/(u+d)*100;

    Then in explorer, Filer tab:

    Fml("RSI2")<10 OR Fml("RSI2")>90

    BTW, does RMO trading system help you make money so far? I do not have ver 10 yet.

  •  01-22-2007, 9:46 22619 in reply to 22615

    Re: What is the fomula for RSI

    Wblam,

    As in the book " Technical Analysis A to Z " by Steven B Achelis the calculation for RSI = 100 - ( 100 / (1 + U/D)),where  U = Avg upward price change & D = Avg downward price change,hence your code needs a modification at last line.

    Asish


    Asish
  •  01-22-2007, 10:37 22620 in reply to 22619

    Re: What is the fomula for RSI

    uasish:

    Wblam,

    As in the book " Technical Analysis A to Z " by Steven B Achelis the calculation for RSI = 100 - ( 100 / (1 + U/D)),where  U = Avg upward price change & D = Avg downward price change,hence your code needs a modification at last line.

    Asish

    Hi Asish,

    My formula is correct. The definition of the variables U and D in my formula are different from the book. In the book, U = Avg upward price change , but in my formula, U = Total upward price change. Similarly for  D.

    OK let me change my variables from U to A and D to V.

    Now, U=A/2 and D=V/2, and 

    RSI = 100 - ( 100 / (1 + U/D))

    =A/(A+V)*100.

  •  01-22-2007, 17:18 22623 in reply to 22615

    Re: What is the fomula for RSI

    Wblam,
                 Thanks for that formula, Yes I have metastock 10. Actually just strat looking into technicals. Please let me know if you want to test anything on metastock 10.

    Regards

    Bill

  •  01-22-2007, 20:32 22625 in reply to 22623

    Re: What is the fomula for RSI

    billsingh:

    Wblam,
                 Thanks for that formula, Yes I have metastock 10. Actually just strat looking into technicals. Please let me know if you want to test anything on metastock 10.

    Regards

    Bill

    Hi Bill,

    I have ver 9 and thinking whether want to upgrade to ver 10. As I know, ver 10 not much new thing compare to ver 9 except a new trading system RMO system which claimed is a very successful system and help many people made a lot of money. I like to know your opinon on that system.

  •  01-23-2007, 2:15 22627 in reply to 22615

    Re: What is the fomula for RSI

    wblam:

    U:=If(C>Ref(C,-1),C-Ref(C,-1),0)+If(Ref(C,-1)>Ref(C,-2),Ref(C,-1)-Ref(C,-2),0);
    D:=If(C<Ref(C,-1),Ref(C,-1)-C,0)+If(Ref(C,-1)<Ref(C,-2),Ref(C,-2)-Ref(C,-1),0);
    u/(u+d)*100;

    It doesn't seem right with the above formula. When the above code plotted on a local index, it shows 100 and 0 for some periods. 

    I also plot RSI(2) on another inner box, the above code doesn't in-line with RSI(2)...... seems not right to me or ....?

    Sa

     

  •  01-23-2007, 6:16 22629 in reply to 22620

    Re: What is the fomula for RSI

    Wblam,

    If you have a particular objective of getting total upward price change then it is ok,but the link you provided where the RSI - 2 periods success rate for very short  time frame is very encouraging,as per their findings & the basic concept of this leading indicator lies in it's avg of up/dn .However this 2 period time frame will mostly mis match with the chart & exploration values in MS .However i am using Jose's following code ( with little tweaking for my purpose) since long.It may be of some use,the following is his original :

    .........................................8.................................................................

    { Smoothed RSI indicator v1.1 }
    { Internal sine-weighted smoothing }
    { Automatic historically-valid RSI peak/trough
      boundaries}
    { Boundary crossover signals: +1=Long, -1=Short}
    { ©Copyright 2004 Jose Silva }
    { http://www.metastocktools.com }

    { user input }
    pds:=1/Input("RSI periods",1,2520,10);
    plot:=Input("plot:  [1]-RSI,  [2]-Long/Short signals",1,2,1);

    { RSI up/down average components }
    x:=If(C>Ref(C,-1),C-Ref(C,-1),0);
    y:=If(C<Ref(C,-1),Ref(C,-1)-C,0);
    up:=PREV*(1-pds)+x*pds;
    dw:=PREV*(1-pds)+y*pds;

    { sine-weighted internal smoothing }
    s1:=Sin(30)*up;
    s2:=Sin(60)*Ref(up,-1);
    s3:=Sin(90)*Ref(up,-2);
    s4:=Sin(60)*Ref(up,-3);
    s5:=Sin(30)*Ref(up,-4);
    up:=(s1+s2+s3+s4+s5)/(Sin(30)*2+Sin(60)*2
    +Sin(90));
    S1:=Sin(30)*dw;
    S2:=Sin(60)*Ref(dw,-1);
    S3:=Sin(90)*Ref(dw,-2);
    S4:=Sin(60)*Ref(dw,-3);
    S5:=Sin(30)*Ref(dw,-4);
    dw:=(s1+s2+s3+s4+s5)/(Sin(30)*2+Sin(60)*2
    +Sin(90));

    { RSI indicator }
    dw:=If(dw=0,.000001,dw);
    RS:=100-100/(1+up/dw);

    { automatic RSI peak/trough boundaries }
    pk:=Ref(RS,-1)>Ref(RS,-2) AND Ref(RS,-1)>RS
    AND Alert(Ref(C,-1)>Ref(C,-2)
    AND Ref(C,-1)>C,2) {AND Ref(RS,-1)>50};
    pkVal:=ValueWhen(1,pk,Ref(RS,-1));
    pkAvg:=Cum(pkVal)/Cum(pkVal>-1);

    tr:=Ref(RS,-1)<Ref(RS,-2) AND Ref(RS,-1)<RS
    AND Alert(Ref(C,-1)<Ref(C,-2)
    AND Ref(C,-1)<C,2) {AND Ref(RS,-1)<50};
    trVal:=ValueWhen(1,tr,Ref(RS,-1));
    trAvg:=Cum(trVal)/Cum(trVal>-1);

    { RSI peak/trough boundary cross signals }
    up:=Cross(trAvg,RS);
    dw:=Cross(RS,pkAvg);
    signals:=up-dw;

    { alternative RSI peak/trough signals }
    {up:=Ref(RS,-1)<Ref(RS,-2) AND Ref(RS,-1)<RS
     AND Ref(RS,-1)<trAvg;
    dw:=Ref(RS,-1)>Ref(RS,-2) AND Ref(RS,-1)>RS
     AND Ref(RS,-1)>pkAvg;
    signals:=up-dw;}

    { plot }
    If(plot=1,pkAvg,0);
    If(plot=1,trAvg,0);
    If(plot=1,RS,signals)

    ..........................................................8......................................

    Asish


    Asish
  •  01-23-2007, 11:08 22632 in reply to 22627

    Re: What is the fomula for RSI

    Spaceant:
    wblam:

    U:=If(C>Ref(C,-1),C-Ref(C,-1),0)+If(Ref(C,-1)>Ref(C,-2),Ref(C,-1)-Ref(C,-2),0);
    D:=If(C<Ref(C,-1),Ref(C,-1)-C,0)+If(Ref(C,-1)<Ref(C,-2),Ref(C,-2)-Ref(C,-1),0);
    u/(u+d)*100;

    It doesn't seem right with the above formula. When the above code plotted on a local index, it shows 100 and 0 for some periods. 

    I also plot RSI(2) on another inner box, the above code doesn't in-line with RSI(2)...... seems not right to me or ....?

    Sa

     

    I found out the reason. MetaStock uses Wilder's smoothing average. My formula is equivalent to using simple average.

    You may try this:

    A:=If(C>Ref(C,-1),C-Ref(C,-1),0);
    B:=If(C<Ref(C,-1),Ref(C,-1)-C,0);
    u:=Wilders(A,2);
    d:=Wilders(B,2);
    u/(u+d)*100;

    It should be looked the same now.

     

  •  01-23-2007, 11:22 22633 in reply to 22629

    Re: What is the fomula for RSI

    uasish:

    Wblam,

    If you have a particular objective of getting total upward price change then it is ok .....

    Mathematically, if simple average is used,

    U=A/n and D=B/n

    then  U/D = A/B.

    uasish:

    ... the link you provided ... 

    The link is not provided by me, is by Bill.

     

  •  01-23-2007, 11:54 22635 in reply to 22625

    Re: What is the fomula for RSI

    Wblam,
                   I recommend upgrade and yes I know few people who have 10 consective winning trade using RMO what is what made me buy Metastock ver 10. For this year in Jan it made me over 20k with one trade and I am in the second trade with 5k up using RMO.

    Go get it tiger, it is worth the money you pay for upgrade.

    Regards

    Bill

  •  02-24-2007, 17:51 23103 in reply to 22635

    Re: What is the fomula for RSI

    Bill and All,

    You don't NEED to upgrade to MS10 to get the RMO as it is exactly the same as the Rainbow Oscillator that was included with previous versions of MS (as early as MS7).

    There are other good reasons to upgrade to MS10, besides the RMO.


    wabbit Big Smile [:D]



    Please update your thread status:

    FREE Equis Formula Primer : http://forum.equis.com/files/19673/download.aspx
    To post code, *code* your code */code*
    To post links, URL goes here
    For custom MetaStock and DLL programming : http://www.wabbit.com.au
    Contact via SkyPE
  •  02-24-2007, 23:50 23107 in reply to 23103

    Re: What is the fomula for RSI

    Hi Wabbit,

    Thank you for the information. I found the Rainbow Oscilator indicator. However it is not documented in the manual of ver. 9.1.

    Can you teach us how to create a template like the one in ver. 10?

    Thanks.

    Lam

  •  02-27-2007, 6:35 23124 in reply to 23107

    Re: What is the fomula for RSI

    Can you teach us how to create a template like the one in ver. 10?


    I will do so in due course and post it under a new thread.... stay tuned.


    wabbit Big Smile [:D]



    Please update your thread status:

    FREE Equis Formula Primer : http://forum.equis.com/files/19673/download.aspx
    To post code, *code* your code */code*
    To post links, URL goes here
    For custom MetaStock and DLL programming : http://www.wabbit.com.au
    Contact via SkyPE
View as RSS news feed in XML