Below is a compilation of the calculations involved in arriving at RSI Everything. For the record, RSI Everything was created because I simply couldn’t figure out which of the four RSI based indicators was “the best” – so simply combined them into one “everything and the kitchen sink” indicator, for better or worse.
!#######################################
!Code for RSIAll:
!In English: Add the current 2-day, 3-day and 4-day RSI values and divide by 3
Define days2 3.
U2 is [close]-val([close],1).
D2 is val([close],1)-[close].
AvgU2 is ExpAvg(iff(U2>0,U2,0),days2).
AvgD2 is ExpAvg(iff(D2>=0,D2,0),days2).
RSI2 is 100-(100/(1+(AvgU2/AvgD2))).
Define days3 5.
U3 is [close]-val([close],1).
D3 is val([close],1)-[close].
AvgU3 is ExpAvg(iff(U3>0,U3,0),days3).
AvgD3 is ExpAvg(iff(D3>=0,D3,0),days3).
RSI3 is 100-(100/(1+(AvgU3/AvgD3))).
Define days4 7.
U4 is [close]-val([close],1).
D4 is val([close],1)-[close].
AvgU4 is ExpAvg(iff(U4>0,U4,0),days4).
AvgD4 is ExpAvg(iff(D4>=0,D4,0),days4).
RSI4 is 100-(100/(1+(AvgU4/AvgD4))).
RSIAll is (RSI2+RSI3+RSI4)/3.
!#######################################
!#######################################
!Code for RSIROC:
!In English: calculate the 3-day change in the standard 3-day RSI value and add it to (the current 3-day RSI minus 50). RSIROC is a 2-day exponential average of that value.
ThreeDayROCRSI is (RSI3-valresult(RSI3,3)).
RSIPlusROCRSI is (RSI3-50)+ThreeDayROCRSI.
RSIROC is (expavg(RSIPlusROCRSI, 2)).
!#######################################
!#######################################
!Code for RSIq2:
!In English: calculate the 3-day change in the standard 14-day RSI value and subtract it from (14-day RSI minus 50). RSIROC14 is a 2-day exponential average of that value. Add (14-day RSI minus 50) to RSIROC14 and multiply by 2 to get current RSIq2 value.
ThreeDayROCRSI14 is (RSI14-valresult(RSI14,3)).
RSIPlusROCRSI14 is (RSI14-50)+ThreeDayROCRSI14.
RSIROC14 is (expavg(RSIPlusROCRSI14, 2)).
RSI14mid50 is RSI14-50.
RSIq2 is (RSIROC14+RSI14mid50)*2.
!#######################################
!#######################################
!Code for TDREI
In English: Um, try Googling “Tom Demark Range Expansion Index” – sorry.
Hitoday is [high].
H2 is val([high], 2).
H5 is val([high], 5).
H6 is val([high], 6).
Lotoday is [low].
L2x is val([low], 2).
L5 is val([low], 5).
L6 is val([low], 6).
Closetoday is [close].
C7 is val([close], 7).
C8 is val([close], 8).
TD1 is [high] – h2.
TD2 is [low] – l2x.
TD3 is iff(([high] >= l5 or [high] >= l6) and ([low] <= h5 or [low] <= h6), 1, 0).
TD4 is iff((h2 >= c7 or h2 >= c8) and (l2x <=c7 or l2x <=c8), 1, 0).
TD6 is td1 + td2.
TD5 is iff((td3 + td4) >=1, td6, 0).
TD7 is abs(td1) + abs(td2).
TDREI is ((TD5 + valresult(TD5, 1) + valresult(TD5, 2) + valresult(TD5, 3) + valresult(TD5, 4)) / (TD7 + valresult(TD7, 1) + valresult(TD7, 2) +valresult(TD7, 3) + valresult(TD7, 4))) * 100.
!#######################################
!#######################################
!Code for TD Everything:
!In English: Add the four indicator values together and divide by 4
!Note: 50 is subtracted from RSIAll here to make 0 neutral as with the other indicators
RSIEverything is (((RSIAll-50) +RSIROC +RSIq2 +TDREI) / 4)
!#######################################
Jay Kaeppel