Pine Library · 3,870 open-source scripts

Free Trend Pine Scripts (page 31)

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 v5 strategy that draws trendlines through confirmed swing highs and lows on the price chart. Swing pivots are confirmed after a set number of bars to the right, and a minimum slope angle removes flat lines. A trade mode setting chooses between breakout

Strategy v5 Support & resistanceBreakout
Updated 8 months ago · None stated GitHub repository of ATTraderAlgo Auto Trendline Trader

Fib Harvester

by anil-sn
1 stars

A chart-overlay indicator that builds a volatility-based trend line from a smoothed price range and marks entries when the trend flips, plus reload entries after pullbacks. Each entry gets a stop sized from the distance to the trend line or an ATR multiple, an

Indicator v6 TrendVolatility & bands
Updated 9 months ago · None stated GitHub repository of Fib Harvester

The Aetherium Institutional Market Resonance Engine is an overlay indicator that combines coherence analysis, institutional liquidity scanning, and cycle resonance to identify market setups. It measures directional market alignment, calculates volume spike clu

Indicator v6 SMC / ICT / price actionSupport & resistance Repaints

MA Crossover Strategy

by surajmateti
1 stars

This long-only strategy calculates fast and slow moving averages to generate trend-following trade signals. It enters a long position when the fast moving average crosses above the slow moving average, and closes the trade when a bearish crossover occurs. Movi

Strategy v5 Moving averagesTrend
Updated 11 months ago · None stated GitHub repository of MA Crossover Strategy

Supertrend

by yagyesh-bobde
1 stars

Calculates the standard Supertrend indicator using built-in Pine Script functions based on Average True Range (ATR) and a multiplier factor. It plots a green support line during an uptrend and a red resistance line during a downtrend directly on the price char

Indicator v6 TrendVolatility & bands
Updated 1 year ago · None stated GitHub repository of Supertrend

Parabolic SAR

by Studentcodee
1 stars

The Parabolic SAR strategy calculates the Parabolic SAR value to detect trend reversals on the price chart. It starts with a given acceleration factor and adjusts it dynamically between start and maximum values based on price movements. Long entries occur when

Strategy v6 TrendVolatility & bands
Updated 1 year ago · None stated GitHub repository of Parabolic SAR
1 stars

A strategy that trades with a short and a long EMA. A long entry needs price above the short EMA, which is above the long EMA, plus RSI below a level or price within a tolerance of a pivot low. Shorts mirror this in a downtrend near pivot highs. Each entry get

Strategy v6 TrendSupport & resistance
Updated 1 year ago · None stated GitHub repository of Profit Factor Optimized Strategy

TOTAL MTPI

by Mikelkulla
1 stars

This strategy calculates the TOTAL MTPI using a combination of multiple indicators including Trend Sniper, EMA, MAMA, Kijun Sen, Supertrend and others to determine the overall direction of the cryptocurrency market cap index. It signals long entries when the c

Strategy v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of TOTAL MTPI

This strategy uses two simple moving averages, 10 and 20 periods by default. It enters long when the fast average crosses above the slow one and enters short on the opposite cross. Each trade is paired with an ATR-based stop loss and take profit, using separat

Strategy v5 Moving averagesTrend
Updated 1 year ago · None stated GitHub repository of Moving Average Crossover Strategy

MA Cross Strategy

by mkdir700
1 stars

A simple long-only strategy for the price chart built on two simple moving averages. It buys when the fast average crosses above the slow one and closes the position when the fast crosses back below. A stop loss and a take profit, entered as numeric inputs, ar

Strategy v5 Moving averagesTrend
Updated 1 year ago · None stated GitHub repository of MA Cross Strategy
1 stars

This indicator detects a selectable set of candlestick patterns and plots them on the price chart. Fast and slow simple moving averages provide a trend context for pattern interpretation. Users can turn individual formations on or off, including doji variants,

Indicator v5 Candlestick patternsMoving averages
Updated 1 year ago · None stated GitHub repository of Candlestick Patterns

Fractal Dimension

by techteam92
1 stars

This indicator calculates John Ehlers' fractal dimension of recent price movement and plots it in a separate pane. It compares the average high-low range over two successive halves of a lookback window with the range over the full window, then converts that ra

Indicator v4 Trend
Updated 1 year ago · None stated GitHub repository of Fractal Dimension

algo-trade-indian-commodity

