Percentage Price Over SMA
"Percentage Price Over SMA" by alexgrover, MPL-2.0. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: Percentage Price Over SMA (v1.0), read 2026-10-12T15:55:32.400Z; 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.
Percentage Price Over SMA by alexgrover, ported from Pine v4. Pane indicator with 2 plots, 1 fill, 2 levels and 4 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: Percentage Price Over SMA
// 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("Percentage Price Over SMA", "%PMA's")
min = input.int(14, "Minimum MA Length Value", minval=1)
max = input.int(28, "Maximum MA Length Value", minval=1)
smooth = input(14)
src = input(close)
//------------------------------------------------------------------------------
csum = ta.cum(src)
p = 0
for i = min to max
ma = (csum - csum[i]) / i
p := src > ma ? p + 1 : p
per = p / (max - min + 1) * 100
//------------------------------------------------------------------------------
plot(per, "%Price Over SMA", #2157f3)
plot(ta.ema(per, smooth), "Smoothed Result", #e65100)
a = hline(80)
b = hline(20)
fill(a, b, #2157f3)
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.