Pine Library · 3,040 open-source scripts

Free TradingView Strategy Scripts (page 59)

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

106 stars

This strategy calculates fast and slow average true range trailing stops directly on the price chart. It enters long positions when the fast trailing stop crosses above the slow trailing stop, and enters short positions when it crosses below. It paints price b

Strategy v4 TrendVolatility & bands
Updated 2 years ago · GPL-3.0 GitHub repository of ATR Trailing Stop Strategy by ceyhun
3 stars

This strategy detects Opening Range Breakouts in a specified session. It calculates the high and low of the opening range bar then plots these levels on the price chart and fills the area between them. Candles are colored based on their relation to the ORB hig

Strategy v5 BreakoutSupport & resistance
Updated 5 months ago · None stated GitHub repository of ORB Hooplah Strategy
1 stars

This strategy serves as a validation probe to test default order execution timing where orders are processed on the open of the following bar. It implements a simple long-only system using a 9-period and 21-period exponential moving average crossover filtered

Strategy v6 Moving averagesTrend
Updated 6 days ago · Apache-2.0 GitHub repository of PF process-orders 01 - on_close=false
106 stars

This strategy plots an ATR trailing stop on the price chart. It builds the stop from the highest value of high minus a multiple of ATR over a lookback window, and colors bars green, red, or black relative to that line. It enters long when close crosses above t

Strategy v4 TrendVolatility & bands
Updated 2 years ago · GPL-3.0 GitHub repository of ATR Trailing Stoploss Strategy

ORB Twisted M

by g-moe
3 stars

This strategy builds an opening range during a user-defined morning session and trades breakouts of that range during a later trade window. It enters long above the range high and short below the range low, then manages exits with two range-size extensions, a

Strategy v5 BreakoutSessions & time
Updated 5 months ago · None stated GitHub repository of ORB Twisted M
1 stars

This strategy tests deferred position flips under pyramiding. It enters long at market when a 9-period EMA crosses above a 21-period EMA and RSI stays below 70, and it queues short stop entries when RSI crosses under 50, with the stop placed a quarter of ATR b

Strategy v6 Oscillators & momentumMoving averages
Updated 6 days ago · Apache-2.0 GitHub repository of PF Pyramid carry 01 - deferred flip

ATR+EOM+Vortex Strat

by hasnocool
106 stars

This strategy combines ATR, Ease of Movement, and the Vortex indicator on the price chart. It enters long when ATR is above its EMA, Ease of Movement is positive, and the average of the Vortex lines is above one. It closes that long when ATR is below its EMA,

Strategy v4 Volatility & bandsOscillators & momentum
Updated 2 years ago · GPL-3.0 GitHub repository of ATR+EOM+Vortex Strat

ORB_twisted_m

by g-moe
3 stars

This strategy executes opening range breakout trades on the price chart during New York market hours. It tracks the high and low of a customizable opening session and enters long or short positions when price breaks above or below the range. Position sizing de

Strategy v5 BreakoutSessions & time
Updated 5 months ago · None stated GitHub repository of ORB_twisted_m
1 stars

This Pine Script strategy evaluates fast and slow exponential moving average crossovers gated by an RSI boundary to enter long positions. It utilizes fixed cash position sizing and permits up to three pyramided entries, converting cash to fractional contract a

Strategy v6 Moving averagesTrend
Updated 6 days ago · Apache-2.0 GitHub repository of PF Pyramid Carry 02 - Cash Fractional

ATR_Trade_strategy

by hasnocool
106 stars

This strategy plots daily ATR bands, an optional midline, and an exponential moving average directly on the price chart. It executes long trades when price breaks above the upper ATR band and opens short positions when price falls below the lower band, with an

Strategy v4 Volatility & bandsBreakout Repaints
Updated 2 years ago · GPL-3.0 GitHub repository of ATR_Trade_strategy

Parabolic SAR

by g-moe
3 stars

Parabolic SAR is a price-chart strategy that reads Commodity Channel Index and Parabolic SAR values from four user-selected timeframes. It opens a long when every timeframe’s CCI is above the entry level and price is below every SAR, and it closes that long wh

Strategy v5 TrendOscillators & momentum
Updated 5 months ago · None stated GitHub repository of Parabolic SAR
1 stars

PF session-dst probe 01 - NY spring forward is a validation strategy designed to test session time calculation and Daylight Saving Time transition behavior. It evaluates the New York equity session hours from 09:30 to 16:00 in the America/New_York time zone. T

Strategy v6 Sessions & time
Updated 6 days ago · Apache-2.0 GitHub repository of PF session-dst probe 01 - NY spring forward

Atrend by OTS

by hasnocool
106 stars

