// SPDX-License-Identifier: MIT
//@version=6
// ──────────────────────────────────────────────────────────────────────────
// Description: TEMPLATE — replace this with what the indicator does.
// Repainting status: Non-repainting (signals gated on barstate.isconfirmed).
// ──────────────────────────────────────────────────────────────────────────
indicator(title = "Indicator Name",
shorttitle = "Short",
overlay = true,
max_lines_count = 500,
max_labels_count = 500,
max_boxes_count = 500,
max_polylines_count = 100)
// ──────────────────────────────────────────────────────────────────────────
// CONSTANTS
// ──────────────────────────────────────────────────────────────────────────
const color BULL_COLOR = #26a69a
const color BEAR_COLOR = #ef5350
const color NEUTRAL = color.new(color.gray, 50)
// ──────────────────────────────────────────────────────────────────────────
// INPUTS
// ──────────────────────────────────────────────────────────────────────────
// Calculation
lengthInput = input.int(14, "Length", minval = 1, maxval = 500,
group = "Calculation",
tooltip = "Lookback bars for the main calculation.")
sourceInput = input.source(close, "Source",
group = "Calculation")
// Signals
confirmedInput = input.bool(true, "Signal only on bar close",
group = "Signals",
tooltip = "When on, signals only fire after the bar closes. Off = live (repainting) signals.")
// Display
showLineInput = input.bool(true, "Show line", group = "Display")
showLabelsInput = input.bool(false, "Show value labels", group = "Display")
bullColorInput = input.color(BULL_COLOR, "Bull color", group = "Display", inline = "col")
bearColorInput = input.color(BEAR_COLOR, "Bear color", group = "Display", inline = "col")
// Debug
debugInput = input.bool(false, "Verbose Pine Logs",
group = "Debug",
tooltip = "Enables log.info() output. Use the Pine Logs pane to inspect.")
// ──────────────────────────────────────────────────────────────────────────
// FUNCTIONS
// ──────────────────────────────────────────────────────────────────────────
//@function Non-repainting higher-timeframe request.
f_secure(simple string sym, simple string tf, series float expr) =>
request.security(sym, tf, expr[1], lookahead = barmerge.lookahead_on)
// ──────────────────────────────────────────────────────────────────────────
// CALCULATIONS
// ──────────────────────────────────────────────────────────────────────────
float maValue = ta.sma(sourceInput, lengthInput)
bool longSig = ta.crossover(sourceInput, maValue) and (not confirmedInput or barstate.isconfirmed)
bool shortSig = ta.crossunder(sourceInput, maValue) and (not confirmedInput or barstate.isconfirmed)
color plotColor = sourceInput > maValue ? bullColorInput : bearColorInput
// ──────────────────────────────────────────────────────────────────────────
// VISUALS
// ──────────────────────────────────────────────────────────────────────────
plot(showLineInput ? maValue : na, "MA", plotColor, linewidth = 2)
plotshape(longSig, "Long", shape.triangleup, location.belowbar, bullColorInput, size = size.tiny)
plotshape(shortSig, "Short", shape.triangledown, location.abovebar, bearColorInput, size = size.tiny)
if showLabelsInput and (longSig or shortSig)
label.new(bar_index, sourceInput,
text = str.format("{0,number,#.##}", maValue),
style = longSig ? label.style_label_up : label.style_label_down,
color = longSig ? bullColorInput : bearColorInput,
textcolor = color.white,
size = size.small)
if debugInput and (longSig or shortSig)
log.info("Signal bar={0,number,#}: long={1}, short={2}, ma={3,number,#.##}",
bar_index, longSig, shortSig, maValue)
// ──────────────────────────────────────────────────────────────────────────
// ALERTS
// ──────────────────────────────────────────────────────────────────────────
alertcondition(longSig, title = "Long signal",
message = "Long signal on {{ticker}} at {{close}}")
alertcondition(shortSig, title = "Short signal",
message = "Short signal on {{ticker}} at {{close}}")
Overview
Indicator Template sets up grouped inputs for length, source, a signal-on-bar-close option, line and label display, bull and bear colours and a debug log toggle. It includes a helper for higher timeframe requests and raised limits for lines, labels and boxes. The description and calculation are placeholders, so a user must add their own logic before it plots anything meaningful.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Length
int
14
lengthInput
Source
source
close
sourceInput
Signal only on bar close
bool
true
confirmedInput
Show line
bool
true
showLineInput
Show value labels
bool
false
showLabelsInput
Bull color
color
BULL_COLOR
bullColorInput
Bear color
color
BEAR_COLOR
bearColorInput
Verbose Pine Logs
bool
false
debugInput
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
The Adaptive Laguerre Filter calculates a smoothed, dynamically adjusted trendline plotted directly on the main price chart. It dynamically adjusts its damping factor (alpha) based on recent price range variations and median percentile calculations over a spec
The indicator plots ICT displacement candles on the price chart and can switch to retracement scanning. Displacement requires a move larger than a set share of the 14-bar average high-low range, lasting at least a chosen number of bars, with optional close, pr
This indicator classifies each bar as bull, bear, or sideways from a rolling log return compared with adjustable percentage thresholds. It paints a regime ribbon on the price chart, shows a current-regime banner, and labels state changes after a minimum hold.
This script plots three moving averages on the price chart: a fast EMA or SMA with 10 periods, a slow EMA or SMA with 20 periods, and a trend EMA or SMA with 100 periods. It signals trend changes by drawing a white cross when the fast moving average crosses ab
This indicator calculates an ATR trailing stop line derived from the highest high minus an average true range multiple over a specified lookback period. It plots the trailing stop line directly on the price chart and colors price bars based on whether the clos
1833 Tracker is an overlay indicator that visualizes historical buy and sell transactions executed by ARK Invest ETFs for the stock on the main price chart. It displays trade dates using green buy and red sell labels positioned relative to price bars, indicati