Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Wilder's RSI2 Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
jrlsee
Posted : Monday, June 8, 2015 2:01:19 AM
Registered User
Joined: 6/8/2015
Posts: 2
HI,
 
I was trying to calculate the Wilder's RSI value manually. The value which I obtain does not match the computer program which it generated for Wilder RSI. Would you please provide the formular which it generate for RSI, specifically for RSI with a period of 2.
 
Thank you,
 
 
Bruce_L
Posted : Monday, June 8, 2015 10:48:19 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

Calculating a Wilder's Smoothed Relative Strength Index (Wilder's RSI) by hand is a fairly daunting task. Even a 2-period version is going to require a significant number of bars to calculate a decent approximation.

The technique given in the help files is as follows.

RSI is calculated using the following formula:
RSI = 100 - (100 / (1+RS))
RS = n period average of up closes / n period average of down closes

This is pretty much the method as described by Wilder, but I probably wouldn't use it personally if I had to do it by hand. Instead I would probably use the following.

RSI = 100 * n period average of up net changes in the close / n period average of absolute net changes in the close

The same details about how the moving averages are calculated applies.

In RSI, RS uses a simple average of the up and down closes. In Wilder's RSI, RS uses Wilder's smoothing which is a different form of exponential averaging. Wilder's smoothing = Previous MA value + (1/n periods * (Close - Previous MA))

Note that when taking the n period average of the up net changes, that negative or 0 net changes are still averaged in. You just need to use zero for the value being used.

Now the non-Wilder's smooth 2-period case for this is a fairly short formula and simple to calculate.

