Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/30/2009(UTC) Posts: 46 Location: Hawaii, US
|
I want to tinker around with the RSI formula, to run a natural log on the avg gain/loss and try to smooth it's action without resorting to averaging of averages. I am unable to find the formula in full and dunno how to refer to so many days back........ Anybody got a link? Some code? Help a brother out... :)
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/30/2009(UTC) Posts: 46 Location: Hawaii, US
|
Mea culpa - I googled but didn't search here. The lameness.. it burns.....!! :)
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/30/2009(UTC) Posts: 46 Location: Hawaii, US
|
Ok. Wasn't able to make use of code from the thread, as I'd like to optimize for multiple periods with some kind of natural log modded RSI. So, used a spreadsheet I got here http://www.gstock.com/he...eStrengthIndexIndicator, which allows for input of any RSI period, and matches RSI values given by my usual chart sw, to back out this fail code: RP:=OPT1; NCA:=PREV+(1/RP*(C-REF(C,-1))-PREV); TCA:=PREV+(1/RP*(ABS(C-REF(C,-1))-PREV)); CR:=IF(TCA<>0,NCA/TCA,0); MRSI:=50*(CR+1); {initial test entry long: MRSI<REF(MRSI,-1)} This manual-rsi is unusual as it references the RSI period in two places, the same as the spreadsheet. And, it is useless as it returns different values, besides running slowly. Next, there's the log-modded version, which happily runs quickly, but sadly, reports errors. The altered line: CR:=IF(TCA<>0,log(NCA)/log(TCA),0); Anything strike you? :)
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
manatrader, The proper formula for RSI is easily found by searching the forum. Although one page did not show you the code in exactly the spoon-fed manner required, there were plenty of other sites on the forum which also discuss the RSI. For example : http://forum.equis.com/forums/thread/11833.aspxput("Periods",2,1000,14);
B:=CLOSE; U:=Wilders(If(B>Ref(B,-1),B-Ref(B,-1),0),A);
D:=Wilders(If(B<Ref(B,-1),Ref(B,-1)-B,0),A);
100-(100/(1+(U/Max(D,.00001))));
[/code] Readers of the MS Users Manual and those who have completed the Primer know they can change the Input() argument to a static value or an OPTx argument for system testing. The claim on the website for which provided a link, "RSI in the Excel is calculated slightly different than Wilder's RSI
formula as described above. The Excel calculation is the way most
systems today calculate RSI." seems to me to be a lazy way of saying they couldn't figure out to compute Wilders smoothing in Excel? I don't know of any charting package which computes RSI like they do; most packages I know can compute Wilders smoothing without resorting to nested PREV statements (or similar recursive functions). If you're going to modify the codes to do some other forms of computation, you are going to have to handle errors for those functions. e.g. CR:=IF(TCA<>0,NCA/TCA,0); will still generate DBZ errors; again, search the forum for discussions on how to avoid DBZ errors. wabbit [:D]
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/30/2009(UTC) Posts: 46 Location: Hawaii, US
|
Ugh and hooray, double fail ftw lol!
Thanks for running this down for me, you might prefer to let the crickets instruct if it is apparent I have not fully reviewed the manuals and searched the site. I tested and this version didn't quite match the native RSI but was workable for tweaking and it did outperform my non-log tests.
100-(100/(1+(log(U/Max(D,.00001)))));
This variation did not
100-(100/(1+((log(U1)/(log(Max(D1,.00001)))))));
I have had some encouraging results both here and with the natural logarithm of price prior to running MA tests. Wonder where to apply it next...............:)
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
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.