Hi,
I’m wondering if someone would like to take a look at coding John Ehlers’ recently created/released new indicator called the Deviated Scaled Oscillator with the Fisher Transform for mean reversion swing traders. The oscillator was featured in this October’s Stocks and Commodities Magazine. For a full explanation please see the 5 screenshots I took of the article including the code.
The theory behind the indicator is to remove the fat tails of a distribution to give a more perfect bell shaped Gaussian distribution which is necessary to trade low probability events at the extreme ends of the oscillator. This allows a price series to be placed into a probability distribution so that the probabilities of extreme moves corresponds to a normal standard deviation bell curve (distribution) which allows the prediction, in percentage terms, for the odds of a +2/-2 standard deviation move away from the mean price (centre of the bell curve).
I also found the code today on https://www.tradingview.com/script/DdLQBt87-Ehlers-Fisherized-Deviation-Scaled-Oscillator/
The code is as follows:
//@version=3
// Copyright (c) 2018-present, Alex Orekhov (everget)
// Ehlers Fisherized Deviation-Scaled Oscillator script may be freely distributed under the MIT license.
study("Ehlers Fisherized Deviation-Scaled Oscillator", shorttitle="EFDSO")
length = input(title="Length", type=integer, defval=40, minval=1)
ssfLength = input(title="Super Smoother Filter Length", type=integer, defval=20, minval=1)
numberOfPoles = input(title="Number of Poles", type=integer, defval=2, options=[2, 3])
overboughtLevel = input(title="Overbought Level", type=float, defval=2, step=0.1)
oversoldLevel = input(title="Oversold Level", type=float, defval=-2, step=0.1)
src = input(title="Source", type=source, defval=close)
PI = 2 * asin(1)
twoPoleSuperSmootherFilter(src, length) =>
arg = sqrt(2) * PI / length
a1 = exp(-arg)
b1 = 2 * a1 * cos(arg)
c2 = b1
c3 = -pow(a1, 2)
c1 = 1 - c2 - c3
ssf = 0.0
ssf := c1 * src + c2 * nz(ssf[1]) + c3 * nz(ssf[2])
threePoleSuperSmootherFilter(src, length) =>
arg = PI / length
a1 = exp(-arg)
b1 = 2 * a1 * cos(1.738 * arg)
c1 = pow(a1, 2)
coef2 = b1 + c1
coef3 = -(c1 + b1 * c1)
coef4 = pow(c1, 2)
coef1 = 1 - coef2 - coef3 - coef4
ssf = 0.0
ssf := coef1 * src + coef2 * nz(ssf[1]) + coef3 * nz(ssf[2]) + coef4 * nz(ssf[3])
zeros = src - nz(src[2])
// Ehlers Super Smoother Filter
essf = numberOfPoles == 2
? twoPoleSuperSmootherFilter((zeros + zeros[1]) / 2, ssfLength)
: threePoleSuperSmootherFilter((zeros + zeros[1]) / 2, ssfLength)
// Rescale filter in terms of Standard Deviations
scaledFilter = 0.0
scaledFilter := stdev(essf, length) != 0
? essf / stdev(essf, length)
: nz(scaledFilter[1])
// Apply Fisher Transform to establish real Gaussian Probability Distribution
efdso = 0.0
efdso := abs(scaledFilter) < 2
? 0.5 * log((1 + scaledFilter / 2) / (1 - scaledFilter / 2))
: nz(efdso[1])
efdsoColor = efdso > overboughtLevel ? #0ebb23 : efdso < oversoldLevel ? #cc0000 : #674ea7
plot(efdso, title="EFDSO", linewidth=2, color=efdsoColor, transp=0)
hline(overboughtLevel, title="Overbought Level", linestyle=dotted, color=#e69138)
hline(0, title="Zero Level", linestyle=dotted, color=#989898)
hline(oversoldLevel, title="Oversold Level", linestyle=dotted, color=#e69138)
Looks interesting and the article is definitely worth the read. The last two article images with the code will be posted separately.