Pine Library · 3,040 open-source scripts

Free TradingView Strategy Scripts (page 19)

Open-source Pine Script strategies: scripts that place simulated trades, so TradingView's Strategy Tester can report how the rules did on past data.

Pine scripts3,040
Code shown here1,833open licence
Updated in a year1,781
No repaint flag2,645

Strategies: All

1 stars

A long and short strategy using a long simple moving average with bands set a chosen number of standard deviations above and below it, 350 bars by default. It goes long when price closes above the upper band and exits when price falls back under the average; i

Strategy v5 BreakoutVolatility & bands
Updated 2 years ago · None stated GitHub repository of Bollinger Breakout Strategy

algo-trade-indian

by akash-yellgetti
1 stars

A strategy-type script for the price chart that marks the high, low and midpoint of the first part of each session, set by start hour and minute inputs, and alerts when price crosses above the high or below the low. It also plots VWAP and a 50-period EMA, pivo

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

This strategy implements custom trailing stop logic driven by momentum signals. It calculates first- and second-order price momentum, entering long or short via stop orders above or below the current bar when momentum is consistently positive or negative. A cu

Strategy v5 Oscillators & momentum
Updated 2 years ago · None stated GitHub repository of Trailing Stop Snippet
1 stars

The Hammers & Stars Strategy identifies hammer and star candlestick patterns on the price chart to generate buy and sell signals. It calculates stop loss as ATR multiplied by a user-defined multiplier and sets take profit using the risk-reward ratio. Fib level

Strategy v4 Candlestick patterns
Updated 2 years ago · None stated GitHub repository of Hammers & Stars Strategy YouTube
1 stars

This long-only strategy plots Bollinger Bands, 20 bars and 2.5 deviations by default, along with a 10 and a 50 period EMA and a background that shades the EMA trend. When flat, it buys after the close crosses back above the lower band, and it closes the positi

Strategy v5 Mean reversionVolatility & bands
Updated 2 years ago · MPL-2.0 GitHub repository of Bolinger Bands Strategy

RSI + Trailing Stoploss

by kritarth2121
1 stars

This strategy uses a 14-period RSI with fixed thresholds. It goes long when RSI crosses above 60 and short when it crosses below 40. Each side has a percentage trailing stop, two percent by default, that follows the close and only moves in the trade's favour;

Strategy v5 Oscillators & momentum
Updated 2 years ago · None stated GitHub repository of RSI + Trailing Stoploss

A long-only strategy that buys when the 14-bar RSI is below 30 inside a chosen date range. It closes all positions when price reaches a percentage profit target or falls to a percentage stop loss, checked on closes. The order size doubles after each close, a p

Strategy v5 Oscillators & momentumMean reversion Repaints
1 stars

A long-only strategy designed for the 4-hour chart. It averages open, high, low and close, smooths that with a mid-term SMA and builds a relative strength line from the gap between price and the SMA. When the slope of that line turns positive it places a limit

Strategy v5 TrendOscillators & momentum
Updated 3 years ago · GPL-3.0 GitHub repository of Relative Strength Strategy (4h)

Hotch Break Strat

by rajatjpatel
1 stars

A strategy that combines several filters on one chart. Components include an ignition bar marker based on a candle body retracement percentage, fractal detection, three configurable moving averages, an RSI with overbought and oversold levels, a trading range l

Strategy v5 BreakoutOscillators & momentum Repaints
Updated 4 years ago · None stated GitHub repository of Hotch Break Strat
1 stars

A Pine v4 strategy that plots a 30-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 ADABTC EMA Cross Strategy

Generic Strategy

by rocketbrainsurgeon
1 stars

This strategy is a bare template that crosses a fast 15-period and a slow 45-period exponential moving average of the bar midpoint. It enters long on an upward cross and short on a downward cross, reversing between the two, and starts trading from a date set b

Strategy v4 Moving averagesTrend
Updated 5 years ago · GPL-3.0 GitHub repository of Generic Strategy
330 stars

This strategy enters long when a bullish candle closes above an EMA and its upper wick is no larger than a set percent of the candle range, and short on the opposite bearish setup. It closes a long after price rises a small fixed fraction above the entry bar o

