Indicator · Pine Script v6 · On the chart

Trend & Momentum Analysis

by dcaoyuan

This indicator overlays on the price chart and provides trend and momentum analysis.

View on GitHub

GitHub stars55on the repository
Pine versionv6current
Lines of code24
Settings0inputs
LicenceApache-2.0
Last update6 months ago20 Apr 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

24 lines of Pine Script v6 from public/indicators/test2.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.

test2.pine
//@version=6
indicator("Trend & Momentum Analysis", overlay=true)

// Calculate EMAs
ema20 = ta.ema(close, 20)
ema50 = ta.ema(close, 50)
ema200 = ta.ema(close, 200)

// Plot EMAs
plot(ema20, color=color.yellow, title="EMA 20", linewidth=2)
plot(ema50, color=color.orange, title="EMA 50", linewidth=2)
plot(ema200, color=color.blue, title="EMA 200", linewidth=2)

// Calculate RSI
rsi = ta.rsi(close, 14)

// Identify Bearish Engulfing pattern for visual aid
isBearishEngulfing = close < open and close[1] > open[1] and close < low[1] and open > high[1]
plotshape(isBearishEngulfing, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, title="Bearish Engulfing")

// Label for RSI
var label rsiLabel = na
label.delete(rsiLabel)
rsiLabel := label.new(bar_index, high + (high - low)*0.5, text="RSI: " + str.tostring(rsi, "#.##"), color=color.new(color.white, 100), textcolor=color.white)

Overview

Trend & Momentum Analysis calculates and plots three exponential moving averages with fixed periods of 20, 50, and 200 using yellow, orange, and blue colors respectively. The script also computes the RSI with a period of 14 and displays its value in a floating label. Additionally, it detects bearish engulfing candlestick patterns and plots red downward triangles above the bar when conditions are met. There are no user-adjustable input settings or configurable periods. The indicator draws all elements directly on the price chart with no separate panes. It offers visual reference for trend following and momentum assessment but includes no entry or exit signals, position sizing rules, stop loss, or take profit mechanisms.

Details

Published by

dcaoyuan on GitHub

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Trend, Oscillators & momentum, 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.

Topics

aicharttradingvibepinescripttechnical-analysispinestock

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

948 stars

The Adaptive RSI Moving Average (ARSIMA) is an overlay indicator that dynamically adjusts its smoothing factor based on the Relative Strength Index (RSI). When the RSI moves toward extreme overbought or oversold conditions, the smoothing factor increases to ma

Indicator v4 Moving averagesOscillators & momentum
Updated 10 days ago · GPL-3.0 GitHub repository of Adaptive RSI Moving Average
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
218 stars

TradersPost Trading Checklist is an overlay indicator that evaluates a suite of popular technical conditions for long and short trade setups. It checks session-anchored VWAP, fast and slow EMA alignments and crosses, 200 SMA, RSI overbought or oversold conditi

Indicator v6 Screeners & dashboardsTrend
Updated 3 months ago · None stated GitHub repository of TradersPost Trading Checklist

Daily Trend Filter

by agutinbaigo28
147 stars

Calculates market regime conditions by combining RSI, MACD, and ADX/DMI indicators. It evaluates whether the market is in a strong bullish, strong bearish, neutral, or non-trending regime. The script plots a colored line overlaying the close price to reflect t

Indicator v5 TrendOscillators & momentum
Updated 6 weeks ago · MIT GitHub repository of Daily Trend Filter

Signal Strategy 15m

by tripolskypetr
72 stars

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

Indicator v5 TrendMoving averages
Updated 3 days ago · MIT GitHub repository of Signal Strategy 15m

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