Vertical Horizontal Moving Average [AneoPsy & alexgrover]
"Vertical Horizontal Moving Average [AneoPsy & alexgrover] " by alexgrover, MPL-2.0. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: Vertical Horizontal Moving Average [AneoPsy & alexgrover] (v1.0), read 2026-11-15T18:35:29.771Z; 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.
Vertical Horizontal Moving Average [AneoPsy & alexgrover] by alexgrover, ported from Pine v4. Overlay indicator with 1 plot, alerts 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/
// (Notice added by FloSignals: the author's source carries none. It was published open-source on 2020-06-24; since 2019-07-26 the platform it was published on has released such a script under MPL-2.0 automatically.)
// This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License https://creativecommons.org/licenses/by-sa/4.0/
// © Aneopsy & alexgrover
// ------------------------------------------------------------------------------------------------
// Original author: alexgrover
// Original title: Vertical Horizontal Moving Average [AneoPsy & alexgrover]
// 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("Vertical Horizontal Moving Average [AneoPsy & alexgrover]", "VHMA", true)
length = input.int(defval=50, title="Length")
src = input.source(defval=close, title="Source")
alert = input.string("VHMA Direction Change", "Alert Conditions", options=["VHMA Direction Change", "SRC/VHMA Crossover"])
//------------------------------------------------------------------------------
vhma = 0.
R = ta.highest(src, length) - ta.lowest(src, length)
vhf = R / math.sum(math.abs(ta.change(src)), length)
vhma := nz(vhma[1] + math.pow(vhf, 2) * (src - vhma[1]), src)
//------------------------------------------------------------------------------
lineColor = vhma > vhma[1] ? color.lime : color.red
plot(vhma, title="VHMA", color=color.new(lineColor, 0), linewidth=2)
//------------------------------------------------------------------------------
//Alerts
//------------------------------------------------------------------------------
string a = "VHMA Direction Change"
string b = "SRC/VHMA Crossover"
buy = alert == a ? ta.crossover(ta.change(vhma), 0) : ta.crossover(src, vhma)
sell = alert == a ? ta.crossunder(ta.change(vhma), 0) : ta.crossunder(src, vhma)
alertcondition(buy, "Buy Alert", "VHMA Buy Alert")
alertcondition(sell, "Sell Alert", "VHMA Sell Alert")
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.