by akash-yellgetti
1 stars

A strategy-type script for the price chart that draws the high, low and midpoint of the first part of each session, set by start hour and minute inputs, with alerts when price crosses the high or low. It adds VWAP and a SuperTrend with adjustable ATR period, m

Strategy v5 Sessions & timeTrend
Updated 2 years ago · None stated GitHub repository of algo-trade-indian-commodity
1 stars

This strategy plots the Supertrend indicator directly on the price chart using an Average True Range period and factor multiplier. It generates long entry orders when the Supertrend turns upward and short entry orders when it turns downward, simultaneously dis

Strategy v5 TrendVolatility & bands
Updated 2 years ago · MPL-2.0 GitHub repository of Hello World, Supertrend
1 stars

A price-chart overlay that projects a high, mid and low estimate for the next three bars. It averages the open-to-close midpoints, the open-to-close changes and the high-low ranges over a configurable lookback, then chains each estimate into the next. It impor

Indicator v5 Oscillators & momentumTrend

ATR Trailing Stop

by JohnsonHsiao
1 stars

This indicator plots an ATR trailing stop on the price chart. It multiplies the average true range by a user multiplier and ratchets the stop with price while the close stays on the same side of the line. When price crosses the stop, the line flips to the oppo

Indicator v5 Volatility & bandsTrend
Updated 3 years ago · None stated GitHub repository of ATR Trailing Stop
1 stars

This Pine v5 strategy compares a 20-period EMA with a 50-period SMA. It enters long when the EMA is above the SMA and short when below, and also contains a second set of pullback entries and crossover-based closes. The code mixes two overlapping rule sets, so

Strategy v5 TrendMoving averages Archived
Updated 4 years ago · None stated GitHub repository of Moving Average Strategy
947 stars

Nick Rypock Trailing Reverse plots a percentage trailing stop on the price chart and reverses its direction when the close crosses that level. In an uptrend it trails below the highest close by the correction coefficient; in a downtrend it trails above the low

Indicator v6 Trend
Updated 12 days ago · GPL-3.0 GitHub repository of Nick Rypock Trailing Reverse
318 stars

This indicator plots four customizable moving averages directly on the main price chart using default lengths of 3, 8, 21, and 50 periods. It fills the space between adjacent averages in green or maroon depending on trend alignment. Additionally, it computes B

Indicator v5 Moving averagesTrend
Updated 2 months ago · MIT GitHub repository of Multiple Moving Averages
257 stars

This strategy calculates dynamic support and resistance levels using pivot highs and lows alongside a custom smoothed trend filter and a 3-period EMA. It identifies entry opportunities when price breaks out relative to the trend filter and short-term EMA cross

Strategy v5 TrendSupport & resistance Repaints
Updated 7 weeks ago · None stated GitHub repository of 30s - ES 1m Strategy Candle Bar

Ichimoku Cloud

by harryguiacorn
220 stars

This indicator plots Ichimoku Cloud elements on the price chart, including Tenkan-sen, Kijun-sen, Senkou Span A and B lines with optional Chikou Span. It signals trend changes via Tenkan-sen and Kijun-sen crosses and places arrows at Kijun-sen direction shifts

Indicator v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of Ichimoku Cloud
219 stars

This educational indicator calculates 20-period and 60-period Simple Moving Averages (SMA) directly on the price chart. It detects bullish golden crosses and bearish death crosses between the two averages, marking occurrences with chart labels below or above b

Indicator v4 Moving averagesTrend
Updated 5 years ago · None stated GitHub repository of Teaching Example - alertcondition

This indicator trains a single-neuron artificial neural network (perceptron) on each bar to classify price movement and plot an adaptive moving average on the main chart. It evaluates historical sample data to iteratively adjust weights using a step activation

Indicator v5 AI / machine learningMoving averages
Updated 1 year ago · None stated GitHub repository of Machine Learning: Perceptron-Based Strategy

3Commas Bot

by hasnocool
106 stars

This strategy overlays moving averages on the price chart to generate long and short trade signals compatible with 3Commas bot automation. It sets stop losses relative to recent swing pivots buffered by an ATR multiplier, while exits are handled by a risk-to-r

Strategy v5 Moving averagesTrend
Updated 2 years ago · GPL-3.0 GitHub repository of 3Commas Bot

Adaptive Price Zone

by mihakralj
99 stars

