Pine Library · 3,064 open-source scripts

Free Moving Average Pine Scripts (page 55)

Open-source Pine scripts built on moving averages: EMA and SMA tools, ribbons, Hull and adaptive averages, and crossover strategies.

Pine scripts3,064
Code shown here1,765open licence
Updated in a year1,828
No repaint flag2,707

Moving averages: Indicators, Strategies and Libraries

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

Wilder's Moving Average (RMA)

by mushroom-men-Trading
2 stars

This script calculates and plots Wilder's Relative Moving Average (RMA) of a chosen source over a user-defined period. It applies an optimized exponential warmup compensator to ensure accurate early bar values while maintaining O(1) computational complexity. T

Indicator v6 Moving averages
Updated 9 months ago · None stated GitHub repository of Wilder's Moving Average (RMA)
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

RSI Cyclic Smoothed v2

by mikeyhu70
1 stars

This indicator plots a cyclic smoothed RSI in a separate pane, with a dominant cycle length, a maximum cycle and a divider as inputs, plus vibration and leveling values. Two signal lines use selectable moving average types with automatic or manual lengths, and

Indicator v5 Oscillators & momentumMoving averages
Updated 6 months ago · None stated GitHub repository of RSI Cyclic Smoothed v2

Calculates John Ehlers' Recursive Median Filter, a nonlinear filter combining a 5-bar running median with exponential smoothing to reduce impulsive noise while maintaining responsiveness. The smoothing factor is calculated from the cycle period setting using E

Indicator v6 Moving averagesTrend
Updated 4 weeks ago · Apache-2.0 GitHub repository of Ehlers Recursive Median Filter (RMED)

TRIX

by mihakralj
47 stars

The TRIX indicator calculates the percentage rate of change of a triple-smoothed exponential moving average (EMA) applied to a selected price source. It incorporates explicit warm-up logic to ensure stable runtime initialization without relying on uncompensate

Indicator v6 Oscillators & momentumMoving averages
Updated 8 months ago · MIT GitHub repository of TRIX

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
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

TTM Trend

by mihakralj
47 stars

This indicator calculates a short-term trend filter based on an exponential moving average and its slope. It identifies upward, downward, or neutral states by evaluating bar-to-bar changes in the average, coloring the plotted line accordingly. It also calculat

Indicator v6 TrendMoving averages
Updated 8 months ago · MIT GitHub repository of TTM Trend

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
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

NO.1 Perfect Buy/Sell v2

by vedkanani123
1 stars

A price-chart indicator for lower timeframes that draws EMA 9, 21, 50 and SMA 200 clouds and prints always-in buy and sell flips. Signals combine EMA stack or cross, RSI, ADX and DI, relative volume and a lock that blocks tiny sideways ranges. The higher-timef

Indicator v6 TrendMoving averages Repaints
Updated 2 months ago · None stated GitHub repository of NO.1 Perfect Buy/Sell v2

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

Ehlers Reverse EMA

by mihakralj
99 stars

Calculates John F. Ehlers' Reverse Exponential Moving Average (EMA) designed to eliminate lag from traditional exponential smoothing. The indicator computes a warmup-compensated base EMA and subjects it to an 8-stage cascaded Z-transform inversion. The resulti

Indicator v6 Moving averagesTrend
Updated 4 weeks ago · Apache-2.0 GitHub repository of Ehlers Reverse EMA

Zero-Lag Double EMA (ZLDEMA)

by mushroom-men-Trading
2 stars

The Zero-Lag Double EMA indicator calculates a double exponential moving average with zero-lag smoothing using lag compensation and exponential warmup compensator. It plots the resulting ZLDEMA line on the price chart. The main input is the period, defaulting

Indicator v6 Moving averagesTrend
Updated 9 months ago · None stated GitHub repository of Zero-Lag Double EMA (ZLDEMA)
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
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
99 stars

Calculates John Ehlers' Rocket RSI indicator by combining a two-pole SuperSmoother filter with a summation-based RSI and a Fisher Transform. It measures price momentum, applies smoothing to reduce lag and noise, computes relative directional change, and applie

Indicator v6 Oscillators & momentumMoving averages
Updated 4 weeks ago · Apache-2.0 GitHub repository of Ehlers Rocket RSI (RRSI)

Fill example 2

by be-thomas
65 stars

