Uhl MA Crossover System
"Uhl MA Crossover System" by alexgrover, MPL-2.0. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: Uhl MA Crossover System (v1.0), read 2026-10-12T15:58:11.426Z; source language v4.
Licence: Mozilla Public License 2.0 (MPL-2.0) — full text. The source is published with it, modifications included, under the same licence.
Uhl MA Crossover System by alexgrover, ported from Pine v4. Overlay indicator with 2 plots, 1 fill and 3 inputs.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © alexgrover
// ------------------------------------------------------------------------------------------------
// Original author: alexgrover
// Original title: Uhl MA Crossover System
// Licence: MPL-2.0 (the header above is the original notice, kept verbatim)
// Pine version: 4
// 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 v4 source.
indicator("Uhl MA Crossover System", "UHLMA", true)
length = input(100)
mult = input(1.)
src = input(close)
//----
out = 0.
cma = 0.
cts = 0.
Var = ta.variance(src, length) * mult
sma = ta.sma(src, length)
//----
secma = math.pow(nz(sma - cma[1]), 2)
sects = math.pow(nz(src - cts[1]), 2)
ka = Var < secma ? 1 - Var / secma : 0
kb = Var < sects ? 1 - Var / sects : 0
//----
cma := ka * sma + (1 - ka) * nz(cma[1], src)
cts := kb * src + (1 - kb) * nz(cts[1], src)
//----
css = cts > cma ? #2157f3 : #ff1100
a = plot(cts, "CTS", color.new(#2157f3, 0), 2)
b = plot(cma, "CMA", color.new(#ff1100, 0), 2)
fill(a, b, color=color.new(css, 80))
This file is under the Mozilla Public License 2.0; it is a port of the original by alexgrover, 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.