Z-Histogram
"Z-Histogram" by alexgrover, MPL-2.0. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: Z-Histogram (v1.0), read 2026-10-12T15:57:20.595Z; 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.
Z-Histogram by alexgrover, ported from Pine v4. Pane indicator with drawings 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: Z-Histogram
// 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("Z-Histogram")
length = input.int(14, minval=2)
src = input(close)
window = input(14)
cum = input(true, "Total")
//----
n = bar_index
zs = (src - ta.sma(src, length)) / ta.stdev(src, length)
f(x) => cum ? ta.cum(x) : math.sum(x, window)
//----
l(x, y, css) =>
a = f(zs < y and zs > y - .5 ? 1 : 0)
line li = line.new(n - x, 0, n - x, a, color=css, width=2)
la = label.new(n - x, -1, text=str.tostring(y - .5) + "\n" + "━" + "\n" + str.tostring(a), color=color.white, style=label.style_label_up, textcolor=css)
label.delete(la[1])
line.delete(li[1])
//----
r = #ff1100
b = #2157f3
l(12, -2.5, r)
l(11, -2, r)
l(10, -1.5, r)
l(9, -1, r)
l(8, -0.5, r)
l(7, 0, r)
l(6, .5, b)
l(5, 1, b)
l(4, 1.5, b)
l(3, 2, b)
l(2, 2.5, b)
l(1, 3, b)
l(0, 3.5, b)
//----
legend = label.new(n - 13, -1, text="σ :" + "\n" + "━" + "\n" + "𝒇 :", color=color.white, style=label.style_label_up, textcolor=color.black)
label.delete(legend[1])
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.