This indicator computes a simple moving average of the close over a fixed length of ten bars and plots a percentage oscillator equal to the gap between that average and the close, scaled by one hundred. It draws the oscillator in a separate pane and fills the

Indicator v4 Oscillators & momentumMoving averages
Updated 6 days ago · GPL-3.0 GitHub repository of Fill example 2
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

This indicator draws a SPY scalping panel in a separate pane. It calculates a Supertrend side from ATR smoothed by a selectable average, defaulting to HMA, and uses three moving averages of selectable type, defaulting to EMA lengths 13, 50, and 75. Colors mark

Indicator v5 TrendMoving averages
Updated 5 months ago · None stated GitHub repository of J8 30 123 Spy Scalping Lower Pro 2 Jerry

Zero-Lag EMA (ZLEMA)

by mushroom-men-Trading
2 stars

Calculates and plots a Zero-Lag Exponential Moving Average directly on the price chart. It reduces traditional moving average lag by computing a signal from the current price and a lagged price offset by half the smoothing period, followed by exponential smoot

Indicator v6 Moving averagesTrend
Updated 9 months ago · None stated GitHub repository of Zero-Lag EMA (ZLEMA)
106 stars

This strategy calculates the WaveTrend oscillator from HLC3 averages and its smoothed difference to generate long signals on BTC price charts. It enters positions when WT1 crosses above WT2 and stays below a limit value. Stop loss triggers at the recent bar lo

Strategy v5 Oscillators & momentumMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of BTC WaveTrend R:R=1:1.5

For Loop

by be-thomas
65 stars

This script demonstrates how to implement a custom Simple Moving Average (SMA) function using an explicit loop construct in Pine Script v4. It defines a function that iterates through past bar values up to a specified length of 14, sums the closing prices, and

Indicator v4 Moving averages
Updated 6 days ago · GPL-3.0 GitHub repository of For Loop

On Balance Volume

by TWODS-CAPITAL
37 stars

This indicator plots the standard On Balance Volume (OBV) in a separate pane by accumulating volume based on the direction of price changes. It includes an optional smoothing line that can apply a Simple, Exponential, Smoothed, Weighted, or Volume-Weighted Mov

Indicator v5 VolumeMoving averages
Updated 3 years ago · MIT GitHub repository of On Balance Volume
13 stars

This Pine Script v5 strategy draws on the price chart and sends TradingView orders toward Zignaly. It uses a selectable moving average, defaulting to a 200-period EMA of close, together with an SSL calculation based on a 10-period SMA. The user can trade long

Strategy v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of Ruckard TradingZone SSL EMA

This indicator computes and plots multiple technical analysis features on a separate pane. It calculates EMA-based trend indicators including fast and slow EMAs along with their slope, momentum oscillators such as RSI, Stochastic RSI, and MACD histogram, WaveT

Indicator v6 TrendOscillators & momentum
Updated 3 days ago · MIT GitHub repository of Vein Feature Exporter Core 4H [WavesUnchained]

J8 30 123 SPY Scalping PRO 2 Jerry is an overlay strategy designed for short-term SPY scalping and spread setups. It combines multiple Exponential Moving Averages with a custom Supertrend calculation based on flexible moving average types and ATR lengths to pl

Strategy v5 TrendMoving averages
Updated 5 months ago · None stated GitHub repository of J8 30 123 SPY Scalping PRO 2 Jerry

Zero-Lag Triple EMA (ZLTEMA)

by mushroom-men-Trading
2 stars

The Zero-Lag Triple EMA (ZLTEMA) indicator calculates a smoothed trend line using triple exponential smoothing with lag compensation for reduced delay. It plots the resulting line on the price chart in yellow. The period input adjusts smoothing sensitivity by

Indicator v6 Moving averagesTrend
Updated 9 months ago · None stated GitHub repository of Zero-Lag Triple EMA (ZLTEMA)

This strategy executes trades based on fast and slow exponential moving average crossovers constrained by a configurable intraday session window. Long positions open on bullish EMA crosses and short positions open on bearish EMA crosses when no existing positi

Strategy v6 Moving averagesSessions & time
Updated 7 days ago · Apache-2.0 GitHub repository of PF probe 4ema-rsi-probe-03-binary-bar-window

Function: Event Statistics

by ricardosantos79
261 stars

