Trend Line
"Trend Line" by HPotter, MPL-2.0. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: Trend Line (v1.0), read 2026-10-12T15:47:22.946Z; source language v5.
Licence: Mozilla Public License 2.0 (MPL-2.0) — full text. The source is published with it, modifications included, under the same licence.
Trend Line by HPotter, ported from Pine v5. Overlay indicator with drawings and 1 input.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © HPotter 15/03/2023
////////////////////////////////////////////////////////////
// The indicator draws a trend line indicating the trend at the current moment and show it is resistance or support.
////////////////////////////////////////////////////////////
// ------------------------------------------------------------------------------------------------
// Original author: HPotter
// Original title: Trend Line
// Licence: MPL-2.0 (the header above is the original notice, kept verbatim)
// Pine version: 5
// 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
indicator("Trend Line", shorttitle="TL", overlay=true)
Length = input.int(25, title="Length", tooltip="Overall length of market analysis")
var Green = color.new(color.green, 0)
var Red = color.new(color.red, 0)
var Work = false
var line lineLevel = na
var label labelName = na
if barstate.islastconfirmedhistory or barstate.isrealtime
Work := true
Points = ta.sma(hl2[1], Length)
clr = close[1] > Points ? Green : Red
line.delete(lineLevel)
lineLevel := line.new(bar_index - Length * 2, Points[Length * 2 - 1], bar_index, Points[1], color=clr)
label.delete(labelName)
trendLineIs = close[1] > Points ? "Support" : "Resistance"
_x = time + math.round(ta.change(time) * 10)
labelName := label.new(x=_x, y=Points[1], text=trendLineIs, color=color.new(#000000, 100), textcolor=clr, size=size.small, style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price)
This file is under the Mozilla Public License 2.0; it is a port of the original by HPotter, 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.