Pine Library · 3,064 open-source scripts

Free Moving Average Pine Scripts (page 60)

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

106 stars

This strategy executes long-only entries based on moving average pullbacks relative to a 504-period high. It enters when price dips between the 13 and 21 EMAs while remaining within ten percent of the recent high. The script plots green markers on new highs an

Strategy v4 Moving averagesTrend
Updated 2 years ago · GPL-3.0 GitHub repository of AMRS LongOnly PartTimer
99 stars

This indicator calculates the mean absolute percentage error between a chosen price source and an exponential moving average of that same source. It averages absolute percentage differences with a circular buffer over the selected lookback and plots the result

Indicator v6 Moving averages
Updated 4 weeks ago · Apache-2.0 GitHub repository of Mean Absolute %Error (MAPE)
1 stars

This strategy plots a fast and a slow exponential moving average on the price chart and flips position when they cross. A crossover of the fast EMA above the slow EMA enters one unit long, and a crossunder enters one unit short. There is no stop loss, take pro

Strategy v6 Moving averagesScalping
Updated 6 days ago · Apache-2.0 GitHub repository of PF probe scalping-probe-02-fast-ma-trigger
99 stars

This indicator calculates the mean absolute error between a selected price source and an exponential moving average of that same source. Absolute differences are averaged with a circular buffer over the chosen period, and the period is limited between 1 and 40

Indicator v6 Moving averages
Updated 4 weeks ago · Apache-2.0 GitHub repository of Mean Absolute Error (MAE)

RedK Momentum Bars

by regalouisei
2 stars

Calculates and plots momentum bars in a separate pane using three moving averages: a fast MA, a slow MA with a delay setting, and a trend filter MA. Loosely inspired by the Elder Impulse system, it measures momentum relative to a zero filter line. Users can cu

Indicator v5 Oscillators & momentumMoving averages
Updated 8 months ago · None stated GitHub repository of RedK Momentum Bars
1 stars

This strategy combines a three-tier EMA stack, RSI momentum filtering, and channel breakout rules to generate trend-following entries on the price chart. It detects swing highs and swing lows to draw connecting trend lines across pivot points. Entries trigger

Strategy v6 TrendMoving averages
Updated 6 days ago · Apache-2.0 GitHub repository of PF Probe Trendmaster Integration

This overlay strategy builds two moving averages from a selectable EMA, WMA, or SMA and plots the faster one on the price chart. A buy signal is a crossover of the fast average above the slow average, and a sell signal is the opposite cross. It colors the aver

Strategy v4 TrendMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of Arch1tect's New Toy (Strategy Tester Version)
99 stars

This indicator plots Mean Absolute Scaled Error between a selected price source and an exponential moving average of that source. Absolute differences are divided by a scale equal to the mean absolute bar-to-bar change of the source, computed once from the fir

Indicator v6 Moving averages
Updated 4 weeks ago · Apache-2.0 GitHub repository of Mean Absolute Scaled Error (MASE)
1 stars

This strategy tracks a three-tier exponential moving average (EMA) stack to identify trend alignment regimes. It defines a bullish state when fast EMA is above mid and mid is above slow, and a bearish state when inverted. Orders execute strictly on state trans

Strategy v6 TrendMoving averages
Updated 6 days ago · Apache-2.0 GitHub repository of PF probe trendmaster-probe-02-multi-tier-ma
106 stars

The Aroon Strategy Long Only is a trend-following strategy that combines the Aroon indicator with a Least Squares Moving Average filter. It enters long positions when the Aroon Up line crosses above the Aroon Down line while the closing price trades above the

Strategy v4 TrendOscillators & momentum
Updated 2 years ago · GPL-3.0 GitHub repository of Aroon Strategy Long Only

My Strategy

by g-moe
3 stars

This strategy calculates the average closing price from a lower 3-minute timeframe and plots the result in a separate pane using array sum on multi-bar aggregate data. It fetches lower-timeframe data via security lower tf and includes commented out crossover c

Strategy v5 Moving averages
Updated 5 months ago · None stated GitHub repository of My Strategy
1 stars

This strategy detects long and short signals using a fast EMA crossing above or below a slow EMA. Entries only trigger when a recent pivot exists for anchoring. Long entries place a stop loss at the last pivot low and a take profit at 2R distance using the ent

Strategy v6 TrendMoving averages
Updated 6 days ago · Apache-2.0 GitHub repository of PF probe trendmaster-probe-03-pivot-tp-sl

Mean Error (ME)

by mihakralj
99 stars

This indicator calculates the mean error between a selected price source and an exponential moving average of that source. It subtracts the EMA from the source, then averages those errors over a user-defined lookback with a circular buffer that behaves like a

Indicator v6 Moving averages
Updated 4 weeks ago · Apache-2.0 GitHub repository of Mean Error (ME)

RedK Volume-Accelerated Directional Energy Ratio (VADER) measures directional momentum accelerated by volume activity. It calculates price change relative to the average bar range, limits the ratio, and scales it using relative, raw, or static volume weighting

Indicator v5 VolumeOscillators & momentum
Updated 8 months ago · None stated GitHub repository of RedK Volume-Accelerated Directional Energy Ratio

This strategy evaluates a triple-confluence entry gate combining trend, momentum, and structure filters on the price chart. It enters long when a fast exponential moving average is above a slow exponential moving average, RSI exceeds a defined threshold, and t