Function: Event Statistics tracks and analyzes price behavior following specific market events. By default, it detects when price crosses above a ten-period simple moving average and records price changes, peak high, and minimum low values over a user-defined

Indicator v4 Moving averages
Updated 4 years ago · None stated GitHub repository of Function: Event Statistics
47 stars

Ultrasmooth Filter (USF) calculates a noise-reduced trend curve using a two-pole infinite impulse response (IIR) filter structure with momentum enhancement. Designed to minimize lag while suppressing price fluctuations, it computes efficiently with constant O(

Indicator v6 Moving averagesTrend
Updated 8 months ago · MIT GitHub repository of Ultrasmooth Filter (USF)

This intraday strategy is designed for short-term scalping on equity and index markets like SPY. It evaluates price movement using configurable exponential and Hull moving averages combined with an ATR-based Supertrend calculation. The script plots signal arro

Strategy v5 TrendMoving averages
Updated 5 months ago · None stated GitHub repository of J8 30 123 SPY Scalping PRO 2 Jerry
1 stars

This indicator calculates a Fibonacci-scaled sinusoidal wave cycle derived from two user-selected chart reference points. Plotted directly on the main price chart, it projects an extended trendline alongside moving averages adjusted by normal and inverse slope

Indicator v5 TrendSupport & resistance
Updated 7 weeks ago · None stated GitHub repository of Hyper Fibo System {Morindok}
114 stars

This indicator plots a zigzag-like moving average and a stepline on the price chart. It fetches previous bar prices from two input timeframes using the security function with gaps off and lookahead on. The zzoid function creates a smoothed curve via cumulative

Indicator v4 Moving averagesTrend Repaints
Updated 1 year ago · None stated GitHub repository of Straightened Price Curve

J8 Refactor

by g-moe
3 stars

J8 Refactor is a multi-indicator trading strategy that combines a custom Supertrend, multiple moving average filters, RSI levels, and MACD logic with Bollinger Bands. It executes entries based on multi-condition alignment and offers customizable exits, includi

Strategy v5 TrendMoving averages
Updated 5 months ago · None stated GitHub repository of J8 Refactor

History referencing

by be-thomas
65 stars

This Pine Script v4 indicator demonstrates history referencing on array values versus series values. It stores the close in a one-element float array, then plots the previous value of that array element beside the previous close. It also plots a 20-period simp

Indicator v4 Moving averages
Updated 6 days ago · GPL-3.0 GitHub repository of History referencing
47 stars

This indicator plots a rolling linearly weighted average of a chosen source on the price chart. Weights rise from the oldest bar to the newest, matching a weighted moving average, and a circular buffer updates the sums in constant time. During warm-up the deno

Indicator v6 Moving averages
Updated 8 months ago · MIT GitHub repository of Weighted Average (WAVG)

MA & BB Levels [ST]

by eddiebelaval
7 stars

This indicator draws horizontal daily and weekly levels on the price chart from two exponential moving averages and a Bollinger-style envelope. It calculates EMA 9, EMA 20, and an EMA-based band with a configurable standard-deviation width, then requests those

Indicator v5 Moving averagesVolatility & bands Repaints
Updated 3 months ago · None stated GitHub repository of MA & BB Levels [ST]

PF probe 52 - stop entry cancel

by pineforge-4pass
1 stars

This strategy compares an 8-period EMA with a 21-period EMA on the price chart. When the fast average is above the slow average it places a long stop at the prior bar high and cancels the pending short; otherwise it places a short stop at the prior bar low and

Strategy v6 Moving averagesBreakout Repaints
Updated 7 days ago · Apache-2.0 GitHub repository of PF probe 52 - stop entry cancel
114 stars

This indicator measures normalized buying and selling volume pressure in a separate pane. It rescales volume, open, and close prices over a selected lookback period using min-max normalization. Volume is categorized into bullish or bearish pressure based on ba

Indicator v4 VolumeMoving averages
Updated 1 year ago · None stated GitHub repository of Volume Flow v3 (Rescaled Update)

This strategy takes long trades only. It enters when a fast simple moving average crosses above a slower one and either weekly CCI or ADX meets its threshold, depending on the toggles. It closes the long when price falls below a third moving average, and it ca

Strategy v5 TrendMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of Buy Only Strategy with Dynamic Re-Entry and Exit

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