Atrend by OTS combines MACD histogram crossovers, RSI threshold crosses, and an ATR-based trailing trend indicator on the main price chart. The strategy triggers long entries when the MACD signal delta crosses above zero or when RSI crosses above the oversold

Strategy v4 TrendOscillators & momentum
Updated 2 years ago · GPL-3.0 GitHub repository of Atrend by OTS

Parabolic SAR

by g-moe
3 stars

This strategy overlays a smoothed moving average on price and combines it with Aroon, Chaikin Money Flow and a Chaikin oscillator to define long and short conditions. Relative Vigor Index and Parabolic SAR values are calculated for exits. Entries can be limite

Strategy v5 TrendOscillators & momentum
Updated 5 months ago · None stated GitHub repository of Parabolic SAR
1 stars

This Pine Script strategy calculates the accumulation/distribution line with ta.accdist and its 21-period EMA. It plots these in a separate pane. The strategy issues long entries on ta.crossover of the accumulation/distribution line above its EMA and short ent

Strategy v6 VolumeMoving averages
Updated 6 days ago · Apache-2.0 GitHub repository of PF TA isolate - accdist EMA(21) cross
106 stars

This strategy detects a pivot range using a user-defined length to calculate multiple Fibonacci retracement levels. It enters long market orders when price touches a selected retracement level. Take profit is set as a percentage of entry price, and DCA activat

Strategy v4 Support & resistance
Updated 2 years ago · GPL-3.0 GitHub repository of Automated - Fibs with Market orders

3Commas Bot

by regalouisei
2 stars

This strategy draws two moving averages on the price chart and uses their bias to open long or short trades. It places the stop beyond a swing high or low using an ATR risk multiple, then sets a limit exit from the reward-to-risk ratio. An optional ATR trail c

Strategy v5 TrendMoving averages
Updated 8 months ago · None stated GitHub repository of 3Commas Bot
1 stars

This validation strategy calculates a 9-period Chande Momentum Oscillator (CMO) on the closing price to isolate zero-line crossing behavior. It enters a long position when the CMO crosses above zero and opens a short position when it crosses below zero, revers

Strategy v6 Oscillators & momentum
Updated 6 days ago · Apache-2.0 GitHub repository of PF TA isolate - CMO(9) zero cross

An automated trend-following investment strategy designed for Bitcoin. It compares two customizable trend lines (such as TEMA, LSMA, EMA, or SMA) to detect crossovers and filters entries using an ATR-based trailing stop channel. Positions are exited when the p

Strategy v4 TrendMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of Automated Bitcoin (BTC) Investment Strategy
1 stars

This strategy calculates the Ehlers Center of Gravity oscillator of length 10 on close and an exponential moving average of length 5 of that oscillator. It enters long when the oscillator crosses above the signal and enters short when it crosses below. Positio

Strategy v6 Oscillators & momentum
Updated 6 days ago · Apache-2.0 GitHub repository of PF TA isolate - COG(10) signal cross

Av3

by hasnocool
106 stars

Av3 is a price-chart strategy that compares the current seven-period ATR with the average of the previous five ATR values. When ATR is above that average it buys if the open is above the prior close and sells if the open is below it; when ATR is below the aver

Strategy v4 Volatility & bands Repaints
Updated 2 years ago · GPL-3.0 GitHub repository of Av3

Pivot Trendlines

by g-moe
3 stars

This strategy overlays two SMA lines with a cloud fill to show trend direction. It detects band reversals with Bollinger Bands and uses RSI for mean-reversion signals. Long entries trigger when the trend is bullish, price touches the lower band, and RSI is bel

Strategy v5 TrendOscillators & momentum
Updated 5 months ago · None stated GitHub repository of Pivot Trendlines
1 stars

This strategy calculates a 14-period Money Flow Index using typical price and volume data. It triggers a long entry when the indicator crosses above the oversold threshold of 20 and a short entry when it crosses below the overbought threshold of 80. Displayed

Strategy v6 Oscillators & momentumVolume
Updated 6 days ago · Apache-2.0 GitHub repository of PF TA isolate - MFI(14) bands 20/80

This strategy implements the B-Xtrender indicator, calculating short-term and long-term momentum oscillators using RSI applied to moving average spreads and smoothings. It plots the momentum oscillators as colored histograms in a separate pane. Trades are filt

Strategy v4 Oscillators & momentumTrend
Updated 2 years ago · GPL-3.0 GitHub repository of B-Xtrender [Backtest Edition] @QuantTherapy
1 stars

This strategy plots the Positive Volume Index and Negative Volume Index in a separate pane and compares each with its own exponential moving average of length 255. It opens a long when PVI crosses above its EMA and opens a short when NVI crosses below its EMA.