100 * (ABS(C > C1) * (C - C1) + ABS(C1 > C2) * (C1 - C2)) / (ABS(C - C1 + ABS(C - C2))

The ABS(C > C1) and ABS(C1 > C2) multiply C - C1 and C1 - C2 by 1 if true and 0 if false to create the number described in the algorithm I would use to calculate this by hand. C is the current close, C1 is the previous close and C2 is the close of 2 bars ago. I didn't divide the numerator and denominator by 2 to convert the sum into an average because it would cancel out.

The above formula is for the non-Wilder's Smoothed version of RSI. As mentioned in the definition in the help files, the Wilder's smoothed version uses a type of exponential moving average for its calculation instead of simple moving averages.

On the chart, we would start calculating exponential moving averages at the oldest bar (the very first bar of data available when scrolling back) and then get a new value for the numerator and denominator at each bar. This means the Wilder's Smoothed version of RSI uses all of the data on the chart to calculate its value. The older data is less significant to the calculations than the newer data however, so the contribution of the older data to the calculations eventually becomes small enough to ignore.

I am instead going to calculate the formula from the newest data to the oldest data until I get to a point where I feel I can safely ignore the older data. I'm going to go out far enough to include the close of 14 bars ago in the calculations, but you might want to go further.

100 * (ABS(C > C1) * (C - C1) + .5 * (ABS(C1 > C2) * (C1 - C2) + .5 * (ABS(C2 > C3) * (C2 - C3) + .5 * (ABS(C3 > C4) * (C3 - C4) + .5 * (ABS(C4 > C5) * (C4 - C5) + .5 * (ABS(C5 > C6) * (C5 - C6) + .5 * (ABS(C6 > C7) * (C6 - C7) + .5 * (ABS(C7 > C8) * (C7 - C8) + .5 * (ABS(C8 > C9) * (C8 - C9) + .5 * (ABS(C9 > C10) * (C9 - C10) + .5 * (ABS(C10 > C11) * (C10 - C11) + .5 * (ABS(C11 > C12) * (C11 - C12) + .5 * (ABS(C12 > C13) * (C12 - C13) + .5 * (ABS(C13 > C14) * (C13 - C14))))))))))))))) / (ABS(C - C1) + .5 * (ABS(C1 - C2) + .5 * (ABS(C2 - C3) + .5 * (ABS(C3 - C4) + .5 * (ABS(C4 - C5) + .5 * (ABS(C5 - C6) + .5 * (ABS(C6 - C7) + .5 * (ABS(C7 - C8) + .5 * (ABS(C8 - C9) + .5 * (ABS(C9 - C10) + .5 * (ABS(C10 - C11) + .5 * (ABS(C11 - C12) + .5 * (ABS(C12 - C13) + .5 * (ABS(C13 - C14)))))))))))))))

The structure of the formula is the same, but each older factor is multiplied by .5 since it only makes half the contribution to the result as the newer factor.

There would be a factor applied at the beginning of the numerator and denominator to calculate the average, but it cancels out since it is the same in both cases. If I were actually writing a formula and not doing this by hand, I would probably re-arrange things a bit to make the formula shorter.

50 * (C - XAVGC3.1) / 2 / (.50003052 * (ABS(C - C1) + .5 * (ABS(C1 - C2) + .5 * (ABS(C2 - C3) + .5 * (ABS(C3 - C4) + .5 * (ABS(C4 - C5) + .5 * (ABS(C5 - C6) + .5 * (ABS(C6 - C7) + .5 * (ABS(C7 - C8) + .5 * (ABS(C8 - C9) + .5 * (ABS(C9 - C10) + .5 * (ABS(C10 - C11) + .5 * (ABS(C11 - C12) + .5 * (ABS(C12 - C13) + .5 * (ABS(C13 - C14)))))))))))))))) + 50

The only new syntax in this formula in the XAVGC3.1 section which stands for a 3-period exponential moving average of the close.

Personal Criteria Formula Syntax



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
donv98
Posted : Monday, June 8, 2015 11:51:23 AM
Registered User
Joined: 7/29/2010
Posts: 417

I am trying to use the pcf syntax for the non-smoothed Wilder's RSI in a conditon.

I would like to search a condition where yesterday's RSI14 is <40 and another where RSI<30.

I am using

(RSI14.1.1)<40

Many of the values that come up in the scan are >40 when I compare them to the smoothed RSI14 indicator values. I assume this is because of the smoothing vs non smoothing.

Is there any way to improve this so I get values in my scan that more closely replicate those on the smoothed chart?

Or maybe there is a better approach.

I want to find stocks oversold to some extent yesterday that have broken out today.

Many thanks for any help

 

 

Bruce_L
Posted : Monday, June 8, 2015 12:42:31 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

You can't use the non-Wilder's smoothed formula to replicate a Wilder's Smoothed RSI. The values just aren't going to match and in many cases will not even be close.

Your formula will work for the plain RSI indicator in TC2000 version 12.5 without Wilder's smoothing.

If you are using the RSI - Wilder's indicator with Wilder's smoothing then you would be best of clicking on the chart and selecting Create Scan Condition to create your conditions (this is true of the non-Wilder's version as well... but at least its formula isn't complicated).

If you want to scan for yesterday's value instead of today's value, add a 1-period moving average to the RSI with the Offset set to 1. This will display the value for the previous bar as the current value. This means you can then click on the offset moving average and select Create Scan Condition to create a condition for the previous bar instead of the current bar.

Create Conditions from Your Chart (5:25)

A Condition Formula for yesterday's 14-period Wilder's smoothed RSI being less than 40 would be quite long.

50 * (C1 - XAVGC27.2) / 14 / (.071435345 * (ABS(C1 - C2) + 13 / 14 * (ABS(C2 - C3) + 13 / 14 * (ABS(C3 - C4) + 13 / 14 * (ABS(C4 - C5) + 13 / 14 * (ABS(C5 - C6) + 13 / 14 * (ABS(C6 - C7) + 13 / 14 * (ABS(C7 - C8) + 13 / 14 * (ABS(C8 - C9) + 13 / 14 * (ABS(C9 - C10) + 13 / 14 * (ABS(C10 - C11) + 13 / 14 * (ABS(C11 - C12) + 13 / 14 * (ABS(C12 - C13) + 13 / 14 * (ABS(C13 - C14) + 13 / 14 * (ABS(C14 - C15) + 13 / 14 * (ABS(C15 - C16) + 13 / 14 * (ABS(C16 - C17) + 13 / 14 * (ABS(C17 - C18) + 13 / 14 * (ABS(C18 - C19) + 13 / 14 * (ABS(C19 - C20) + 13 / 14 * (ABS(C20 - C21) + 13 / 14 * (ABS(C21 - C22) + 13 / 14 * (ABS(C22 - C23) + 13 / 14 * (ABS(C23 - C24) + 13 / 14 * (ABS(C24 - C25) + 13 / 14 * (ABS(C25 - C26) + 13 / 14 * (ABS(C26 - C27) + 13 / 14 * (ABS(C27 - C28) + 13 / 14 * (ABS(C28 - C29) + 13 / 14 * (ABS(C29 - C30) + 13 / 14 * (ABS(C30 - C31) + 13 / 14 * (ABS(C31 - C32) + 13 / 14 * (ABS(C32 - C33) + 13 / 14 * (ABS(C33 - C34) + 13 / 14 * (ABS(C34 - C35) + 13 / 14 * (ABS(C35 - C36) + 13 / 14 * (ABS(C36 - C37) + 13 / 14 * (ABS(C37 - C38) + 13 / 14 * (ABS(C38 - C39) + 13 / 14 * (ABS(C39 - C40) + 13 / 14 * (ABS(C40 - C41) + 13 / 14 * (ABS(C41 - C42) + 13 / 14 * (ABS(C42 - C43) + 13 / 14 * (ABS(C43 - C44) + 13 / 14 * (ABS(C44 - C45) + 13 / 14 * (ABS(C45 - C46) + 13 / 14 * (ABS(C46 - C47) + 13 / 14 * (ABS(C47 - C48) + 13 / 14 * (ABS(C48 - C49) + 13 / 14 * (ABS(C49 - C50) + 13 / 14 * (ABS(C50 - C51) + 13 / 14 * (ABS(C51 - C52) + 13 / 14 * (ABS(C52 - C53) + 13 / 14 * (ABS(C53 - C54) + 13 / 14 * (ABS(C54 - C55) + 13 / 14 * (ABS(C55 - C56) + 13 / 14 * (ABS(C56 - C57) + 13 / 14 * (ABS(C57 - C58) + 13 / 14 * (ABS(C58 - C59) + 13 / 14 * (ABS(C59 - C60) + 13 / 14 * (ABS(C60 - C61) + 13 / 14 * (ABS(C61 - C62) + 13 / 14 * (ABS(C62 - C63) + 13 / 14 * (ABS(C63 - C64) + 13 / 14 * (ABS(C64 - C65) + 13 / 14 * (ABS(C65 - C66) + 13 / 14 * (ABS(C66 - C67) + 13 / 14 * (ABS(C67 - C68) + 13 / 14 * (ABS(C68 - C69) + 13 / 14 * (ABS(C69 - C70) + 13 / 14 * (ABS(C70 - C71) + 13 / 14 * (ABS(C71 - C72) + 13 / 14 * (ABS(C72 - C73) + 13 / 14 * (ABS(C73 - C74) + 13 / 14 * (ABS(C74 - C75) + 13 / 14 * (ABS(C75 - C76) + 13 / 14 * (ABS(C76 - C77) + 13 / 14 * (ABS(C77 - C78) + 13 / 14 * (ABS(C78 - C79) + 13 / 14 * (ABS(C79 - C80) + 13 / 14 * (ABS(C80 - C81) + 13 / 14 * (ABS(C81 - C82) + 13 / 14 * (ABS(C82 - C83) + 13 / 14 * (ABS(C83 - C84) + 13 / 14 * (ABS(C84 - C85) + 13 / 14 * (ABS(C85 - C86) + 13 / 14 * (ABS(C86 - C87) + 13 / 14 * (ABS(C87 - C88) + 13 / 14 * (ABS(C88 - C89) + 13 / 14 * (ABS(C89 - C90) + 13 / 14 * (ABS(C90 - C91) + 13 / 14 * (ABS(C91 - C92) + 13 / 14 * (ABS(C92 - C93) + 13 / 14 * (ABS(C93 - C94) + 13 / 14 * (ABS(C94 - C95) + 13 / 14 * (ABS(C95 - C96) + 13 / 14 * (ABS(C96 - C97) + 13 / 14 * (ABS(C97 - C98) + 13 / 14 * (ABS(C98 - C99) + 13 / 14 * (ABS(C99 - C100) + 13 / 14 * (ABS(C100 - C101) + 13 / 14 * (ABS(C101 - C102) + 13 / 14 * (ABS(C102 - C103) + 13 / 14 * (ABS(C103 - C104) + 13 / 14 * (ABS(C104 - C105) + 13 / 14 * (ABS(C105 - C106) + 13 / 14 * (ABS(C106 - C107) + 13 / 14 * (ABS(C107 - C108) + 13 / 14 * (ABS(C108 - C109) + 13 / 14 * (ABS(C109 - C110) + 13 / 14 * (ABS(C110 - C111) + 13 / 14 * (ABS(C111 - C112) + 13 / 14 * (ABS(C112 - C113) + 13 / 14 * (ABS(C113 - C114) + 13 / 14 * (ABS(C114 - C115) + 13 / 14 * (ABS(C115 - C116) + 13 / 14 * (ABS(C116 - C117) + 13 / 14 * (ABS(C117 - C118) + 13 / 14 * (ABS(C118 - C119) + 13 / 14 * (ABS(C119 - C120) + 13 / 14 * (ABS(C120 - C121) + 13 / 14 * (ABS(C121 - C122) + 13 / 14 * (ABS(C122 - C123) + 13 / 14 * (ABS(C123 - C124) + 13 / 14 * (ABS(C124 - C125) + 13 / 14 * (ABS(C125 - C126))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) + 50 < 40



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
donv98
Posted : Monday, June 8, 2015 12:53:46 PM
Registered User
Joined: 7/29/2010
Posts: 417

Bruce,

   Wow!

Many thanks for your fine efforts.

I am so glad I asked.

I applaud you for your elegant solutions.

Don

Bruce_L
Posted : Monday, June 8, 2015 2:14:30 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

You're welcome.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

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.