Ergodic Oscillator
"Ergodic Oscillator" by everget, MIT. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: Ergodic Oscillator (v2.0), read 2026-10-12T15:49:14.511Z; source language v3.
Licence: MIT License (MIT) — full text.
Ergodic Oscillator by everget, ported from Pine v3. Pane indicator with 3 plots, 2 marker series, 4 fills, 5 levels, bar/background colouring and 15 inputs.
// Copyright (c) 2018-present, Alex Orekhov (everget)
// Ergodic Oscillator script may be freely distributed under the MIT license.
// ------------------------------------------------------------------------------------------------
// Original author: everget
// Original title: Ergodic Oscillator
// 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("Ergodic Oscillator", shorttitle="EOSC")
smooth1Length = input.int(title="1st Smoothing Length", minval=1, defval=8)
smooth2Length = input.int(title="2nd Smoothing Length", minval=1, defval=5)
signalLength = input.int(title="Signal Length", minval=1, defval=5)
ergodicLength = input.int(title="Ergodic Length", minval=1, defval=5)
ergodicSignalLength = input.int(title="Ergodic Signal Length", minval=1, defval=14)
obLevel = input.int(title="Overbought Level", defval=20)
osLevel = input.int(title="Oversold Level", defval=-20)
maxLevel = input.int(title="Max Level", defval=75)
minLevel = input.int(title="Min Level", defval=-75)
src = input.source(title="Source", defval=close)
showHistogram = input.bool(title="Show Histogram ?", defval=false)
highlightBreakouts = input.bool(title="Highlight Overbought/Oversold Breakouts ?", defval=false)
highlightCrossovers = input.bool(title="Highlight Ergodic/Signal Crossovers ?", defval=true)
highlightZeroCrossovers = input.bool(title="Highlight Zero Line Crossovers ?", defval=false)
applyFilling = input.bool(title="Apply Ribbon Filling ?", defval=false)
momentum = ta.change(src)
ema1 = ta.ema(momentum, smooth1Length)
ema1Abs = ta.ema(math.abs(momentum), smooth1Length)
ema2 = ta.ema(ema1, smooth2Length)
ema2Abs = ta.ema(math.abs(ema1Abs), smooth2Length)
tsi = 100 * ema2 / ema2Abs
tsiSignal = ta.ema(tsi, signalLength)
ergodic = ta.ema(tsiSignal, ergodicLength)
signal = ta.ema(ergodic, ergodicSignalLength)
hist = ergodic - signal
histColor = hist >= 0 ? (hist[1] < hist ? #26A69A : #B2DFDB) : hist[1] < hist ? #FFCDD2 : #EF5350
plot(showHistogram ? hist : na, title="Histogram", style=plot.style_columns, color=color.new(histColor, 0))
trendColor = ergodic > signal ? #0ebb23 : color.red
ergodicColor = applyFilling ? trendColor : #ff3e7d
signalColor = applyFilling ? trendColor : #3c78d8
ergodicPlot = plot(ergodic, title="Ergodic", color=color.new(ergodicColor, 0))
signalPlot = plot(signal, title="Signal", color=color.new(signalColor, 0))
transparent = color.new(color.white, 100)
maxLevelPlot = hline(maxLevel, title="Max Level", linestyle=hline.style_dotted, color=transparent)
obLevelPlot = hline(obLevel, title="Overbought Level", linestyle=hline.style_dotted, color=#0ebb23)
hline(0, title="Zero Level", linestyle=hline.style_dotted, color=#989898)
osLevelPlot = hline(osLevel, title="Oversold Level", linestyle=hline.style_dotted, color=#ff9370)
minLevelPlot = hline(minLevel, title="Min Level", linestyle=hline.style_dotted, color=transparent)
fill(obLevelPlot, osLevelPlot, color=color.new(color.purple, 95))
obFillColor = ergodic > obLevel and highlightBreakouts ? color.green : transparent
osFillColor = ergodic < osLevel and highlightBreakouts ? color.red : transparent
fill(maxLevelPlot, obLevelPlot, color=color.new(obFillColor, 85))
fill(minLevelPlot, osLevelPlot, color=color.new(osFillColor, 85))
fillColor = applyFilling ? trendColor : transparent
fill(ergodicPlot, signalPlot, color=color.new(fillColor, 70))
zeroCrossBgColor = highlightZeroCrossovers ? (ergodic > 0 ? color.green : color.red) : transparent
bgcolor(color.new(zeroCrossBgColor, 90))
plotshape(highlightCrossovers and ta.crossover(ergodic, signal) ? ergodic : na, title="Crossover", location=location.absolute, style=shape.circle, size=size.tiny, color=color.new(color.green, 0))
plotshape(highlightCrossovers and ta.crossunder(ergodic, signal) ? ergodic : na, title="Crossunder", location=location.absolute, style=shape.circle, size=size.tiny, color=color.new(color.red, 0))
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.