Strategy v6 VolumeMoving averages
Updated 6 days ago · Apache-2.0 GitHub repository of PF TA isolate - NVI/PVI vs EMA255 cross
106 stars

Backtest Custom HiLo Strategy overlays a high-low trailing line on the price chart calculated from moving averages of highs and lows. It establishes upper and lower bounds using simple or exponential moving averages along with optional period extremes. Signal

Strategy v4 Moving averagesTrend
Updated 2 years ago · GPL-3.0 GitHub repository of Backtest Custom HiLo Strategy
1 stars

This strategy plots the Rank Correlation Index of close over a fixed 14-bar window in a separate pane. It enters long when RCI crosses above zero and short when RCI crosses below zero, reversing with a fixed quantity of one. There is no stop loss, take profit,

Strategy v6 Oscillators & momentum
Updated 6 days ago · Apache-2.0 GitHub repository of PF TA isolate - RCI(14) zero cross
106 stars

This strategy calculates a custom Signal-to-Noise ratio derived from logarithmic aggregation of inverse close prices and compares it against a Simple Moving Average. It plots both lines in a separate pane and alters price bar colors based on signal direction.

Strategy v4 Oscillators & momentumMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of Backtest Signal To Noise

PF TA isolate - WPR(14) bands

by pineforge-4pass
1 stars

This strategy plots the Williams %R oscillator in a separate pane and generates long entries when it crosses above -80 while generating short entries on crossunder below -20. It uses fixed position sizing of one unit per signal with no stop loss and allows pyr

Strategy v6 Oscillators & momentum
Updated 6 days ago · Apache-2.0 GitHub repository of PF TA isolate - WPR(14) bands
106 stars

This strategy simulates a 3Commas dollar-cost averaging (DCA) bot directly on the price chart. It opens long or short deals based on configurable conditions such as immediate execution, RSI-7 thresholds, or TradingView technical presets. As price moves against

Strategy v4 Oscillators & momentumMean reversion
Updated 2 years ago · GPL-3.0 GitHub repository of Backtesting 3commas DCA Bot v2

Pivot Trendlines

by g-moe
3 stars

The Pivot Trendlines strategy identifies swing pivots on the price chart using a configurable swing lookback period and draws trendlines connecting these pivots. It generates buy and sell signals based on three-move patterns with user-defined move sizes, filte

Strategy v5 TrendBreakout
Updated 5 months ago · None stated GitHub repository of Pivot Trendlines
1 stars

This strategy calculates a 14-period RSI of close and places mean-reversion entries at fixed outer bands. It enters long when RSI crosses up through 30 and enters short when RSI crosses down through 70. Position size is a fixed quantity of one, with commission

Strategy v6 Oscillators & momentumMean reversion
Updated 6 days ago · Apache-2.0 GitHub repository of PF TA isolate 02 - RSI(14) bands 30/70

BarUpDn Long Strategy

by hasnocool
106 stars

BarUpDn Long Strategy executes long trades based on price bar directional movements and previous bar closes. It places a long stop order above the current high when a bullish candle opens above a prior close. Because short entries are restricted to exiting lon

Strategy v4 Candlestick patternsBreakout
Updated 2 years ago · GPL-3.0 GitHub repository of BarUpDn Long Strategy
1 stars

This strategy tests the 55-period Hull Moving Average (HMA) calculation. It enters a long position when the closing price crosses above the HMA(55) line and enters a short position when the closing price crosses below it. The script operates directly on the pr

Strategy v6 Moving averagesTrend
Updated 6 days ago · Apache-2.0 GitHub repository of PF TA Isolate 04 - Close x HMA(55)

BarUpDn Strategy

by hasnocool
106 stars

The BarUpDn Strategy triggers trades based on candle price direction relative to a past bar. It enters a long position with a stop order above the high when the current candle closes above its open and its open is higher than the close of a specified lookback

Strategy v4 Candlestick patternsBreakout
Updated 2 years ago · GPL-3.0 GitHub repository of BarUpDn Strategy
1 stars

This validation strategy tests continuous-state entry and exit logic using a standard 14-period Relative Strength Index (RSI). It opens a long position whenever RSI is above 50 and closes the position whenever RSI drops to or below 50. The script operates in a

Strategy v6 Oscillators & momentum
Updated 6 days ago · Apache-2.0 GitHub repository of PF TA isolate 06 - RSI(14) > 50 Continuous

BB + ADX Strategy

by hasnocool
106 stars

The BB + ADX Strategy triggers entries when price crosses Bollinger Bands during low-trend market conditions as filtered by the Average Directional Index (ADX). It enters long when price crosses above the lower band and short when price crosses below the upper

