A strategy is a Pine script that opens and closes simulated positions with strategy.entry() and strategy.exit(). Add one to a chart and the Strategy Tester tab lists every trade with the net profit, drawdown and win rate.
Those results depend on the settings: commission, slippage, order size and how fills are modelled. Defaults are usually kinder than a real account, and a strategy that repaints or reads future data can show a backtest it could never have traded.
395 of these 3,040 scripts are marked Repaints, or read higher-timeframe data with lookahead on.
Before You Use One
Set commission and slippage in the strategy's Properties before reading the results.
Check the Risk Notes for repainting, lookahead, stacked entries and missing stop-losses.
Forward test on a demo account: a backtest describes the past only.
Doge SMA is a long-only moving-average crossover strategy drawn on the price chart. It calculates a fast and a slow simple moving average of close and enters a long position when the fast average crosses above the slow average, but only inside a user-defined s
This script is an empty strategy template for Pine Script developers. It declares a version 4 strategy named Basic Strategy Boilerplate with the short title Strategy Boilerplate and sets overlay to true so any future plots would appear on the price chart. It d
This strategy calculates and plots a fast Exponential Moving Average (EMA) and a slow EMA directly on the main price chart. It enters long trades when the fast EMA crosses above the slow EMA and exits when the fast EMA crosses below the slow EMA. Inputs allow
This strategy plots on the price chart and opens long or short positions when a weighted score from MACD, Stochastic RSI, RSI, Supertrend and a moving-average crossover exceeds a user-set trigger. Each component has its own weight and candle delay. Entries can
This overlay strategy offers two selectable entry modes: a Bollinger squeeze on typical price and a simple moving-average cross. It filters trades by weekday, session, date range, and an optional news window, and can restrict direction or invert the side. Risk
Mean Reversion Strategy is an overlay strategy that identifies pullbacks using a long-term EMA, RSI, and candlestick patterns. It generates long signals when a bullish engulfing candle forms below the EMA while RSI is oversold, and short signals when a bearish
This strategy calculates the Moving Average Convergence Divergence indicator and plots the MACD line, signal line, and histogram in a separate pane. It enters long positions when the MACD line crosses above the signal line and enters short positions when it cr
This price-chart strategy plots a simple moving average and upper and lower bands built from the standard deviation of close, scaled by separate offset inputs. It enters a fixed quantity long when close crosses above the upper band and a fixed quantity short w
This strategy executes trades based on crossovers between a 12-period and a 26-period exponential moving average (EMA). Long positions can be filtered by pivot resistance breakouts and RSI boundary ranges. For trade management, it provides two configurable par
Gold Scalping BOS & CHoCH is an overlay strategy designed for detecting market structure shifts. It calculates rolling swing highs and lows to identify Break of Structure (BOS) and Change of Character (CHoCH) events. Long signals trigger when bullish BOS and C
This strategy combines three Exponential Moving Averages with Williams Fractals to execute trend-following or mean-reverting trades. It analyzes price structure using short, medium, and long-term EMAs along with fractal highs and lows. Entries trigger when fra
This strategy builds a spot grid between user-set high and low prices and draws it on the price chart. It splits that range into ten levels and places up to five long limit orders at the lower levels, sizing each from current equity. Orders already below price
This strategy trades long breakouts of a fast and a slow moving average on the price chart. It opens a long position when price crosses above either average, using a percentage of equity as size. It reduces the position by a set share when the high reaches the
This strategy plots a MACD oscillator in a separate pane and trades Bitcoin futures from zero-line and signal-line crosses. Optional early momentum signals, a volume filter, and a trend moving-average filter can confirm entries. It sizes positions as fixed con
This strategy plots exponential-moving-average Bollinger bands on the price chart and calculates RSI. It opens a long position when close crosses above the upper band while RSI is at or above a threshold, the date filter allows trading, and no position is open
SSE Index RSI Bounce Strategy is a multi-timeframe momentum and trend strategy that combines daily and weekly Relative Strength Index (RSI) bounds with Exponential Moving Averages (EMA). It identifies long entries when daily or weekly RSI crosses up from overs
Gold Scalping BOS & CHoCH with MA Filter is a strategy that identifies market structure shifts using Break of Structure (BOS) and Change of Character (CHoCH) signals alongside exponential moving average trend filters. Long trades enter when bullish BOS, bullis
This overlay strategy targets one-minute ATOM scalps. It tracks pivot highs and lows as resistance and support, compares a three-period EMA with a multi-stage smoothed close, and flags long or short when price crosses that curve in the matching direction. Dail
This strategy trades longs and shorts on the price chart. Long entries require a close above the prior Donchian high, a close above a long-term SMA, and RSI above a threshold, with size set as a percentage of equity. Long exits use a stop at the prior Donchian
This intraday strategy implements Mark Fisher's Opening Range Breakout (ORB) methodology tailored for index futures like ES and NQ. It calculates session opening ranges, volume z-scores, and VWAP bands to plot support, resistance, and confirmation levels on th
This strategy enters directional trades based on MACD histogram zero-line crossovers filtered by a safety threshold. Users toggle long or short trading modes independently. MACD lines can be calculated using simple or exponential moving averages. Exits execute
CombinedBinHAndClucV6 is a trading strategy based on the popular BinHV45 and ClucMay72018 algorithms. It calculates dual Bollinger Bands, Exponential Moving Averages, Relative Strength Index, Average True Range, and volume metrics across primary and one-hour h
This script serves as a boilerplate strategy template featuring modular trade execution and order management. It includes placeholder buy and sell signals intended to be completed by the user. The template provides customizable risk management features includi
LuxAlgo Hybrid Gold Scalper is a price-chart strategy aimed at gold. It stacks a fast, slow, trend and 200-period bias EMA to mark trend direction, then filters strength with RSI, ADX and an intraday VWAP. Swing highs and lows are marked from pivot length. Set
This multi-indicator modular strategy evaluates market entries by requiring consensus across a selectable suite of technical tools, including Absolute Strength, SSL Channel, Squeeze Momentum, and WaveTrend. Once conditions are met, it executes entries and scal
3hr Stoch is a short-only trading strategy based on a smoothed Stochastic Oscillator. It calculates the %K and %D lines using configurable period and smoothing settings. The strategy enters a short position when the %K line crosses below the %D line while drop
This Pine Script strategy identifies classic bullish engulfing candlestick patterns to open long positions, deploying 100 percent of equity. It calculates a short-term Relative Strength Index to determine exits, closing open long positions when the RSI exceeds
This strategy calculates a standard moving average convergence divergence oscillator and executes trades directly on the main price chart. It opens a long position when the histogram delta crosses above zero and enters a short position when it crosses below ze
P404 Smoke is a price-chart strategy that sequences an optional higher-timeframe EMA bias, a liquidity range from recent pivots, a sweep of buy-side or sell-side liquidity, and a market structure shift within a set bar window. Comments state it then looks for
This strategy trades Donchian channel breakouts on the price chart. It enters long or short when price breaks the prior entry channel, sizes each unit from a percentage of equity and ATR, and adds units at fixed ATR steps up to a set maximum. It exits on the o
SuperTrend Strategy is a trend-following strategy that plots an ATR-based SuperTrend line on the price chart and optionally fills the background green or red with the trend. It opens a long when the trend flips up and a short when it flips down, only inside a
This strategy plots on the XAUUSD price chart and looks for Smart Money Concepts entries on the fifteen-minute timeframe. It scores fair value gaps, order blocks, liquidity sweeps, break of structure, and change of character, plus EMA, RSI, MACD, and higher-ti
This strategy calculates two simple moving averages using periods 34 and 68 on the close price. It detects bullish crossovers to enter long positions of 10 contracts and bearish crossovers to enter short positions of 10 contracts after the 100th bar. Opposite
This strategy compares two momentum readings of the close, a faster and a slower period, and plots both in a separate pane with a colored fill. It enters long when both readings are positive and closes the long when either turns negative. Unless long-only mode
Claude Quant - Multi-Session Strategy is a reference strategy framework designed for multi-session index trading across Nikkei, DAX, and Nasdaq markets. It outlines a session sequencing architecture that adjusts base risk parameters, applies conditional expans
BitLa Microtendencias A002 is a TradingView strategy that enters long when a 10-period EMA crosses above a 120-period EMA and enters short on the opposite cross. It draws on the price chart and can limit trading to a start and stop date. Risk controls include
Extrema is an overlay strategy that evaluates lowest low price points across exponentially scaled lookback periods. It calculates period lengths using exponential math controlled by base, factor, and crop settings, then tracks falling price extremes across mul
This strategy is titled for Bitcoin on the four-hour chart and is set to draw on the price chart. It detects three-candle fair value gaps and inverted gaps, and it defines a check for price near a gap midpoint within a percentage tolerance. An optional filter
This strategy evaluates market trend and momentum to generate long and short trading signals on price charts. It plots 100-period and 500-period moving averages (EMA or SMA) to establish macro trend direction. Long entries require trend alignment alongside opt
This strategy executes hardcoded historical trade entries and exits based on exact Unix timestamps for the BTC/USD 2-hour timeframe on Bitfinex. It plots trades directly on the price chart to visualize static trade log data from a specific backtest export. The
AwesomeADX is a Pine Script v4 strategy that combines an Awesome Oscillator, ADX directional movement, and Bollinger percent B with an optional four-length moving-average trend filter. It sizes each position as a percentage of equity and can limit trades to a
This strategy implements a channel breakout system directly on the main price chart. It calculates highest highs and lowest lows over configurable entry and exit periods using historical candles. A long entry triggers when the close breaks above the entry chan
This strategy detects bullish and bearish pinbar candles on the price chart and opens a long or short position when the pattern appears and no trade is open. Take profit and stop loss are set from the signal candle's range using separate multipliers, and trail
SMC Strategy is a Pine Script v5 overlay strategy based on smart money concepts. It flags market structure shifts from ten-bar highs and lows, draws bullish and bearish order blocks as rectangles when that option is on, and marks liquidity sweeps with short li
This strategy places repeated long entries of a fixed cash amount on a chosen weekday at a selected weekly interval inside a user-defined start and end date. It draws on the price chart. Settings choose the calendar window, the starting week, whether buys occu
The Reverse RSI Strategy is a scalping system designed for forex pairs during specific trading sessions. It combines a smoothed RSI indicator with five Exponential Moving Averages to identify mean-reversion trade opportunities. Position sizing dynamically adju
Calculates the Average Directional Index (ADX), Directional Movement Index (DMI), and an Exponential Moving Average to trade strong directional momentum. It enters long when the DI+ line crosses above DI- while ADX exceeds a threshold and price is above the EM
Markov Strategy is a mean-reversion quantitative strategy inspired by streak-based Markov chain analysis. Applied directly to the price chart, it monitors price action for consecutive downward closes. The strategy enters a long position after detecting six con
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.