Pine Library · 3,870 open-source scripts

Free Trend Pine Scripts (page 59)

Open-source Pine scripts that show the direction of the trend or trade with it: Supertrend variants, moving-average systems, ADX and trend filters.

Pine scripts3,870
Code shown here2,160open licence
Updated in a year2,525
No repaint flag3,292

Trend: Indicators, Strategies and Libraries

1 stars

A Pine v4 strategy that plots a 21-period exponential moving average of the close in orange on the price chart. It goes long when a green candle opens above the average and short when a red candle opens below it, closing each position when the opposite signal

Strategy v4 Moving averagesTrend
Updated 4 years ago · None stated GitHub repository of OMGBTC EMA Cross Strategy
330 stars

2 EMA/SMA + RSI Strategy [Alorse] combines three configurable moving averages with a short-period Relative Strength Index filter. It plots fast, slow, and trend moving averages on the price chart. Long entries trigger when the fast moving average is above the

Strategy v4 TrendOscillators & momentum
Updated 2 months ago · None stated GitHub repository of 2 EMA/SMA + RSI Strategy [Alorse]
257 stars

Williams Strategy - Alert is a Pine Script v5 strategy that plots three-bar simple moving averages of high and low prices directly on the price chart. It detects upward and downward trend reversals by comparing the current bar's low and high with those from th

Strategy v5 TrendMoving averages
Updated 7 weeks ago · None stated GitHub repository of Williams Strategy - Alert
114 stars

This strategy plots a base Jurik moving average and the average of three longer Jurik averages on the price chart. Long and short signals come from crossovers of those lines, or, when pivoting is enabled, from the averaged line stopping a fall or a rise over a

Strategy v4 TrendMoving averages Repaints
Updated 1 year ago · None stated GitHub repository of 4 JMA Crossover Strategy

Astor SMA20/60 TW

by hasnocool
106 stars

This strategy calculates 20-period and 60-period simple moving averages (SMAs) plotted directly on the price chart. It executes long entries when the closing price crosses above either SMA, provided the bar is on or after the configured backtest start date. Po

Strategy v5 Moving averagesTrend
Updated 2 years ago · GPL-3.0 GitHub repository of Astor SMA20/60 TW
16 stars

This strategy enters long or short when price breaks a Donchian channel and RSI confirms the same direction. It sizes each unit from a risk percent of equity and can add units after a set ATR advance, up to a unit limit. An initial ATR stop and a trailing stop

Strategy v6 TrendOscillators & momentum
Updated 12 months ago · None stated GitHub repository of Seykota Alt 45: Dual Momentum
13 stars

This overlay indicator is a reusable template for Ruckard indicators meant to work with Zignaly. The implemented logic sections are empty, so it does not plot signals or manage trades. It exposes a higher-timeframe trend filter built from a fast and a slow mov

Indicator v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of IndicatorTemplate A002

The Market Tradability Engine calculates multi-factor tradability, balance, compression, and direction scores to evaluate market regime quality. It classifies market conditions into eight distinct states, including Balance, Compression, Ready, Breakout, Trend,

Indicator v6 TrendVolatility & bands
Updated 3 days ago · MIT GitHub repository of Market Tradability Engine [WavesUnchained]

This short-only trading strategy combines the Relative Strength Index (RSI), Slow Stochastic, and MACD to identify bearish setup entries. A short position triggers when the RSI drops below 50, the Slow Stochastic crosses down while overbought, and the MACD lin

Strategy v4 Oscillators & momentumTrend
Updated 3 years ago · Apache-2.0 GitHub repository of RSI + Slow Stochastic + MACD Short Strategy
3 stars

This Pine Script indicator plots Smart Money Concepts market structure directly on the price chart. It identifies swing highs and lows, internal market structures, Break of Structure events, Change of Character shifts, and EQH/EQL levels. Breaker blocs are hig

Indicator v5 SMC / ICT / price actionCandlestick patterns Repaints
Updated 12 months ago · None stated GitHub repository of SMC & Breaker Blocs [Krishna]
2 stars

Calculates and projects Bitcoin price trajectory using a power law model displayed as a clock layout in a separate pane. It maps historical price movements, average power law curves, and Bitcoin halving cycles over time. Users can toggle spiral visualization m

Indicator v6 TrendSupport & resistance
Updated 8 months ago · None stated GitHub repository of Bitcoin Power Law Clock [LuxAlgo]

Least Squares Moving Average (LSMA)