The Adaptive Price Zone indicator calculates volatility bands around a double-smoothed exponential moving average baseline directly on the price chart. It calculates internal smoothing factors using the square root of the user-specified period, double-smoothin

Indicator v6 Volatility & bandsTrend
Updated 4 weeks ago · Apache-2.0 GitHub repository of Adaptive Price Zone

Moon Dev SMA Ribbon 20/40

by moondevonyt
92 stars

Moon Dev SMA Ribbon 20/40 calculates two simple moving averages (default 20 and 40 periods) and overlays them directly on the price chart. The space between the moving averages is filled with a dynamic gradient that adapts in color and transparency based on tr

Indicator v6 TrendMoving averages
Updated 2 months ago · Custom licence GitHub repository of Moon Dev SMA Ribbon 20/40

SMA RSI Strategy

by PythonForForex
64 stars

This strategy evaluates simple moving averages and the Relative Strength Index to generate trading signals. It calculates a 10-period SMA, a 30-period SMA, and a 14-period RSI. Long positions are entered when the fast SMA crosses above the slow SMA while RSI i

Strategy v5 TrendOscillators & momentum
Updated 4 years ago · None stated GitHub repository of SMA RSI Strategy

EMA Ribbon MACD

by iamrichardD
57 stars

This strategy combines an EMA ribbon with MACD confirmation and plots in a separate pane. It enters when ribbon alignment, optional MACD zero or signal crosses, volume, smart-money, and multi-timeframe filters agree, then exits with percentage stop loss and ta

Strategy v6 TrendMoving averages
Updated 1 year ago · Apache-2.0 GitHub repository of EMA Ribbon MACD

Ichimoku & SuperTrend

by dcaoyuan
55 stars

This indicator draws a classic Ichimoku cloud on the price chart. It plots the Tenkan-sen and Kijun-sen as Donchian midpoints and fills the cloud between the two leading spans, displaced 26 bars ahead, green when Lead 1 is above Lead 2 and red otherwise. Conve

Indicator v6 Trend
Updated 6 months ago · Apache-2.0 GitHub repository of Ichimoku & SuperTrend
53 stars

This strategy trades EUR/USD on the price chart using a fast and slow exponential moving average crossover filtered by RSI. It enters long when the fast EMA crosses above the slow EMA while RSI is above 50 and below the overbought level, and enters short on th

Strategy v6 TrendMoving averages
Updated 2 months ago · MPL-2.0 GitHub repository of EUR/USD EMA9-21 + RSI Scalping Strategy

VWAP (Cumulative)

by milocaetano
48 stars

The VWAP Cumulative indicator calculates and plots a continuous Volume Weighted Average Price directly on the main price chart. Instead of resetting at session or daily boundaries, it computes a running cumulative VWAP using typical price and volume across all

Indicator v5 TrendMoving averages
Updated 3 days ago · MIT GitHub repository of VWAP (Cumulative)
47 stars

This indicator plots the Arnaud Legoux Moving Average on the price chart. It weights recent source bars with a Gaussian window whose peak is shifted by the offset and whose width is set by sigma. The period input sets the lookback, and the source input selects

Indicator v6 TrendMoving averages
Updated 8 months ago · MIT GitHub repository of Arnaud Legoux Moving Average (ALMA)
43 stars

This indicator plots the percentage difference between a fast exponential moving average and a slow one, scaled by the close, in a separate pane. It treats that gap as a standardized measure of trend strength and draws a zero line. Users set both EMA lengths a

Indicator v5 Moving averagesOscillators & momentum
Updated 1 year ago · None stated GitHub repository of Standardized MA Difference

All Candlestick Patterns

by TWODS-CAPITAL
37 stars

This indicator detects and labels multiple classic candlestick formations directly on the price chart. It calculates candle body and shadow dimensions relative to exponential moving averages and confirms prevailing trends with simple moving averages. When matc

Indicator v5 Candlestick patternsTrend
Updated 3 years ago · MIT GitHub repository of All Candlestick Patterns
24 stars

This indicator plots market structure elements directly on the price chart, identifying internal and swing break of structure and change of character. It calculates bullish and bearish order blocks, equal highs and lows, and swing points while highlighting tre

Indicator v5 SMC / ICT / price actionSupport & resistance Repaints
Updated 12 days ago · Custom licence GitHub repository of Smart Money Concepts [LuxAlgo] test D
20 stars