Strategy v6 TrendOscillators & momentum
Updated 6 days ago · Apache-2.0 GitHub repository of PF Probe Trendmaster-Probe-04 Trend Entry Gate

Opening Range

by g-moe
3 stars

The Opening Range indicator combines multiple technical analysis tools onto the main price chart. It calculates MACD momentum sequences alongside Stochastic oscillator limits to generate buy and sell triangle shapes. Additionally, it evaluates trend alignment

Indicator v5 TrendOscillators & momentum Repaints
Updated 5 months ago · None stated GitHub repository of Opening Range

Relative Bandwidth Filter

by regalouisei
2 stars

Calculates normalized bandwidth readings across various volatility channel types including Bollinger Bands, Keltner Channels, and Donchian Channels. It compares bandwidth values against a secondary band baseline to evaluate relative volatility expansion or con

Indicator v5 Volatility & bandsMoving averages
Updated 8 months ago · None stated GitHub repository of Relative Bandwidth Filter

PF probe wunder-scalper-probe-02-alert-message-templates is a strategy that generates long and short signals using a fast EMA of 5 crossing above a slow EMA of 13 on the price chart. It places fixed-size entries of 1 share on each crossover signal and emits al

Strategy v6 Moving averagesTrend
Updated 6 days ago · Apache-2.0 GitHub repository of PF probe wunder-scalper-probe-02-alert-message-templates

Opening Range

by g-moe
3 stars

This indicator overlays a Directional Sentiment Line ribbon on the price chart using moving averages of high, low, open, and close prices. It combines higher-timeframe MACD and RSI filters with standard deviation volume heatmap thresholds to assess directional

Indicator v5 TrendOscillators & momentum Repaints
Updated 5 months ago · None stated GitHub repository of Opening Range
1 stars

Calculates fast and slow Exponential Moving Averages (EMAs) to identify trend shifts on the price chart. When the fast EMA crosses above the slow EMA, any open short position is closed before opening a long trade. When the fast EMA crosses below, any open long

Strategy v6 TrendMoving averages
Updated 6 days ago · Apache-2.0 GitHub repository of PF Probe Wunder-Scalper-Probe-Integration

This indicator calculates the Mean Squared Logarithmic Error (MSLE) between a selected price source and its exponential moving average over a specified lookback period. It evaluates prediction error by computing the squared difference of natural logarithms, sm

Indicator v6 Moving averages
Updated 4 weeks ago · Apache-2.0 GitHub repository of Mean Squared Logarithmic Error (MSLE)
1 stars

A test strategy from a reference corpus that fills orders at the close of the signal bar. It goes long when a 9-period EMA crosses above a 21-period EMA while RSI is below 70, and closes the long when the EMAs cross back down. One unit is traded, with no stop

Strategy v6 Moving averagesOscillators & momentum
Updated 6 days ago · Apache-2.0 GitHub repository of PF Process Orders 02 On Close True

Median

by mihakralj
99 stars

Calculates the rolling statistical median of a chosen price or indicator series over a specified lookback period. For each bar, the script gathers valid data points across the window into an array, sorts them, and determines the midpoint value, averaging the t

Indicator v6 Moving averages
Updated 4 weeks ago · Apache-2.0 GitHub repository of Median
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
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

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

V4 Essential Colors 00

by be-thomas
65 stars

This indicator demonstrates different syntax methods for setting color transparency in Pine Script v4. It calculates and plots five simple moving averages with lengths of 10, 30, 50, 70, and 90 periods directly on the main price chart. Each moving average line

Indicator v4 Moving averages
Updated 5 days ago · GPL-3.0 GitHub repository of V4 Essential Colors 00
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

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 indicator plots the original simple moving average, a symmetric moving average calculated from the highest and lowest moving averages over the window length, and a dynamic midline. It generates buy signals when the deviation from the symmetric moving aver

Indicator v5 Moving averagesTrend
Updated 7 weeks ago · None stated GitHub repository of Symmetric MA Reversal Signals

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

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

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

Symmetric Price - Invertible System calculates geometric trend baselines, symmetric moving averages, and Fibonacci wave oscillations overlaid directly on the price chart. Users select two anchor points with custom timestamps and prices to define a central slop

Indicator v5 Moving averagesSupport & resistance
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
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

Modular Filter (MODF)

by mihakralj
99 stars

Modular Filter (MODF) calculates and plots an adaptive dual-path smoothing filter on the main price chart. Based on work by alexgrover, it computes upper and lower EMA bands that snap to price extremes and maintain a bullish or bearish state. The beta paramete

Indicator v6 TrendMoving averages
Updated 4 weeks ago · Apache-2.0 GitHub repository of Modular Filter (MODF)

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

Symmetric Price with MA calculates centered and mirrored price values using moving average midpoints and user-defined slope projections. It allows users to set a time anchor and slope angle to dynamically offset price data, optionally applying Golden Ratio mul

Indicator v5 Moving averagesTrend
Updated 7 weeks ago · None stated GitHub repository of Symmetric Price with MA
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)

The MACD indicator calculates the difference between two exponential moving averages with fast and slow periods to identify momentum shifts in the market. It plots the MACD line, signal line, and histogram bars in a separate pane below the price chart. The his

Indicator v6 Oscillators & momentumMoving averages
Updated 4 weeks ago · Apache-2.0 GitHub repository of Moving Average Convergence Divergence (MACD)

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