Strategy v4 Volatility & bandsOscillators & momentum
Updated 2 years ago · GPL-3.0 GitHub repository of BB + ADX Strategy
1 stars

This validation strategy evaluates a continuous-state MACD trend condition rather than a crossover event trigger. It calculates standard MACD line, signal line, and histogram values on the closing price using 12, 26, and 9 periods. The strategy enters a long p

Strategy v6 Oscillators & momentum
Updated 6 days ago · Apache-2.0 GitHub repository of PF TA Isolate 07 - MACD > Sig Continuous

BB+RSI+OBV

by hasnocool
106 stars

This strategy combines Bollinger Bands, the Relative Strength Index (RSI), and On-Balance Volume (OBV) to generate trade signals directly on the price chart. Long entries trigger when price is above the middle SMA band, RSI is over 50, and OBV is rising. Short

Strategy v4 Volatility & bandsOscillators & momentum
Updated 2 years ago · GPL-3.0 GitHub repository of BB+RSI+OBV

This Pine Script strategy calculates a standard 14-period Relative Strength Index (RSI) to generate simple momentum-based trading signals. It executes a long entry of one fixed unit when the RSI rises above 55 while flat. Open positions close entirely once the

Strategy v6 Oscillators & momentum
Updated 6 days ago · Apache-2.0 GitHub repository of PF TA isolate 09 - RSI>60 entry, RSI<45 exit

BB-strategy

by hasnocool
106 stars

This strategy executes trades based on Bollinger Bands with optional filter conditions from RSI and MACD oscillators. It overlays on the price chart and plots MACD lines directly across the bars. Entries trigger according to band interactions combined with mom

Strategy v4 Volatility & bandsOscillators & momentum Repaints
Updated 2 years ago · GPL-3.0 GitHub repository of BB-strategy
1 stars

PF TA Isolate 10 - Typed-Matrix UTC is a Pine Script v6 strategy designed for engine parity validation. It populates a 24-by-7 boolean matrix tracking high-RSI hours and days using an explicit UTC timezone specification. The matrix is transposed twice to check

Strategy v6 Oscillators & momentum
Updated 6 days ago · Apache-2.0 GitHub repository of PF TA Isolate 10 - Typed-Matrix UTC

BB9 MA200 Strategy

by hasnocool
106 stars

A trend-following strategy combining Bollinger Bands with a long-term moving average filter. It plots a 200-period EMA along with standard 21-period Bollinger Bands directly on the price chart. Long entries trigger when both the upper and lower Bollinger Bands

Strategy v4 TrendVolatility & bands
Updated 2 years ago · GPL-3.0 GitHub repository of BB9 MA200 Strategy

This strategy draws on the price chart and manages long and short entries around pivot trendlines. It filters signals with three configurable moving averages, Stochastic RSI, a higher-timeframe Stochastic RSI, and optional RSI divergence. A session window can

Strategy v5 TrendOscillators & momentum Repaints
Updated 5 months ago · None stated GitHub repository of Pivot Trendlines with Divergence Scanner Strategy
1 stars

This validation strategy calculates a 14-period Relative Strength Index (RSI) and maintains a persistent 24x7 boolean matrix tracking whether RSI crossed above 60 for specific hour and day combinations. Long positions are entered when at least six cells in the

Strategy v6 Oscillators & momentum
Updated 6 days ago · Apache-2.0 GitHub repository of PF TA Isolate 11 - Mask Only No Transpose
106 stars

This strategy plots a volume-weighted average price, Bollinger Bands built on that VWAP, a 200-period simple moving average, and Fibonacci pivot levels in a separate pane. It opens a long position when VWAP crosses above the band basis and the close is at or a

Strategy v4 Volatility & bandsSupport & resistance
Updated 2 years ago · GPL-3.0 GitHub repository of BBofVWAP with entry at Pivot Point

This strategy combines triple moving average trend filtering with Stochastic RSI levels and optional RSI divergence signals to generate long and short trade entries. It uses Average True Range multipliers to define dynamic take profit and stop loss levels for

Strategy v5 TrendOscillators & momentum
Updated 5 months ago · None stated GitHub repository of Pivot Trendlines with Divergence Scanner Strategy
1 stars

A test strategy from a reference corpus that evaluates RSI, a MACD histogram and a Bollinger middle line on 1-hour data requested from a 15-minute chart, with lookahead off. It goes long one unit when hourly RSI is above 55, the hourly histogram is positive an

Strategy v6 Oscillators & momentumTrend
Updated 6 days ago · Apache-2.0 GitHub repository of PF TA Recompute Probe 01 MTF RSI MACD BB

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