by mushroom-men-Trading
2 stars

This indicator calculates and plots the Least Squares Moving Average (LSMA) directly on the price chart. It fits a linear regression line over a user-selected lookback period and source series to project the prevailing price trend. By using an optimized circul

Indicator v6 TrendMoving averages
Updated 9 months ago · None stated GitHub repository of Least Squares Moving Average (LSMA)

DEPV2 DEBUG S25

by YuceSezar89
1 stars

The script is a multi-symbol crypto indicator that computes trading signals across twenty major pairs including BTCUSDT, ETHUSDT and others. It evaluates four core methods for signals: trend based on price levels, momentum using rate of change, volatility via

Indicator v6 TrendOscillators & momentum Repaints
Updated 13 days ago · None stated GitHub repository of DEPV2 DEBUG S25

Apex Nexus Flip Engine v9

by vedkanani123
1 stars

An overlay indicator that builds a zero-lag trailing line from an ATR multiple and flips between buy and sell labels when price breaks it for a set number of closes. Gates for choppiness, baseline slope, volatility expansion, efficiency and ADX can block weak

Indicator v6 TrendVolatility & bands
Updated 2 months ago · None stated GitHub repository of Apex Nexus Flip Engine v9
1 stars

A Pine v4 strategy that plots a 23-period exponential moving average of the close in orange on the price chart. It goes long when a green candle opens above the average and short when a red candle opens below it, closing each position when the opposite signal

Strategy v4 Moving averagesTrend
Updated 4 years ago · None stated GitHub repository of REPBTC EMA Cross Strategy

AAPP

by capissimo
114 stars

This indicator plots an adaptive moving average or scaled RSI divergence line directly on the price chart. It calculates dual RSI series to measure momentum divergence, scales the values to the chart's price range, and constructs an adaptive average filtered b

Indicator v4 Moving averagesTrend
Updated 1 year ago · None stated GitHub repository of AAPP
37 stars

This indicator detects the bearish Downside Tasuki Gap candlestick pattern on the price chart. It looks for a long red candle, a smaller red candle that gaps below it, and a green candle that closes inside that gap without filling it, while price is in a downt

Indicator v5 Candlestick patternsTrend
Updated 3 years ago · MIT GitHub repository of Downside Tasuki Gap - Bearish
16 stars

This strategy implements a Donchian breakout trend-following system with sector-adaptive profit targets and ATR-based volatility sizing. It enters positions on Donchian channel breakouts, pyramiding additional units at ATR increments up to a configurable maxim

Strategy v6 BreakoutTrend
Updated 12 months ago · None stated GitHub repository of Seykota Alt 46: Sector Adaptive

This indicator evaluates how price relates to one selected moving-average family rather than treating a crossover as a signal. It scores trend quality, historical respect of the average, extension, compression, acceleration, and exhaustion, then plots a relati

Indicator v6 TrendMoving averages
Updated 3 days ago · MIT GitHub repository of Market–Average Relationship Engine [WavesUnchained]
6 stars

Apex Protocol v3.0 - The SMC Engine is an overlay indicator designed for Smart Money Concepts market structure analysis. It identifies and plots Break of Structure (BOS) and Market Structure Shift (MSS) markers, Fair Value Gaps (FVG), Order Blocks (OB), and se

Indicator v5 SMC / ICT / price actionSupport & resistance
Updated 7 months ago · None stated GitHub repository of Apex Protocol v3.0 - The SMC Engine
3 stars

DEBUG Lower TF Supertrend calculates a modified trailing Supertrend line and trend direction based on average true range bands applied around the bar mid-price. The custom function supports multiple moving average types, such as HMA, EMA, SMA, WMA, and VWMA, t

Indicator v5 TrendVolatility & bands
Updated 5 months ago · None stated GitHub repository of DEBUG Lower TF Supertrend
2 stars

This indicator detects market structure breaks using a configurable ZigZag length to identify swing highs and lows. It marks bullish and bearish order blocks along with breaker blocks on the price chart. Breakouts are confirmed via a Fibonacci retracement fact

Indicator v5 SMC / ICT / price actionSupport & resistance
Updated 2 months ago · None stated GitHub repository of Market Structure Break & Order Block

Linear Time Moving Average (LTMA)

by mushroom-men-Trading
2 stars

This indicator calculates a linear time-weighted moving average of a chosen price source and plots it on the price chart. Inside the lookback, each bar receives a weight that rises with recency, equal to the period minus its offset, and the result is the weigh