Strategy v5 Candlestick patternsMoving averages
Updated 2 months ago · None stated GitHub repository of Full Candle [Alorse]

This strategy draws on the price chart and combines Stochastic RSI, the Money Flow Index, and an exponential moving average to open long or short trades. Longs use the lower oscillator thresholds and shorts use the upper ones, with direction limited to longs,

Strategy v5 Oscillators & momentumMoving averages Repaints
Updated 2 years ago · GPL-3.0 GitHub repository of 3 Indicator Strategy (StochRSI, MFI & EMA) With Safety Orders
105 stars

This strategy plots a fast and a slow simple moving average on the price chart. It enters a long position when the fast average crosses above the slow average and closes that long when the fast average crosses below the slow average. Percentage take profit and

Strategy v5 TrendMoving averages Repaints
Updated 1 year ago · None stated GitHub repository of Simple Moving Average Crossover

This strategy plots the previous daily high and low on the price chart and calculates the Andean oscillator bull and bear components with an exponential moving average signal. It looks for a bull or bear cross of that signal, then confirms the setup against re

Strategy v5 Oscillators & momentumSupport & resistance Repaints
Updated 3 years ago · MIT GitHub repository of Daily High/Low and Andean Oscillator Strategy

Bar States Example S

by be-thomas
65 stars

This Pine Script strategy demonstrates the usage of bar state variables by highlighting the chart background color. It evaluates whether the current candle is the final bar on the chart using the barstate.islast condition and applies a silver background color

Strategy v5
Updated 6 days ago · GPL-3.0 GitHub repository of Bar States Example S

Pair Trade: Inputs

by PythonForForex
64 stars

This strategy executes trades on the current chart based on daily percentage price changes of an external ticker (GOOG). It fetches the daily open and close prices of the reference symbol to compute its intraday price change ratio. When the reference asset dro

Strategy v5 Mean reversion
Updated 4 years ago · None stated GitHub repository of Pair Trade: Inputs

BTC Scalp v1 Tests

by iamrichardD
57 stars

This script serves as a unit testing suite implemented in Pine Script to validate components of a 5-minute Bitcoin scalping strategy. It establishes a custom test runner framework using user-defined types to record and evaluate mock modules. Tested modules inc

Strategy v6 Scalping
Updated 1 year ago · Apache-2.0 GitHub repository of BTC Scalp v1 Tests

Donchian Pullback Strategy

by Ahmed-GoCode
53 stars

This strategy identifies trend direction from Donchian Channel breakouts and executes trades on pullbacks toward the channel midpoint. A new breakout beyond the previous channel bands sets a bullish or bearish trend state. When price retraces to or across the

Strategy v6 TrendBreakout
Updated 2 months ago · MPL-2.0 GitHub repository of Donchian Pullback Strategy

This strategy overlays the price chart to execute long and short trades on BTCUSDT. It requests multi-timeframe data across daily, 3-minute, 5-minute, 8-minute, and 10-minute periods to generate signals alongside VWMA volatility bands and smoothed moving avera

Strategy v5 Volatility & bandsMoving averages Repaints
Updated 2 years ago · None stated GitHub repository of BTCUSDT 10M - No Repaint v1.1 2023

OTT + EMA20 分批出場策略

by skywalker0803r
42 stars

This strategy draws on the price chart and trades both directions. It enters long when a variable moving average crosses above the Optimized Trend Tracker while price is above a fast EMA, and short on the opposite cross below a slower EMA. Entries are blocked

Strategy v5 TrendMoving averages
Updated 2 months ago · None stated GitHub repository of OTT + EMA20 分批出場策略

SMAOffsetProtectOptV1

by viktors1982
36 stars

SMAOffsetProtectOptV1 is a long-only price-chart strategy that buys when close falls below an offset SMA or EMA and either the Elliott Wave Oscillator is above its high threshold with RSI below a limit, or the oscillator is below its low threshold. It exits wh

Strategy v4 Moving averagesOscillators & momentum Repaints
Updated 2 years ago · None stated GitHub repository of SMAOffsetProtectOptV1

Greeffer BB Strategy

by SammyEnigma
18 stars

This strategy builds Bollinger bands from a simple moving average and the standard deviation of the close. It opens a short when price crosses above the upper band and the 14-period RSI is above 80, and opens a long when price crosses below the lower band and

Strategy v4 Volatility & bandsOscillators & momentum
Updated 6 years ago · None stated GitHub repository of Greeffer BB Strategy

This trend-following strategy plots Donchian channels and trade signals directly on the price chart. It enters long or short positions upon Donchian channel breakouts and scales in with accelerated pyramiding every fraction of the Average True Range. Position

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

Crossing EMAs A

by ruckard
13 stars

Crossing EMAs A is an automated strategy that overlays directly on the price chart. Despite its title referencing exponential moving averages, the script calculates fourteen-period and twenty-eight-period simple moving averages. It enters a long position when

Strategy v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of Crossing EMAs A

NFI v7.2

by koradiyakaushal
12 stars

NFI v7.2 is a Pine Script adaptation of the popular NostalgiaForInfinity algorithmic trading strategy originally built for Freqtrade. It analyzes price action and exponential moving average metrics across both base and higher informative timeframes, incorporat

Strategy v4 TrendMoving averages Repaints
Updated 5 years ago · MIT GitHub repository of NFI v7.2
11 stars

The Stochastic Divergence Strategy calculates the Stochastic oscillator (%K and %D) to identify regular bullish and bearish divergence patterns against price pivots. It plots the oscillator and divergence lines in a separate indicator pane. Entries trigger on

Strategy v6 Oscillators & momentumDivergence
Updated 5 months ago · Apache-2.0 GitHub repository of Stochastic Divergence Strategy

Dual Moving Average

by hirawatt
11 stars

Dual Moving Average is a Pine Script v4 strategy that overlays the price chart. The shown code declares a strategy with fixed quantity, cash commission, slippage, and calculation on every tick. Inputs set the price source, a start and end date, a symbol that d

Strategy v4 Oscillators & momentumScreeners & dashboards Repaints
Updated 2 years ago · MIT GitHub repository of Dual Moving Average

Chandelier Exit - Eterna

by EternaHybridExchange
9 stars

This strategy calculates volatility-based Chandelier Exit bands using the Average True Range and high/low extremes, paired with an optional exponential moving average trend filter. It enters long when the close crosses above the long Chandelier line while abov

Strategy v5 TrendVolatility & bands
Updated 7 months ago · MIT GitHub repository of Chandelier Exit - Eterna

This strategy calculates a Supertrend line based on Average True Range parameters to identify market trends. It combines Supertrend trend reversals with an initial percentage-based stop loss and a dynamic trailing stop loss. Trades are taken according to the s

Strategy v4 TrendVolatility & bands Repaints
Updated 7 years ago · MIT GitHub repository of Supertrend ATR with Trailing Stop Loss
8 stars

This overlay strategy combines three distinct SuperTrend levels with multiple moving averages and volume profile analytics on the main price chart. It calculates trend directions using three configurable ATR periods and multipliers alongside SMA, EMA, and HMA

Strategy v5 TrendVolatility & bands
Updated 4 years ago · None stated GitHub repository of ATR 3Lvls VP Strategy

FVG Strategy

by muammeryldrm42
7 stars

Calculates three-bar Fair Value Gaps (FVG) and filters them using Average True Range. When price mitigates the FVG midpoint, the strategy enters a position in the direction of the gap, provided an optional EMA trend filter is satisfied. Exits are defined by an

Strategy v5 SMC / ICT / price actionSupport & resistance
Updated 3 months ago · MIT GitHub repository of FVG Strategy
7 stars

This strategy plots a daily VWAP, a 90-period simple moving average from the one-hour chart, and a 50-period EMA plus a 90-period SMA from the 15-minute chart on the price chart. It enters long when VWAP crosses above the one-hour average, or while VWAP remain

Strategy v5 TrendMoving averages Repaints
Updated 3 years ago · MIT GitHub repository of 1h Bullish Buy 15min Bearish Sell
5 stars

RG Structure is a pivot-constrained break-and-retest strategy that calculates dynamic trendlines, market structure changes, and regime states on the price chart. It identifies support and resistance lines through pivot points and evaluates break-and-retest sig

Strategy v6 TrendSupport & resistance
Updated 8 weeks ago · None stated GitHub repository of RG Structure Visual Edition

