Ehlers Stochastic
"Ehlers Stochastic" by everget, MIT. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: Ehlers Stochastic (v3.0), read 2026-10-12T15:49:27.168Z; source language v3.
Licence: MIT License (MIT) — full text.
Ehlers Stochastic by everget, ported from Pine v3. Pane indicator with 1 plot, 3 fills, 5 levels and 8 inputs.
// Copyright (c) 2018-present, Alex Orekhov (everget)
// Ehlers Stochastic script may be freely distributed under the MIT license.
// ------------------------------------------------------------------------------------------------
// Original author: everget
// Original title: Ehlers Stochastic
// Licence: MIT (the header above is the original notice, kept verbatim)
// Pine version: 3
// Fetched: 2026-10-12
// Ported to FloScript by FloSignals; modifications under MPL-2.0.
// Converter: @flosignals/floscript 0.1.0, strict mode, score 100/100
// ------------------------------------------------------------------------------------------------
//@floscript=1
//@version=5
// Converted by the FloScript converter from a Pine-compatible v3 source.
indicator("Ehlers Stochastic", shorttitle="EStoch")
highpassLength = input.int(title="High-Pass Filter Length", defval=48)
stochLength = input.int(title="Stochastic Length", defval=20)
ssfLength = input.int(title="Super Smoother Filter Length", defval=10)
numberOfPoles = input.int(title="Super Smoother Filter Poles", defval=2, options=[2, 3])
obLevel = input.float(title="Overbought Level", defval=0.8, step=0.1)
osLevel = input.float(title="Oversold Level", defval=0.2, step=0.1)
src = input.source(title="Source", defval=close)
highlightBreakouts = input.bool(title="Highlight Overbought/Oversold Breakouts ?", defval=true)
PI = 2 * math.asin(1)
_ssf2(src, length) =>
arg = math.sqrt(2) * PI / length
a1 = math.exp(-arg)
b1 = 2 * a1 * math.cos(arg)
c2 = b1
c3 = -math.pow(a1, 2)
c1 = 1 - c2 - c3
ssf = 0.0
ssf := c1 * src + c2 * nz(ssf[1]) + c3 * nz(ssf[2])
_ssf3(src, length) =>
arg = PI / length
a1 = math.exp(-arg)
b1 = 2 * a1 * math.cos(1.738 * arg)
c1 = math.pow(a1, 2)
coef2 = b1 + c1
coef3 = -(c1 + b1 * c1)
coef4 = math.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])
_rf(src, highpassLength, ssfLength, numberOfPoles) =>
alphaArg = 2 * PI / (highpassLength * math.sqrt(2))
alpha = 0.0
alpha := math.cos(alphaArg) != 0 ? (math.cos(alphaArg) + math.sin(alphaArg) - 1) / math.cos(alphaArg) : nz(alpha[1])
highpass = 0.0
highpass := math.pow(1 - alpha / 2, 2) * (src - 2 * nz(src[1]) + nz(src[2])) + 2 * (1 - alpha) * nz(highpass[1]) - math.pow(1 - alpha, 2) * nz(highpass[2])
arg = (highpass + nz(highpass[1])) / 2
numberOfPoles == 2 ? _ssf2(arg, ssfLength) : _ssf3(arg, ssfLength)
_stoch(rf, stochLength, ssfLength, numberOfPoles) =>
estoch = fixnan(ta.stoch(rf, rf, rf, stochLength) / 100)
estoch := na(estoch) ? 0 : estoch
arg = (estoch + nz(estoch[1])) / 2
numberOfPoles == 2 ? _ssf2(arg, ssfLength) : _ssf3(arg, ssfLength)
erf = _rf(src, highpassLength, ssfLength, numberOfPoles)
estoch = _stoch(erf, stochLength, ssfLength, numberOfPoles)
estochColor = estoch > obLevel ? #0ebb23 : estoch < osLevel ? color.red : #f4b77d
plot(estoch, title="EStoch", linewidth=2, color=color.new(estochColor, 0))
transparent = color.new(color.white, 100)
maxLevelPlot = hline(1, title="Max Level", linestyle=hline.style_dotted, color=transparent)
obLevelPlot = hline(obLevel, title="Overbought Level", linestyle=hline.style_dotted)
hline(0.5, title="Middle Level", linestyle=hline.style_dotted)
osLevelPlot = hline(osLevel, title="Oversold Level", linestyle=hline.style_dotted)
minLevelPlot = hline(0, title="Min Level", linestyle=hline.style_dotted, color=transparent)
fill(obLevelPlot, osLevelPlot, color=color.new(color.purple, 95))
obFillColor = estoch > obLevel and highlightBreakouts ? color.green : transparent
osFillColor = estoch < osLevel and highlightBreakouts ? color.red : transparent
fill(maxLevelPlot, obLevelPlot, color=color.new(obFillColor, 90))
fill(minLevelPlot, osLevelPlot, color=color.new(osFillColor, 90))
This file is under the MIT License; it is a port of the original by everget, with the original licence header kept and the changes made for FloScript noted in the file.
- v2
Library refresh 2026-10-14
- v1
Library refresh 2026-10-12
Disclaimer. Scripts are written and published by members, or ported by FloSignals from open-source originals, and are their authors' own work and opinion. FloSignals does not review them for correctness and nothing in a script is financial advice or a recommendation to buy or sell anything — read the Risk Disclaimer. Posting here is under the Community Rules; a script that is not the poster's to post can be reported as the Copyright & Takedowns page says.

Comments (0)
No comments yet. Members can leave one.