Registered User Joined: 9/11/2010 Posts: 7
|
I would like to write this in PCF.
The refference URL is tradingview's pine script.
https://www.tradingview.com/wiki/Connors_RSI_(CRSI)#CALCULATION
There are three major components to Connors RSI
RSI = Standard RSI developed by Wilder. This is typically a short-term RSI. In this example it is a 3 Period RSI.
UpDown Length = The number of consecutive days that a security price has either closed up (higher than previous day) or closed down (lower than previous days).
Closing up values represented in positive numbers and closing down is represented with negative numbers.
If a security closes at the same price on back to back days, the UpDown Length is 0.
Connors RSI then applies a short-term RSI to the UpDown Streak Value. In this example it is a 2 period RSI.
ROC = The Rate-of-Change. The ROC takes a user-defined look-back period and calculates a percentage of the number of values
within that look back period that are below the current day price change percentage.
The final CRSI calculation then simply finding the average value of the three components.
CRSI(3,2,100) = [ RSI(3) + RSI(UpDown Length,2) + ROC(100) ] / 3
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The the best way to write this is probably given in StockGuy's Thursday, January 26, 2017 9:29:15 AM ET post on page 2 of the ConnorsRSI topic.
(WRSI3 + 100 * XAVG(GREATEST(0, IIF(SGN(C - C1) = SGN(C1 - C2), SGN(C - C1), SGN(C - C1) - TrueInRow(C1 > C2, 10) + TrueInRow(C1 < C2, 10))), 3) / XAVG(ABS(IIF(SGN(C - C1) = SGN(C1 - C2), SGN(C - C1), SGN(C - C1) - TrueInRow(C1 > C2, 10) + TrueInRow(C1 < C2, 10))), 3) + 50 * (SGN(C / C1 - C1 / C2) + SGN(C / C1 - C2 / C3) + SGN(C / C1 - C3 / C4) + SGN(C / C1 - C4 / C5) + SGN(C / C1 - C5 / C6) + SGN(C / C1 - C6 / C7) + SGN(C / C1 - C7 / C8) + SGN(C / C1 - C8 / C9) + SGN(C / C1 - C9 / C10) + SGN(C / C1 - C10 / C11) + SGN(C / C1 - C11 / C12) + SGN(C / C1 - C12 / C13) + SGN(C / C1 - C13 / C14) + SGN(C / C1 - C14 / C15) + SGN(C / C1 - C15 / C16) + SGN(C / C1 - C16 / C17) + SGN(C / C1 - C17 / C18) + SGN(C / C1 - C18 / C19) + SGN(C / C1 - C19 / C20) + SGN(C / C1 - C20 / C21) + SGN(C / C1 - C21 / C22) + SGN(C / C1 - C22 / C23) + SGN(C / C1 - C23 / C24) + SGN(C / C1 - C24 / C25) + SGN(C / C1 - C25 / C26) + SGN(C / C1 - C26 / C27) + SGN(C / C1 - C27 / C28) + SGN(C / C1 - C28 / C29) + SGN(C / C1 - C29 / C30) + SGN(C / C1 - C30 / C31) + SGN(C / C1 - C31 / C32) + SGN(C / C1 - C32 / C33) + SGN(C / C1 - C33 / C34) + SGN(C / C1 - C34 / C35) + SGN(C / C1 - C35 / C36) + SGN(C / C1 - C36 / C37) + SGN(C / C1 - C37 / C38) + SGN(C / C1 - C38 / C39) + SGN(C / C1 - C39 / C40) + SGN(C / C1 - C40 / C41) + SGN(C / C1 - C41 / C42) + SGN(C / C1 - C42 / C43) + SGN(C / C1 - C43 / C44) + SGN(C / C1 - C44 / C45) + SGN(C / C1 - C45 / C46) + SGN(C / C1 - C46 / C47) + SGN(C / C1 - C47 / C48) + SGN(C / C1 - C48 / C49) + SGN(C / C1 - C49 / C50) + SGN(C / C1 - C50 / C51) + SGN(C / C1 - C51 / C52) + SGN(C / C1 - C52 / C53) + SGN(C / C1 - C53 / C54) + SGN(C / C1 - C54 / C55) + SGN(C / C1 - C55 / C56) + SGN(C / C1 - C56 / C57) + SGN(C / C1 - C57 / C58) + SGN(C / C1 - C58 / C59) + SGN(C / C1 - C59 / C60) + SGN(C / C1 - C60 / C61) + SGN(C / C1 - C61 / C62) + SGN(C / C1 - C62 / C63) + SGN(C / C1 - C63 / C64) + SGN(C / C1 - C64 / C65) + SGN(C / C1 - C65 / C66) + SGN(C / C1 - C66 / C67) + SGN(C / C1 - C67 / C68) + SGN(C / C1 - C68 / C69) + SGN(C / C1 - C69 / C70) + SGN(C / C1 - C70 / C71) + SGN(C / C1 - C71 / C72) + SGN(C / C1 - C72 / C73) + SGN(C / C1 - C73 / C74) + SGN(C / C1 - C74 / C75) + SGN(C / C1 - C75 / C76) + SGN(C / C1 - C76 / C77) + SGN(C / C1 - C77 / C78) + SGN(C / C1 - C78 / C79) + SGN(C / C1 - C79 / C80) + SGN(C / C1 - C80 / C81) + SGN(C / C1 - C81 / C82) + SGN(C / C1 - C82 / C83) + SGN(C / C1 - C83 / C84) + SGN(C / C1 - C84 / C85) + SGN(C / C1 - C85 / C86) + SGN(C / C1 - C86 / C87) + SGN(C / C1 - C87 / C88) + SGN(C / C1 - C88 / C89) + SGN(C / C1 - C89 / C90) + SGN(C / C1 - C90 / C91) + SGN(C / C1 - C91 / C92) + SGN(C / C1 - C92 / C93) + SGN(C / C1 - C93 / C94) + SGN(C / C1 - C94 / C95) + SGN(C / C1 - C95 / C96) + SGN(C / C1 - C96 / C97) + SGN(C / C1 - C97 / C98) + SGN(C / C1 - C98 / C99) + SGN(C / C1 - C99 / C100) + SGN(C / C1 - C100 / C101)) / 100 + 50) / 3
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 9/11/2010 Posts: 7
|
Thanks Bruce
|
Registered User Joined: 3/11/2016 Posts: 3
|
Hi Bruce. i did this and I got a "syntax error" message.
Also, i could not repost it into the TC box after putting it into a Word doc.
Any suggestions
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
It is only go to work in TC2000 v18. It will not work in earlier versions of TC2000 and I do not have a way to write an alternative that will work in older versions.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|