Last active
September 19, 2021 10:27
-
-
Save marketcalls/fdffba14a8a8ccc3dcf0 to your computer and use it in GitHub Desktop.
smooth RSI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //////////////////////////////////////////////////////////// | |
| // | |
| // This is new version of RSI oscillator indicator, developed by John Ehlers. | |
| // The main advantage of his way of enhancing the RSI indicator is smoothing | |
| // with minimum of lag penalty. | |
| //////////////////////////////////////////////////////////// | |
| study(title="Smoothed RSI") | |
| Length = input(10, minval=1) | |
| xValue = (close + 2 * close[1] + 2 * close[2] + close[3] ) / 6 | |
| CU23 = sum(iff(xValue > xValue[1], xValue - xValue[1], 0), Length) | |
| CD23 = sum(iff(xValue < xValue[1], xValue[1] - xValue, 0), Length) | |
| nRes = iff(CU23 + CD23 != 0, CU23/(CU23 + CD23), 0) | |
| plot(nRes, color=blue, title="Smoothed RSI") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment