Pine Library · 3,040 open-source scripts

Free TradingView Strategy Scripts (page 51)

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

S_risk

by GammaExpansion
1 stars

S_risk is a test strategy designed to demonstrate and verify Pine Script strategy risk management functions. It applies built-in risk rules to restrict order direction to long-only (converting short orders into position closures), caps maximum position sizes,

Strategy v6
Updated 7 days ago · MIT GitHub repository of S_risk
1 stars

The script detects pivot highs and lows on the price chart using user-defined left and right bars. It projects future price paths with the golden ratio and calculates intersection points between paths. These intersections are stored in an array for geometric b

Strategy v5 Support & resistanceTrend
Updated 7 weeks ago · None stated GitHub repository of Geometric Path Backtest with BG
1 stars

This price-chart strategy enters long when a fast EMA crosses above a slow EMA and short when it crosses below, provided optional filters pass. Volume must exceed a multiple of its average, price must sit on the matching side of a higher-timeframe EMA, and the

Strategy v6 TrendMoving averages
Updated 2 months ago · None stated GitHub repository of Tn Sovereign Fakeout v6

Bollinger Breakout

by hasnocool
106 stars

This strategy buys when price breaks above the upper Bollinger Band and exits by trailing a stop on the lower band. Trades can execute on a wick or a candle close, and an optional fixed-percentage stop can set a tighter initial exit until the lower band catche

Strategy v5 BreakoutVolatility & bands
Updated 2 years ago · GPL-3.0 GitHub repository of Bollinger Breakout
13 stars

Ruckard Squeezed B004 is a trading strategy based on Squeeze Momentum indicator transitions. It tracks section height changes across momentum color cycles using high and low closing moving averages. Entries fire when momentum values breach key threshold levels

Strategy v5 Oscillators & momentumMoving averages
Updated 1 year ago · None stated GitHub repository of Ruckard Squeezed B004
3 stars

HTF Condition Strategy is a multi-timeframe trading strategy that evaluates market structure conditions on both a higher timeframe and the current chart timeframe. Users can configure entry rules combining conditions such as bullish bias, higher lows, or lower

Strategy v5 TrendScreeners & dashboards
Updated 5 months ago · None stated GitHub repository of HTF Condition Strategy
1 stars

A test strategy from a reference corpus that checks independent exit brackets. It goes long two units when a 9-period EMA crosses above a 21-period EMA and RSI is below 60. Two exit orders each handle one unit, one with a stop and target one ATR from the avera

Strategy v6 Volatility & bandsMoving averages
Updated 7 days ago · Apache-2.0 GitHub repository of PF OCA Probe 02 Multi-Bracket Isolation

S_risk_allow_entry_in

by GammaExpansion
1 stars

This Pine Script v6 strategy fixture tests a long-only entry restriction. It splits bars into cycles of 16, enters long at phase 0, tries short entries at phases 4 and 8, closes every position at phase 12, and cancels pending orders at phase 15. An opposing sh

Strategy v6
Updated 7 days ago · MIT GitHub repository of S_risk_allow_entry_in
1 stars

A Fibonacci pullback strategy on the price chart. It finds the highest high and lowest low over a lookback, then draws long and short retracement levels at a chosen ratio from 0.236 to 0.786. A trade is only considered at one specific hour, in the direction of

Strategy v6 Support & resistanceTrend
Updated 2 months ago · None stated GitHub repository of TN Sovereign Fibonacci
106 stars

This strategy calculates standard Bollinger Bands and plots the basis, upper band, and lower band directly on the price chart. It places breakout stop orders, entering long when price crosses above the upper band and short when price falls below the lower band

Strategy v5 Volatility & bandsBreakout
Updated 2 years ago · GPL-3.0 GitHub repository of Bollinger Stop Strategy
13 stars

Ruckard Squeezed C005 is a strategy that identifies divergence patterns based on section height changes in the Squeeze Momentum indicator. It evaluates transitions between histogram color phases to detect momentum peaks for long and short entries. Trades are m

Strategy v5 Oscillators & momentumMoving averages
Updated 1 year ago · None stated GitHub repository of Ruckard Squeezed C005

PF poc exit-while-flat false

by pineforge-4pass
1 stars

PF poc exit-while-flat false is an overlay strategy designed to test Pine Script execution engine parity. It calculates 9-period and 21-period Exponential Moving Averages (EMA). When a bullish crossover occurs while flat, it places a limit buy order 2% below t

Strategy v6 Moving averagesTrend
Updated 7 days ago · Apache-2.0 GitHub repository of PF poc exit-while-flat false

S_risk_max_position_size

by GammaExpansion
1 stars

This strategy tests TradingView’s maximum position size risk limit in a separate pane. Every 20 bars it tries a long entry of 40 units, a second long entry, and a long order of 10, then closes all trades, repeats the same idea on the short side, and cancels re

Strategy v6
Updated 7 days ago · MIT GitHub repository of S_risk_max_position_size
1 stars

This strategy pairs the Fisher Transform oscillator with a long-term exponential moving average trend filter to execute trend-aligned reversal entries. It enters long when the Fisher line crosses above its trigger line while price remains above the EMA, and en

Strategy v6 Oscillators & momentumTrend
Updated 2 months ago · None stated GitHub repository of Tn Sovereign Fisher v6

This strategy combines three technical indicators: the Boom Hunter Pro oscillator, the Hull Suite moving average, and a Volatility Oscillator. It calculates trade entries from indicator conditions, using recent swing high and low lookbacks to set stop loss lev

Strategy v5 TrendOscillators & momentum
Updated 2 years ago · GPL-3.0 GitHub repository of Boom Hunter + Hull Suite + Volatility Oscillator Strategy

exit Demo

by be-thomas
65 stars

This strategy demonstrates TradingView exit and entry calls on the price chart. It opens a first long position of five units when flat, then adds a second long of ten units with a stop order ten percent above the average price once size reaches five. When size

Strategy v4
Updated 6 days ago · GPL-3.0 GitHub repository of exit Demo
13 stars

This strategy monitors section height changes within the Squeeze Momentum Indicator to identify momentum shifts and divergence entry signals. It uses high and low closing moving averages to evaluate price trends and overlay a visual ribbon on the price chart.

Strategy v5 Oscillators & momentumVolatility & bands
Updated 1 year ago · None stated GitHub repository of Ruckard Squeezed D004

PF poc exit-while-flat true

by pineforge-4pass
1 stars

This strategy is a validation probe designed to test order execution behavior when issuing bracket exit orders while flat alongside a pending limit entry. It calculates 9-period and 21-period exponential moving averages on price data. On a bullish EMA crossove

Strategy v6 Moving averagesTrend
Updated 7 days ago · Apache-2.0 GitHub repository of PF poc exit-while-flat true

Trend Breakout

by GammaExpansion
1 stars

Trend Breakout is a price-chart strategy that builds a simple moving average and upper and lower bands from a multiple of standard deviation. It enters long when close crosses above the upper band and short when close crosses below the lower band. Position siz

Strategy v6 TrendBreakout
Updated 7 days ago · MIT GitHub repository of Trend Breakout
1 stars

Tn Sovereign FlowZone v6 is a strategy script that plots signals on the price chart using EMA crossovers combined with confluence scoring. The script calculates confluenceScore from trend EMA, volume SMA comparison, and RSI momentum to confirm EMA20/50 crossov

Strategy v6 TrendOscillators & momentum
Updated 2 months ago · None stated GitHub repository of Tn Sovereign FlowZone v6
114 stars

This strategy calculates normalized price or on-balance volume differentials across a user-defined timeframe and passes them through an activation function such as Swish, Step, or LeakyReLU. It opens long positions when the activated vector crosses above a pos

Strategy v4 Oscillators & momentumAI / machine learning Repaints
Updated 1 year ago · None stated GitHub repository of Scaled Normalized Vector Strategy

This long-only strategy enters when a 14-period simple moving average crosses above a 28-period average and closes that long when the faster average crosses back below. While a position is open, it sets a stop a configurable percent below the entry, then moves

Strategy v5 TrendMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of Break even stop loss (% of instrument price)

exit Demo

by be-thomas
65 stars

This strategy demonstrates staged long entries and a bracket exit on the price chart. It opens a first long of five units when the position is flat and the year is after 2014. When size reaches five, it adds a second long of ten units with a stop price ten per

Strategy v4
Updated 6 days ago · GPL-3.0 GitHub repository of exit Demo
13 stars

Ruckard Squeezed E004 is a price-chart strategy that compares successive Squeeze Momentum colour-section changes. A smaller squeeze value with a higher price opens a short; a higher squeeze value with a lower price opens a long. Direction can be limited to lon

Strategy v5 Oscillators & momentumVolatility & bands
Updated 1 year ago · None stated GitHub repository of Ruckard Squeezed E004
1 stars

The strategy applies the Parabolic SAR indicator to detect trend reversal flips. It monitors when the SAR crosses from above to below the close (bullish flip) to enter long positions or from below to above (bearish flip) to enter short positions. Opposite posi

Strategy v6 TrendMoving averages
Updated 7 days ago · Apache-2.0 GitHub repository of PF probe 101 - parabolic sar flip
1 stars

The TN Sovereign Footprint POC v6 strategy calculates a simulated Point of Control by identifying the highest volume node in a lookback period using the average of high, low, and close prices. It plots on the price chart as an overlay and signals buy or sell e

Strategy v6 VolumeBreakout
Updated 2 months ago · None stated GitHub repository of TN Sovereign Footprint POC v6

Breakeven Line Demo

by hasnocool
106 stars

The Breakeven Line Demo strategy is a Pine Script demonstration tool designed to visualize the average position price of stacked trades. It enters long positions after seven consecutive bearish candles and short positions after seven consecutive bullish candle

Strategy v5 Mean reversionSupport & resistance
Updated 2 years ago · GPL-3.0 GitHub repository of Breakeven Line Demo

Exit Once Demo

by be-thomas
65 stars

This strategy demonstrates a partial bracket exit. It enters a long position of four units when the current position size is zero or negative. It then places an exit for two of those units, with a ten-point profit target and a ten-point stop. There are no user

Strategy v4
Updated 6 days ago · GPL-3.0 GitHub repository of Exit Once Demo

MovingAvg Cross

by TWODS-CAPITAL
37 stars

This strategy calculates a simple moving average of closing prices to detect trend shifts directly on the price chart. It enters a long position when the price remains above the moving average for a specified number of consecutive confirmation bars, and enters

Strategy v5 TrendMoving averages
Updated 3 years ago · MIT GitHub repository of MovingAvg Cross
13 stars

Calculates divergence between price movement and the Squeeze Momentum Indicator transitions to identify entry conditions. A short position is opened when the squeeze value decreases while price makes a higher high during bullish momentum decay. A long position

Strategy v5 Oscillators & momentumDivergence
Updated 1 year ago · None stated GitHub repository of Ruckard Squeezed F001

PF Probe 104 - Supertrend Flip

by pineforge-4pass
1 stars

This strategy calculates the Supertrend indicator using a configurable ATR length and factor to identify trend reversals. It plots directly on the main price chart. When the Supertrend direction flips from bearish to bullish, the strategy closes any open short

Strategy v6 TrendVolatility & bands
Updated 7 days ago · Apache-2.0 GitHub repository of PF Probe 104 - Supertrend Flip

GOLDEN-PIVOT φ v2

by morindok
1 stars

GOLDEN-PIVOT φ v2 is a Pine Script strategy that plots on the price chart. It calculates a golden pivot region using Fibonacci retracement at 0.618 of a swing high-low range spanning 96 candles. The script applies a volume filter requiring current volume to ex

Strategy v5 Support & resistanceSMC / ICT / price action
Updated 7 weeks ago · None stated GitHub repository of GOLDEN-PIVOT φ v2
1 stars

A long-only strategy built on fair value gaps. A bullish gap is detected when a bar's low is above the high two bars back. Depending on the confirmation setting, it enters on the gap alone, on the gap plus a high-volume breakout candle used as a simple order b

Strategy v6 SMC / ICT / price actionSupport & resistance
Updated 2 months ago · None stated GitHub repository of TN Sovereign FVG and OB
106 stars

Breakout Trend Follower is a price-chart strategy that enters long when price breaks a recent swing high. It places the stop at the recent swing low and trails that stop upward as higher lows form, exiting when a higher low is breached. A pivot lookback sets h

Strategy v5 BreakoutTrend Repaints
Updated 2 years ago · GPL-3.0 GitHub repository of Breakout Trend Follower

MovingAvg2Line Cross

by TWODS-CAPITAL
37 stars

This strategy calculates two Simple Moving Averages (SMA) with fast and slow length inputs. It generates a long signal when the fast SMA crosses above the slow SMA, and a short signal when it crosses below. Reversal signals automatically close existing trades

Strategy v5 TrendMoving averages
Updated 3 years ago · MIT GitHub repository of MovingAvg2Line Cross

Ruckard Swim Waves

by ruckard
13 stars

Ruckard Swim Waves is a Pine Script v5 strategy that trades long, short, or both on the price chart. It opens positions according to the selected side and exits with a percentage stop loss, take profit, and optional trailing take profit. After two consecutive

Strategy v5 Scalping
Updated 1 year ago · None stated GitHub repository of Ruckard Swim Waves
1 stars