Cerebr Centauri Demo

by jerryinyang
5 stars

Cerebr Centauri Demo is a multi-indicator trading strategy overlaying conditions directly on the price chart. It combines lower-timeframe and higher-timeframe inputs across moving averages, Stochastic oscillators, RSI, and MACD to generate trade signals. Trade

Strategy v4 TrendOscillators & momentum
Updated 2 years ago · None stated GitHub repository of Cerebr Centauri Demo

This long-only trend-following strategy plots a 20-period short EMA and a 50-period long EMA directly on the price chart. It triggers long entries when the short EMA is above the long EMA, price breaks above a recent pivot high, and specific price action condi

Strategy v4 TrendMoving averages
Updated 3 years ago · Apache-2.0 GitHub repository of 20 EMA + 50 EMA + Breakout Long Strategy (H)

Ultimate Combo v1

by DexWilder
4 stars

This overlay strategy is written for MES and ES five-minute charts. It calculates a fast and slow EMA, a 200-period trend EMA, session VWAP, RSI, ATR, and a volume moving average, and it can restrict trading to an exchange-time session. Inputs set RSI extremes

Strategy v6 TrendOscillators & momentum
Updated 3 days ago · None stated GitHub repository of Ultimate Combo v1

MACD Signal Cross

by latentwill
4 stars

This strategy evaluates EMA momentum crossovers filtered by an RSI oscillator. It enters a long position when a fast EMA crosses above a slow EMA while RSI remains above 40. Conversely, it enters a short position when the fast EMA crosses below the slow EMA wh

Strategy v5 Moving averagesOscillators & momentum
Updated 8 days ago · None stated GitHub repository of MACD Signal Cross
4 stars

This strategy identifies Bitcoin price trends using fast and slow EMA crossovers filtered by RSI and a 200 EMA. It plots the EMAs and entry signals on the price chart. Bullish crossovers open long positions with ATR-based stop loss and take profit. Bearish cro

Strategy v6 TrendOscillators & momentum
Updated 2 months ago · MIT GitHub repository of Bitcoin BTC Strategy [trugurpala]

Prop Firm ICT Sniper | Survival Mode

by thesenegalesehitch
4 stars

This strategy overlays the price chart and sizes cash positions from account equity using a selectable Phase 1 or Phase 2 risk percent. It tracks net profit by calendar day and blocks new risk once the phase daily-loss limit is reached. Swing sensitivity sets

Strategy v6 SMC / ICT / price actionSupport & resistance
Updated 4 months ago · Custom licence GitHub repository of Prop Firm ICT Sniper | Survival Mode
4 stars

This long-only strategy plots an asymmetric ATR channel around a rolling moving average on the price chart. It enters long when a confirmed close breaks above the upper band and exits when a confirmed close breaks below the lower band. An optional setting exit

Strategy v6 TrendMoving averages
Updated 5 months ago · None stated GitHub repository of RMA ATR Bands (Long Only)

SMC Order Block + FVG

by LePotoRico2105
4 stars

SMC Order Block + FVG is an intraday strategy combining market structure breaks, order blocks, and fair value gaps. It identifies breaks of structure using pivot points, isolates order blocks following strong ATR-based impulses, and tracks fair value gaps. Lon

Strategy v5 SMC / ICT / price actionSupport & resistance
Updated 7 months ago · MIT GitHub repository of SMC Order Block + FVG
4 stars

This strategy demonstrates fixed-fraction position sizing based on a set percentage of account equity at risk. It calculates trade quantity dynamically using an Average True Range (ATR) stop distance. Long entries trigger when price crosses above a 50-period s

Strategy v5 Moving averagesVolatility & bands
Updated 11 months ago · Custom licence GitHub repository of Fixed-Fraction Sizing Example

Improvisando [Alorse]

by Hugs-4-Bugs
4 stars

Improvisando [Alorse] is a price-chart strategy that plots three exponential moving averages and a TTM Squeeze-style oscillator. It opens a long when price is above all three averages and the oscillator is rising while still below zero. Shorts use the opposite

Strategy v5 TrendOscillators & momentum
Updated 1 year ago · None stated GitHub repository of Improvisando [Alorse]

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