Mobility Oscillator [CC]
"Mobility Oscillator [CC]" by cheatcountry, MIT. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: Mobility Oscillator [CC] (v1.0), read 2026-10-12T15:45:41.132Z; source language v5.
Licence: MIT License (MIT) — full text.
Mobility Oscillator [CC] by cheatcountry, ported from Pine v5. Pane indicator with 2 plots, 1 level, alerts and 7 inputs.
// Copyright (c) 2019-present, Franklin Moormann (cheatcountry)
// Mobility Oscillator [CC] script may be freely distributed under the MIT license.
// ------------------------------------------------------------------------------------------------
// Original author: cheatcountry
// Original title: Mobility Oscillator [CC]
// Licence: MIT (the header above is the original notice, kept verbatim)
// Pine version: 5
// 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
indicator('Mobility Oscillator [CC]', max_bars_back=3000, overlay=false)
f_security(_symbol, _res, _src, _repaint) =>
_src[_repaint ? 0 : barstate.isrealtime ? 1 : 0][_repaint ? 0 : barstate.isrealtime ? 0 : 1]
res = input.timeframe(title="Resolution", defval='')
rep = input.bool(title="Allow Repainting?", defval=false)
bar = input.bool(title="Allow Bar Color Change?", defval=false)
inp = input(title='Source', defval=close)
h = f_security(syminfo.tickerid, res, high, rep)
l = f_security(syminfo.tickerid, res, low, rep)
c = f_security(syminfo.tickerid, res, inp, rep)
lbLength = input.int(title='LbLength', defval=14, minval=1)
length = input.int(title='Length', defval=10, minval=1)
signalLength = input.int(title='SignalLength', defval=7, minval=1)
f_pdf(_i, _m, _n, _h, _l) =>
hMax = ta.highest(_h, _n)
lMin = ta.lowest(_l, _n)
rx = _m != 0 ? (hMax - lMin) / _m : 0
bl = lMin + (_i - 1) * rx
bu = lMin + _i * rx
pdf = 0.0
for j = 1 to _n
currHigh = _i >= j ? nz(h[_i - j]) : 0
currLow = _i >= j ? nz(l[_i - j]) : 0
if currHigh <= bu
pdf := pdf + 1
if currHigh <= bu or currLow >= bu
if currHigh <= bl
pdf := pdf - 1
if currHigh <= bl or currLow >= bl
continue
pdf := pdf - (currHigh - currLow != 0 ? (bl - currLow) / (currHigh - currLow) : 0)
pdf := pdf + (currHigh - currLow != 0 ? (bu - currLow) / (currHigh - currLow) : 0)
pdf := _n != 0 ? pdf / _n : 0
result = pdf
f_mo(_m, _n, _h, _l, _c) =>
hMax = ta.highest(_h, _n)
lMin = ta.lowest(_l, _n)
rx = _m != 0 ? (hMax - lMin) / _m : 0
prevC = nz(c[_n])
imx = 1
pdfmx = 0.0
pdfc = 0.0
for i = 1 to _m
bu = lMin + i * rx
bl = bu - rx
pdfi = f_pdf(i, _m, _n, _h, _l)
pdfmx := i == 1 ? pdfi : pdfmx
imx := pdfi > pdfmx ? i : imx
pdfmx := math.max(pdfi, pdfmx)
pdfc := i == 1 ? pdfi : pdfc
pdfc := prevC > bl and prevC <= bu ? pdfi : pdfc
pmo = lMin + (imx - 0.5) * rx
mo = pdfmx != 0 ? 100 * (1 - pdfc / pdfmx) : 0
mo := prevC < pmo ? -mo : mo
result = -mo
mo = ta.wma(f_mo(length, lbLength, h, l, c), signalLength)
moSig = ta.wma(mo, signalLength)
slo = mo - moSig
sig = slo > 0 ? (slo > nz(slo[1]) ? 2 : 1) : slo < 0 ? (slo < nz(slo[1]) ? -2 : -1) : 0
alertcondition(ta.crossover(sig, 1), "Strong Buy Signal", "Strong Bullish Change Detected")
alertcondition(ta.crossunder(sig, -1), "Strong Sell Signal", "Strong Bearish Change Detected")
alertcondition(ta.crossover(sig, 0), "Buy Signal", "Bullish Change Detected")
alertcondition(ta.crossunder(sig, 0), "Sell Signal", "Bearish Change Detected")
moColor = sig > 1 ? color.green : sig > 0 ? color.lime : sig < -1 ? color.maroon : sig < 0 ? color.red : color.black
barcolor(bar ? moColor : na)
hline(0)
plot(mo, title="MO", linewidth=2, color=moColor)
plot(moSig, title="Signal", linewidth=1, color=color.white)
This file is under the MIT License; it is a port of the original by cheatcountry, 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.