This indicator plots John Ehlers's predictive moving average on the price chart. It builds a weighted average of the selected source, applies a second weighted average, and projects a prediction with a slower trigger. It draws the higher of those two series an

Indicator v5 Moving averagesTrend
Updated 1 year ago · None stated GitHub repository of John F. Ehlers - Predictive Moving Average
16 stars

This strategy implements a trend-following Donchian breakout system with pullback-based pyramiding. It initiates trades on Donchian channel breakouts and sizes positions based on ATR volatility risk. Instead of immediately adding units when the trend advances

Strategy v6 TrendBreakout
Updated 12 months ago · None stated GitHub repository of Seykota Alt 14: Pullback Pyramid

Pocket Scout - SPY/QQQ

by chris-c-thomas
14 stars

Pocket Scout - SPY/QQQ is a mobile-optimized intraday bias indicator designed for major US equity ETFs and indices. It overlays a 9/21/50 EMA ribbon, session VWAP, prior day high/low/close levels, and intraday high/low lines directly on the main price chart. T

Indicator v6 TrendOscillators & momentum Repaints
Updated 6 months ago · MIT GitHub repository of Pocket Scout - SPY/QQQ

Crossing EMAs C

by ruckard
13 stars

Crossing EMAs C is an overlay strategy designed to demonstrate moving average crossover signals integrated with Zignaly alert triggers. Despite its name, the script calculates 14-period and 28-period simple moving averages. It enters a long position when the f

Strategy v5 Moving averagesTrend
Updated 1 year ago · None stated GitHub repository of Crossing EMAs C

Nexural Pressure Pro

by JasonTeixeira
9 stars

Nexural Pressure Pro is a composite pressure indicator that measures directional market momentum using volume-weighted directional movement, order flow delta, aggression, and efficiency ratio metrics. It filters out low-activity bars using configurable volume

Indicator v6 Oscillators & momentumVolume
Updated 2 weeks ago · Custom licence GitHub repository of Nexural Pressure Pro

EMA Ribbon (9/21/55) - Eterna

by EternaHybridExchange
9 stars

EMA Ribbon (9/21/55) is a TradingView strategy that calculates three exponential moving averages with periods 9, 21 and 55. It plots the EMAs on the price chart and colors the background ribbon according to bullish or bearish alignment. The strategy enters lon

Strategy v5 TrendMoving averages
Updated 7 months ago · MIT GitHub repository of EMA Ribbon (9/21/55) - Eterna

Durbin Watson Test

by Anderson-ALGO
9 stars

This indicator calculates the Durbin-Watson test statistic to measure serial autocorrelation in log returns over a user-defined lookback period. It performs a linear regression of log returns against bar indices to extract residuals and computes the ratio of s

Indicator v4 Trend
Updated 5 years ago · None stated GitHub repository of Durbin Watson Test
8 stars

This strategy identifies trend retracements and breakout entries using an adjustable moving average ribbon alongside higher-timeframe anchored moving averages, fractal pivots, and support and resistance level extensions. Bar colors can be customized using a 3-

Strategy v5 TrendMoving averages
Updated 4 years ago · None stated GitHub repository of Pullback Trading Tool ALT

LunarTick ADX

by lunarticktrading
7 stars

LunarTick ADX calculates the Average Directional Index (ADX) along with positive (+DI) and negative (-DI) directional indicators in a separate pane. It identifies trend direction by tracking crossovers between +DI and -DI, plotting crossover markers directly o

Indicator v6 TrendOscillators & momentum
Updated 2 weeks ago · None stated GitHub repository of LunarTick ADX
7 stars

This indicator calculates a lag-compensated SuperSmoother based on John Ehlers' filter techniques, combining hybrid Butterworth filters with dynamic lag adjustment. It computes adaptive trend metrics and lag-compensated momentum, plotting them in a separate pa

Indicator v6 TrendOscillators & momentum
Updated 3 months ago · None stated GitHub repository of Ehlers Adaptive Trend Filter

This strategy overlays a 90-period simple moving average from the one-hour and four-hour charts with a daily session VWAP on the price chart. It buys when VWAP is at or above the four-hour average and crosses above the one-hour average, and sells short in the

Strategy v5 TrendMoving averages Repaints
Updated 3 years ago · MIT GitHub repository of 4h Bullish Buy 1h Bearish Sell Session

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