1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
26 lines of Pine Script v6 from scripts/simple-trend-painter.pine.txt, published under MPL-2.0. Keep the author's credit and licence lines when you reuse it.
simple-trend-painter.pine.txt
//@version=6
indicator("Simple Trend Painter", overlay = true)
// 1. A setting you can change
length = input.int(20, "Average length", minval = 1)
// 2. The average closing price of the last candles
average = ta.sma(close, length)
// 3. A yes/no question: is price above the average?
isAbove = close > average
// 4. Paint every candle: green if yes, red if no
barcolor(isAbove ? color.green : color.red)
// 5. Draw the average as a blue line
plot(average, "Average", color.blue, 2)
// 6. Find unusually busy candles (volume spike)
avgVolume = ta.sma(volume, 20)
bigVolume = volume > avgVolume * 2
plotshape(bigVolume, "Big volume", shape.circle, location.abovebar, color.orange)
// 7. Alert when price crosses the average
crossed = ta.cross(close, average)
alertcondition(crossed, "Price crossed average", "{{ticker}} crossed its average")
Overview
Candles are painted green when closing above the moving average and red when closing below it. The script plots the SMA line on the price chart and places orange dots above bars where trading volume exceeds twice its 20-period average. It also provides alert triggers when price crosses the moving average. Moving average length is configurable.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Average length
int
20
length
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.
This indicator calculates Kaufman's Adaptive Moving Average (KAMA) on a chosen price source and determines trend direction based on the slope across a configurable lookback window. Signals can be filtered by short-term volatility expansion using ATR comparison
This indicator generates trend-following trade signals on the price chart by combining moving average crossovers with multi-factor filters. It triggers entry alerts when fast and slow EMAs cross in the direction of a baseline trend EMA, confirmed by non-extrem
This overlay indicator plots a SuperTrend using a 10-period ATR with a multiplier of 3, drawing up and down stop lines and a faint trend fill on the price chart. It compares a 9-period EMA with an 18-period EMA and a 12/26/9 MACD against its signal, and it req
Bte Acc is a chart indicator form of the PineCoders Backtesting and Trading Engine. It seeks an entry trigger from a main or alternate entry method, then checks trade direction, filters, date range, ATR readiness, and remaining capital before filling on the ne
This indicator plots a volume-weighted moving average as a central trend baseline and surrounds it with ATR-based volatility bands. It colors the trend and optional price bars according to whether price is on the bullish or bearish side of those bands. Users c
ACCVOL 1j (SMA5 + SMA10) - AD/B is a price chart overlay indicator designed to identify volume accumulation and bullish swing trading setups. It evaluates current bar price gains, volume expansion, and volume relative to a moving average against historical pri