Indicator v6 TrendMoving averages
Updated 9 months ago · None stated GitHub repository of Linear Time Moving Average (LTMA)

Q-Trend Strategy

by wynnforthework
2 stars

Q-Trend Strategy builds a midpoint from the highest and lowest source values over a trend period and shifts it by an ATR band. It enters long when the source crosses or remains above the upper band and short when it crosses or remains below the lower band. Typ

Strategy v5 TrendVolatility & bands
Updated 1 year ago · None stated GitHub repository of Q-Trend Strategy

DEPV2 DEBUG S26

by YuceSezar89
1 stars

This indicator generates trading signals for multiple cryptocurrency symbols using four methods: trend, momentum, volatility, and volume. It supports three signal modes - single method, simultaneous confirmation requiring a minimum number of agreeing methods,

Indicator v6 TrendOscillators & momentum Repaints
Updated 13 days ago · None stated GitHub repository of DEPV2 DEBUG S26
330 stars

Heikin Ashi Strategy V2 [Alorse] is a trend-following strategy that generates trading signals using multi-timeframe Heikin Ashi moving average crossovers. It calculates a fast and slow exponential moving average from higher-timeframe Heikin Ashi close data and

Strategy v4 TrendMoving averages Repaints
Updated 2 months ago · None stated GitHub repository of Heikin Ashi Strategy V2 [Alorse]

AAPP with Alerts

by capissimo
114 stars

This indicator calculates an adaptive moving average filter and relative strength divergence to identify directional shifts directly on the price chart. It signals long entries when the moving average slope turns upward and short entries when it turns downward

Indicator v4 TrendOscillators & momentum
Updated 1 year ago · None stated GitHub repository of AAPP with Alerts
106 stars

Calculates up to four customizable Supertrend indicators using Average True Range (ATR) and user-selected price sources. It generates long and short trade signals when designated Supertrend instances switch direction, provided other configured Supertrend trend

Strategy v5 TrendVolatility & bands
Updated 2 years ago · GPL-3.0 GitHub repository of ATR GOD Strategy by TradeSmart
16 stars

This strategy implements a trend-following Donchian channel breakout system with momentum-based position sizing. It enters an initial scaled position on a channel breakout to minimize false breakout risk, then adds to the position if RSI confirms directional s

Strategy v6 TrendOscillators & momentum
Updated 12 months ago · None stated GitHub repository of Seykota Alt 47: Momentum Sized

Lastguru KNN A002

by ruckard
13 stars

This strategy applies k-nearest neighbors machine learning to fast and slow moving average crossovers to filter entry signals. It overlays directly on the price chart and incorporates built-in Zignaly alert triggers for automated execution. Traders can configu

Strategy v5 AI / machine learningMoving averages
Updated 1 year ago · None stated GitHub repository of Lastguru KNN A002

This strategy evaluates the dynamic relationship between price and a chosen moving average across six diagnostic dimensions: trend, respect, extension, compression, acceleration, and exhaustion. It plots a normalized relationship oscillator bounded between -10

Strategy v6 TrendMoving averages
Updated 3 days ago · MIT GitHub repository of Market–Average Relationship Engine [WavesUnchained]
4 stars

This strategy executes trades based on Stochastic Oscillator crossovers combined with a trend filter and ATR-based risk management. It calculates smoothed %K and %D lines alongside an Exponential Moving Average (EMA). A long signal triggers when %K crosses abo

Strategy v6 Oscillators & momentumTrend
Updated 2 months ago · MIT GitHub repository of Stoch Strategy [trugurpala]

Q-Trend Strategy

by wynnforthework
2 stars

The Q-Trend Strategy is a trend-following overlay strategy that identifies directional bias using dynamic price channels combined with an ATR volatility buffer. It calculates highest highs and lowest lows over a chosen trend period to establish a baseline midp

Strategy v5 TrendVolatility & bands
Updated 1 year ago · None stated GitHub repository of Q-Trend Strategy
1 stars

This long-only strategy identifies trend-following entries using moving average crossovers filtered by higher-timeframe trend alignment. It plots directly on the main price chart. Entries trigger when a fast exponential moving average crosses above a slow movi

Strategy v6 TrendMoving averages
Updated 7 days ago · Apache-2.0 GitHub repository of MTF probe 10 - HTF bracket static

DEPV2 DEBUG S27

by YuceSezar89
1 stars

