Need help programming RSI without wilderaverage function
Forums › ProRealTime English forum › ProBuilder support › Need help programming RSI without wilderaverage function
- This topic has 5 replies, 2 voices, and was last updated 3 years ago by robertogozzi.
-
-
01/03/2021 at 2:28 PM #15608601/03/2021 at 3:01 PM #156092
Here’s the code, you can change it as best suits you:
1234567891011121314151617181920212223242526// RSI custom//// (https://www.prorealcode.com/topic/indicatore-rsi/#post-51250)// (https://www.investopedia.com/terms/r/rsi.asp)//// p = 14p = max(1,min(p,999)) //2 - 999Ob = 70Os = 100 - Ob//// Determina le variazione giornaliererialzo = MAX(0, CLOSE - CLOSE[1])ribasso = MAX(0, CLOSE[1] - CLOSE)// Calcola la media dei guadagni i giorni di rialzo// e delle perdite i gorni di ribassommRialzo = WILDERAVERAGE[p](rialzo)mmRibasso = WILDERAVERAGE[p](ribasso)// En déduit le RSRS = mmRialzo / mmRibasso// E finalmente le RSImioRSI = 100 - (100 / (1 + RS))RETURN mioRSI AS "Rsi",Os AS "Os",Ob AS "Ob", 50 as "Mid"01/11/2021 at 7:03 PM #157389Thank you robertogozzi for that answer.
I have tryed to apply a golden ratio multiplier of 1.618 to all closing prices that go in to the formula but no mather how i write this code it just dosen’t seem to work. The program ignores the multiplier (1.618) and displayes regular RSI instead.
Do you have any idea of what it is i’m doing wrong, or is it simply not possible to apply a multiplier to the Prorealcode Wilderaverage function?Here is my code:
RSI with golden ratio123456789101112131415161718//variation of closing pricesUPCLOSE = MAX(0, CLOSE - CLOSE[1])DOWNCLOSE = MAX(0, CLOSE[1] - CLOSE)//1.618 golden ratio multiplier to all closing pricesBULL = UPCLOSE * 1.618BEAR = DOWNCLOSE * 1.618//Average upcloses divided by average down closesBULLAVERAGE = WILDERAVERAGE[14](BULL)BEARAVERAGE = WILDERAVERAGE[14](BEAR)RS = BULLAVERAGE/BEARAVERAGE//Relative strength index formulaMYRSI = 100 - 100 / (1 + RS)RETURN MYRSI, 30, 50, 7001/11/2021 at 7:19 PM #157395It shouldn’t change anything.
If you have 14 closing prices RSI returns some data, If you multiply those prices for wahtever number you want RSI will always return the same result.
Example:
123423 * 1 = 232 * 1 = 2-------------23 / 2 = 11.5no matter if you multiply each number by two or else, the result will be the same (11.5):
123423 * 2 = 462 * 2 = 4-------------46 / 4 = 11.51 user thanked author for this post.
05/19/2021 at 1:27 PM #16997905/19/2021 at 2:40 PM #169986Smoothing any indicator means applying an average to it. So a smoothed RSI is quite simple:
123MyRSI = Rsi[14](close) //standard RSISmoothedRSI = Average[10,1](MyRSI) //RSI smoothed with a 10-period EMARETURN MyRSI AS "Rsi",SmoothedRSI AS "Smoothed Rsi" -
AuthorPosts
Find exclusive trading pro-tools on