This strategy draws Bollinger-style bands on the price chart using ta.sma and ta.stdev of close. It plots upper and lower bands based on the baseline SMA and a multiplier applied to standard deviation. Entries trigger when close breaks above the upper band for

Strategy v6 Volatility & bandsMoving averages
Updated 7 days ago · Apache-2.0 GitHub repository of PF probe 105 - volty expansion close

TN Sovereign HMA

by raybird
1 stars

A strategy based on 21 and 55 period Hull moving averages. A long needs the fast line rising and above the slow line, price above a 200 EMA and volume above its 20-bar average times a multiplier; a short needs the opposite. Each entry has an ATR-based stop at

Strategy v6 Moving averagesTrend
Updated 2 months ago · None stated GitHub repository of TN Sovereign HMA

Brrrrr Strategy

by hasnocool
106 stars

The Brrrrr Strategy is a macro-based breakout strategy designed for crypto markets. It tracks the Glassnode total USDT supply daily metric and calculates a Donchian Channel over a user-defined lookback period. The strategy enters a long position when the USDT

Strategy v5 TrendBreakout
Updated 2 years ago · GPL-3.0 GitHub repository of Brrrrr Strategy

This trend-following scalping strategy combines a moving average trend filter with the Absolute Strength Histogram indicator. It opens long positions when price is above a selectable baseline moving average and the histogram signals bullish momentum, and short

Strategy v5 TrendOscillators & momentum
Updated 1 year ago · None stated GitHub repository of Ruckard TradingZone Absolute Strength Histogram ATR
1 stars

This strategy plots four exponential moving averages on the price chart and compares their order. It treats a fully rising stack, shortest above the next three lengths, as bullish and the reverse order as bearish. It opens one long contract on the first bar th

Strategy v6 TrendMoving averages
Updated 7 days ago · Apache-2.0 GitHub repository of PF probe 4ema-rsi-probe-01-quad-ema-stack

Probe B Orders Strings

by GammaExpansion
1 stars

Probe B Orders Strings is a diagnostic testing strategy designed to verify order execution rules, string formatting, and price rounding behavior for stop and limit orders. Operating on a repeating 24-bar cycle, it enters alternating long and short market posit

Strategy v5
Updated 7 days ago · MIT GitHub repository of Probe B Orders Strings
1 stars

This strategy implements a modified Ichimoku Cloud system with causal HTF trend filtering on the price chart. It computes Tenkan-sen, Kijun-sen, Senkou A and B lines using user-set lengths for displacement. Long signals trigger on cloud breakout above with Ten

Strategy v6 TrendMoving averages
Updated 2 months ago · None stated GitHub repository of TN Sovereign Ichimoku Causal

BTC Hashrate ribbons

by hasnocool
106 stars

This strategy tracks Bitcoin network hashrate data from external sources like Quandl, Glassnode, or IntoTheBlock using short and long moving averages. It generates buy or sell signals when the short hashrate moving average crosses above or below the long movin

Strategy v5 Moving averagesTrend
Updated 2 years ago · GPL-3.0 GitHub repository of BTC Hashrate ribbons
13 stars

This strategy plots on the price chart and enters from a moving-average filter, ADX and Gann colours. Price above a 200-period EMA allows only longs; price below allows only shorts. A Gann aqua colour with ADX above a key level opens a long, and a Gann brown c

Strategy v5 TrendOscillators & momentum
Updated 1 year ago · None stated GitHub repository of Ruckard TradingZone ADX Gann
1 stars

PF Probe 4EMA-RSI Probe 02 RSI Pullback is a stateful momentum strategy that triggers trades based on Relative Strength Index dip-and-recovery patterns. It arms a persistent long variable when RSI drops below a pullback threshold and opens a long trade when RS

Strategy v6 Oscillators & momentumMean reversion
Updated 7 days ago · Apache-2.0 GitHub repository of PF Probe 4EMA-RSI-Probe-02-RSI-Pullback

S Commission Slippage

by GammaExpansion
1 stars

This strategy serves as a test fixture for commission and slippage calculations across market, stop, and limit orders, utilizing percentage-based commission settings. It periodically opens long and short positions based on bar index cycles, applying predefined

Strategy v5
Updated 7 days ago · MIT GitHub repository of S Commission Slippage
1 stars

This strategy draws on the price chart and trades ICT-style market structure. It uses swing pivots to set a bullish or bearish bias, then requires a fair value gap larger than a fraction of ATR and a simplified engulfing order block. Long and short entries fir

Strategy v6 SMC / ICT / price actionSessions & time
Updated 2 months ago · None stated GitHub repository of TN Sovereign ICT SMC v6

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