DEPV2 DEBUG S27 is a multi-asset signal evaluation indicator designed to monitor up to twenty cryptocurrency pairs simultaneously. It classifies market behavior into four analytical dimensions: trend, momentum, volatility, and volume. The script supports multi

Indicator v6 TrendOscillators & momentum Repaints
Updated 13 days ago · None stated GitHub repository of DEPV2 DEBUG S27

ATSYS Keep It Simple

by vedkanani123
1 stars

A price-chart indicator with Portuguese labels that combines Bollinger Bands, a fast 13 and slow 34 exponential average, and coloured clouds. Bands default to an exponential basis and can use simple, smoothed or weighted types. The average cloud changes colour

Indicator v6 TrendVolatility & bands
Updated 2 months ago · None stated GitHub repository of ATSYS Keep It Simple

Moving Median

by everget
947 stars

Moving Median calculates the 50th percentile value of a specified price source over a user-defined lookback period using the nearest rank method. It plots directly on the main price chart as a single line. When trend highlighting is enabled, the plot changes c

Indicator v4 Moving averagesTrend
Updated 12 days ago · GPL-3.0 GitHub repository of Moving Median
330 stars

This momentum strategy combines the Moving Average Convergence Divergence and Directional Movement Index indicators to generate long trading signals. It enters a long position when the MACD line crosses above its signal line while positive directional movement

Strategy v4 Oscillators & momentumTrend
Updated 2 months ago · None stated GitHub repository of MACD + DMI [Alorse]
47 stars

This indicator plots a Hull Moving Average on the price chart. It computes weighted moving averages of the selected source over half the period and the full period, subtracts the full average from twice the half average, then smooths that difference with a wei

Indicator v6 TrendMoving averages
Updated 8 months ago · MIT GitHub repository of Hull Moving Average (HMA)
16 stars

This strategy trades an asymmetric long and short trend system on the price chart. Longs use shorter Donchian entry and exit lengths, tighter ATR stops, more pyramid units, and a higher risk percent per unit than shorts. Each unit is sized from equity and stop

Strategy v6 TrendVolatility & bands
Updated 12 months ago · None stated GitHub repository of Seykota Alt 4: Asymmetric L/S
13 stars

This strategy uses the Noro Trend Ribbon to determine trend direction and open long or short positions. It defines a corridor from recent high and low prices and enters positions when price crosses the corridor boundaries, sized as a percentage of capital. Fas

Strategy v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of R010 R Noro Trend Ribbon

Markov State Engine classifies market conditions into six distinct regimes, including strong trends, weak trends, compression, and expansion. It evaluates historical state transitions using an exit-conditional Markov model with Laplace smoothing to estimate re

Indicator v6 AI / machine learningTrend
Updated 3 days ago · MIT GitHub repository of Markov State Engine [WavesUnchained]

More Pine Script Categories

Browse the whole Pine Library

Third-party code. ForexR lists open-source Pine scripts from GitHub; it did not write, test or endorse them, and their summaries are generated automatically from each script's code and README. Indicators describe the past, and a strategy's backtest can look better than live trading. Check a script on a demo account before you rely on it. CFDs and leveraged forex are complex instruments with a high risk of losing money rapidly.

Learn to Use Pine Scripts

Free, plain-English guides: add a script to TradingView, read what it does, test it and avoid the common traps.

  1. 1Using this librarySearch, filters, licences and what the badges mean.
  2. 2Add a script to TradingViewCopy, paste into the Pine Editor, save and add to chart.
  3. 3Indicators, strategies and librariesWhat each type does and how to tell them apart.
  4. 4Spot a script that repaintsWhy some signals change after the bar closes.
  5. 5Backtest a strategyStrategy Tester settings that keep results honest.
  6. 6Send alerts to MT4 or MT5From a TradingView alert to an order in MetaTrader.
  7. 7What Pine Script isThe language, what it can and cannot do, and where to start.
  8. 8Write your first indicatorA complete script, line by line, in the Pine Editor.
  9. 9Read a script before you trust itA routine for checking inputs, logic and red flags.
  10. 10Edit a script safelyChange colours and lengths, add a filter or an alert.
  11. 11Pine Script alertsalertcondition(), alert(), placeholders and webhooks.
  12. 12Build a crossover strategyAn EMA cross strategy with an ATR stop, ready to test.

Trade Your Charts With a Regulated Broker

Compare regulated brokers on platforms, spreads, minimum deposit and leverage.

Compare brokers