Indicator · Pine Script v5 · Own pane

Price Action Candles

by g-moe· code credited to goodgains

This indicator plots a 20 period simple moving average of the closing price on the chart.

View on GitHub

GitHub stars3on the repository
Pine versionv5runs as is
Lines of code11
Settings1inputs
LicenceNone statedfile: MPL-2.0
Last update5 months ago27 May 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

11 lines of Pine Script v5 from Tradingview/price-action-candles-v12.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

price-action-candles-v12.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © goodgains


//@version=5
indicator("Price Action Candles")

// @keywords: simple-moving-average, sma-plot, show-last-bars, price-action, candles-indicator, limited-display, close-sma, test-input, overlay-none, basic-plot, minimal-indicator, moving-average, price-series, bar-limit, action-candles, version-twelve, placeholder, sma-length, trend-line, price-smoothing

test_val = input.int(10)
plot(ta.sma(close,20), show_last = test_val)

Overview

The test_val input sets the number of last bars to show for the plot. It draws in a separate pane using price action principles and a moving average. No buy or sell signals or exit rules are present. The main setting changes the display limit of historical bars. It has no notable trading signals or risk management.

Details

Published by

g-moe on GitHub

Code credit

goodgains, as written in the script's header

Type

Indicator, Pine Script v5

Draws

Separate pane below the chart

Category

Moving averages, Candlestick patterns

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
test_valint10test_val
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.

Similar Pine Scripts

Cerebr Bloop

by jerryinyang
5 stars

Cerebr Bloop is a momentum oscillator calculated by applying Heikin-Ashi candle logic to a zero-centered Relative Strength Index (RSI). Displayed in a separate pane, it visualizes smoothed RSI momentum candles alongside customizable overbought and oversold thr

Indicator v4 Oscillators & momentumCandlestick patterns
Updated 2 years ago · None stated GitHub repository of Cerebr Bloop

Simple EMA Candle

by minaecer
2 stars

This indicator plots colored candles on the price chart using three Exponential Moving Averages. The 30-period EMA serves as the open, the 15-period EMA as the high, and the 10-period EMA as the low, with the original close value. Bar colors change based on co

Indicator v4 Moving averagesCandlestick patterns
Updated 4 years ago · MPL-2.0 GitHub repository of Simple EMA Candle
1 stars

This indicator plots detrended candlesticks in a separate pane relative to a chosen baseline to highlight market cycles around a zero line. Users can switch the baseline mode between a moving average and high/low extremes. In moving average mode, it subtracts

Indicator v5 Moving averagesOscillators & momentum
Updated 7 weeks ago · None stated GitHub repository of Detrended Candles (Switchable)
285 stars

Mean Reversion Study is an indicator that identifies trade setups combining exponential moving averages, RSI extremes, and engulfing candlestick patterns. It highlights bullish setups when a bullish engulfing candle forms below the EMA while RSI is oversold, a

Indicator v4 Mean reversionCandlestick patterns
Updated 3 years ago · None stated GitHub repository of Mean Reversion Study

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers