Moving Averages Linear Combinator
"Moving Averages Linear Combinator" by alexgrover, MPL-2.0. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: Moving Averages Linear Combinator (v1.0), read 2026-11-15T18:36:52.043Z; 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.
Moving Averages Linear Combinator by alexgrover, ported from Pine v4. Overlay indicator with 3 plots and 8 inputs.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// (Notice added by FloSignals: the author's source carries none. It was published open-source on 2020-03-15; since 2019-07-26 the platform it was published on has released such a script under MPL-2.0 automatically.)
// ------------------------------------------------------------------------------------------------
// Original author: alexgrover
// Original title: Moving Averages Linear Combinator
// Licence: MPL-2.0 (the notice above was added by FloSignals; the original carries none)
// Pine version: 4
// Fetched: 2026-11-15
// 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("Moving Averages Linear Combinator", '', true)
len2 = input(100, "length")
a = input.string("SMA", "Leading", options=["SMA", "EMA", "WMA", "HMA", "VWMA", "TMA", "LSMA"])
b = input.string("SMA", "Lagging", options=["SMA", "EMA", "WMA", "HMA", "VWMA", "TMA", "LSMA", "External Input"])
coeff = input(2.)
lpd = input(1., "Leading Period Divisor")
esrc = input(close, "External Input")
src = input.string("close", options=["close", "open", "high", "low", "hl2", "hlc3", "ohlc4"])
Plot = input(false, "Plot Leading & Lagging MA's")
//----
f(w, x, y, z) => w == x ? y : z
len1 = math.round(len2 / lpd)
//----
x = f(src, "close", close, f(src, "open", open, f(src, "high", high, f(src, "low", low, f(src, "hl2", hl2, f(src, "hlc3", hlc3, ohlc4))))))
//----
ma1 = f(a, "SMA", ta.sma(x, len1), f(a, "EMA", ta.ema(x, len1), f(a, "WMA", ta.wma(x, len1), f(a, "HMA", ta.hma(x, len1), f(a, "VWMA", ta.vwma(x, len1), f(a, "LSMA", ta.linreg(x, len1, 0), ta.sma(ta.sma(x, len1), len1)))))))
//----
ma2 = f(b, "SMA", ta.sma(x, len2), f(b, "EMA", ta.ema(x, len2), f(b, "WMA", ta.wma(x, len2), f(b, "HMA", ta.hma(x, len2), f(b, "VWMA", ta.vwma(x, len2), f(b, "LSMA", ta.linreg(x, len2, 0), f(b, "TMA", ta.sma(ta.sma(x, len2), len2), esrc)))))))
//----
comb = coeff * ma1 - (coeff - 1) * ma2
A = Plot ? ma1 : na
B = Plot ? ma2 : na
//----
plot(comb, "Combination", #0cb51a, 2)
plot(A, "Leading", #2157f3, 2)
plot(B, "Lagging", #ff1100, 2)
//----
//“I have no interest in last words."
//----
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.
- v1
Library refresh 2026-11-15
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.