Pine Library · 3,064 open-source scripts

Free Moving Average Pine Scripts (page 16)

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

ATR Levels

by trugurpala
4 stars

This indicator calculates the Average True Range and a Simple Moving Average of closing prices. It plots a central basis line along with dynamic support and resistance levels derived from multiples of the ATR. The main settings control the ATR length and the m

Indicator v6 Support & resistanceVolatility & bands
Updated 2 months ago · MIT GitHub repository of ATR Levels

EMA Trail (Long Only)

by Jaden300
4 stars

This long-only strategy enters when the fast EMA crosses above the slow EMA and fills at the next bar open. It sets an initial percentage take profit and stop loss from the entry price. Once price rises by the trail trigger, both levels and the reference price

Strategy v6 TrendMoving averages
Updated 5 months ago · None stated GitHub repository of EMA Trail (Long Only)

MACD 4H Rhythm

by LePotoRico2105
4 stars

MACD 4H Rhythm is a TradingView strategy that trades the price chart on a four-hour forex rhythm. It goes long when the MACD histogram crosses above zero while a 21-period EMA is above a 50-period EMA, and short on the opposite histogram turn in a bearish EMA

Strategy v5 Oscillators & momentumMoving averages
Updated 7 months ago · MIT GitHub repository of MACD 4H Rhythm

MACD

by YooooungLee
4 stars

This indicator calculates and plots the standard Moving Average Convergence Divergence oscillator in a separate pane. It computes a fast exponential moving average and a slow exponential moving average from the chosen price source, taking the difference as the

Indicator v6 Oscillators & momentumMoving averages
Updated 10 months ago · Apache-2.0 GitHub repository of MACD

Daily Loss Limit [Lab]

by mitchell-917
4 stars

This strategy example enforces a daily loss limit. It detects a new trading day, stores starting equity, and tracks the day's highest and lowest equity. Trading permission depends on whether the loss from the day's starting equity stays inside a percentage of

Strategy v5 Moving averagesSessions & time
Updated 11 months ago · Custom licence GitHub repository of Daily Loss Limit [Lab]

All Candlestick Patterns

by ShabbirHasan1
4 stars

All Candlestick Patterns identifies and highlights classical Japanese candlestick patterns directly on the price chart. It determines underlying market trends using configurable moving averages, including a 50-period SMA, a dual SMA 50/200 setup, or no trend f

Indicator v5 Candlestick patternsMoving averages
Updated 1 year ago · Custom licence GitHub repository of All Candlestick Patterns

ATCA-HO

by Kalumur
4 stars

ATCA-HO is an overlay indicator that plots six Exponential Moving Averages alongside a Simple Moving Average on the price chart. It generates visual buy and sell shape labels whenever the fastest 5-period EMA crosses above or below the 22-period EMA. Additiona

Indicator v5 TrendMoving averages
Updated 2 years ago · None stated GitHub repository of ATCA-HO

Combines multiple analytical tools onto a single price chart overlay to consolidate screen space. It plots three customizable exponential moving averages, three-bar imbalance and opening gap boxes, a horizontal volume profile with point of control, and smart m

Indicator v5 SMC / ICT / price actionMoving averages Repaints
4 stars

This strategy implements a dollar-cost averaging (DCA) trading framework using Volume-Weighted Moving Average (VWMA) values and price percentage changes. It enters an initial base order and places up to a configurable number of safety orders as price declines

Strategy v5 Moving averagesScreeners & dashboards
Updated 2 years ago · None stated GitHub repository of SRP Strategy [ZCrypto]

COG Multi

by kachook
4 stars

This indicator calculates and plots multiple Center of Gravity lines derived from closing prices using different periods of 9, 50, and 200. The Center of Gravity is smoothed with a factor of 9. Three lines are drawn in a separate pane: one in white with a thic

Indicator v4 Oscillators & momentumMoving averages
Updated 3 years ago · None stated GitHub repository of COG Multi
4 stars

Snag - Swing Trade Long Term calculates 13-period, 48-period, and 200-period Weighted Moving Averages to evaluate market direction for long-term swing trading. The indicator monitors price crossovers across each moving average to identify initial trend shifts,

Indicator v5 TrendMoving averages
Updated 4 years ago · None stated GitHub repository of Snag - Swing Trade Long Term

One EMA Strategy

by aofwittawat
4 stars

This strategy plots one exponential moving average of the close on the price chart and colors it and the background by whether price is above or below that average. It flips from short to long when the close crosses above the EMA and from long to short when th

Strategy v5 TrendMoving averages
Updated 4 years ago · None stated GitHub repository of One EMA Strategy

Moving Average

by Joshua-Chang
4 stars

This script plots two exponential moving averages on the price chart, one fast and one slow. The fast MA uses length 5 and the slow MA uses length 34. It enters a long position of fixed size 1000 when the fast MA crosses above the slow MA and enters a short po

Strategy v4 Moving averagesTrend
Updated 5 years ago · None stated GitHub repository of Moving Average

EMA Cross Strategy

by degenview
3 stars

This strategy enters a long position when a fast EMA crosses above a slower EMA and closes that long when the fast EMA crosses back below. While a long is open, it places an ATR-based stop and a profit target measured from the average entry price. The main set

Strategy v6 TrendMoving averages
Updated 2 days ago · GPL-3.0 GitHub repository of EMA Cross Strategy

This indicator combines Supertrend for main trend filtering, DeMarker for momentum extremes, and Stochastic RSI for overbought/oversold signals on multiple timeframes. It plots buy/sell arrows and trend labels directly on the price chart. Additional filters in

Indicator v6 TrendOscillators & momentum
Updated 5 weeks ago · MIT GitHub repository of Zerith - Supertrend + DeMarker + Stoch RSI Multi-TF Signal
3 stars

This long-only strategy draws on the price chart. It uses MACD with the 21- and 52-period exponential moving averages. While the signal line is above zero and the faster average is above the slower one, it marks a histogram pullback and enters long on a bullis

Strategy v5 Oscillators & momentumMoving averages
Updated 7 weeks ago · None stated GitHub repository of MACD能量柱跳空策略

AI Trading Bot - 19 Modules

by thanhcong1211
3 stars

This strategy overlays trend, momentum, and simplified Smart Money Concepts (SMC) directly on the price chart. It evaluates market conditions using triple EMAs (20, 50, 200), MACD crossovers, RSI levels, and volume moving averages alongside simplified order bl

Strategy v5 SMC / ICT / price actionTrend
Updated 3 months ago · None stated GitHub repository of AI Trading Bot - 19 Modules

MTF Confluence Dashboard

by WiseManAlgo
3 stars

This indicator displays a multi-timeframe confluence dashboard and signal arrows directly on the main price chart. It evaluates trend and momentum across five configurable timeframes for up to three symbols using an exponential moving average and the relative

Indicator v5 Screeners & dashboardsTrend
Updated 4 months ago · None stated GitHub repository of MTF Confluence Dashboard
3 stars

This strategy plots a fast and a slow exponential moving average on the price chart and shades the background by which average is higher. It enters a long position when the fast average crosses above the slow average and closes that long when the fast average

Strategy v5 TrendMoving averages
Updated 7 months ago · MIT GitHub repository of EMA Crossover Trend Following
3 stars

Stella's RSI + EMA Crossover is a momentum strategy that plots exponential moving averages directly on the price chart. It generates long signals when RSI turns up from oversold levels while price trades above the fast EMA and optional 200-period trend filter

Strategy v6 TrendOscillators & momentum
Updated 8 months ago · MIT GitHub repository of Stella's RSI + EMA Crossover

Value Zones

by LucasRibeiroCaetano
3 stars

Value Zones plots a 200-week simple moving average that is further smoothed with a 20-period exponential moving average, then draws fixed multiples of that average on the price chart. Zones are filled and labeled from the average itself through one-and-a-half,

Indicator v6 Moving averagesSupport & resistance
Updated 11 months ago · Custom licence GitHub repository of Value Zones

This indicator plots the high, midpoint, and low of the previous day, week, and month as lines on the price chart. Daily levels appear on intraday charts, weekly levels on intraday or daily charts, and monthly levels on charts that are not monthly. Users can t

Indicator v6 Support & resistanceMoving averages Repaints
Updated 12 months ago · None stated GitHub repository of High/Mid/Low of the Previous Month, Week and Day + MA

Pi Cycle Top Indicator

by EngineeredSuccess
3 stars

The Pi Cycle Top Indicator calculates a 111-period simple moving average alongside a scaled 350-period simple moving average to detect potential market cycle highs, historically utilized for Bitcoin analysis. It identifies crossovers between the moving average

Indicator v6 Moving averagesTrend
Updated 1 year ago · Custom licence GitHub repository of Pi Cycle Top Indicator

The Bitcoin Wallet Transaction Volume indicator plots Bitcoin on-chain wallet transaction volume from Quandl BCHAIN/MWTRV in a separate pane. It calculates BWTV and colors volume bars lime when above EMA(periodo)*fator on up days or red on down days. An option

Indicator v4 VolumeMoving averages
Updated 3 years ago · Apache-2.0 GitHub repository of Bitcoin Wallet Transaction Volume (QUANDL:BCHAIN/MWTRV)

This strategy overlays a linear regression channel and two moving averages on the price chart. It uses the regression deviation and optional Supertrend ATR filter to qualify direction, and can enter on a moving-average cross when that option is enabled. Long t

Strategy v5 TrendMoving averages Repaints
Updated 3 years ago · None stated GitHub repository of Fedra Algotrading Strategy Trailing Stop
3 stars

Greeffer's Hedge Mode Study is an indicator that plots multiple EMAs along with Donchian channels directly on the price chart. It calculates EMAs from 8, 17 and 72 periods using higher timeframe data from 240 minutes. The script monitors price action against t

Indicator v5 Moving averagesSupport & resistance
Updated 4 years ago · CC0-1.0 GitHub repository of Greeffer's Hedge Mode Study
3 stars

The Moving Averages Crossover Bot calculates two configurable moving averages directly on the price chart using selectable types such as SMA, EMA, WMA, RMA, HMA, DEMA, or TEMA. It identifies signals when the first moving average crosses above or below the seco

Strategy v4 Moving averagesTrend Repaints
Updated 5 years ago · None stated GitHub repository of Moving Averages Crossover Bot

QQQ 1min Pure Runner

by yalili8521
2 stars

This intraday strategy enters long or short positions on 1-minute charts of QQQ based on a triple moving average stack. It filters entries by requiring an accumulation or distribution sequence of consecutive rising or falling bars while rejecting bars exceedin

Strategy v6 TrendMoving averages
Updated 9 days ago · None stated GitHub repository of QQQ 1min Pure Runner

3x MA = Moving Average

by piecioshka
2 stars

The 3x MA indicator plots three moving averages on the price chart: a short-term, medium-term, and long-term average. Users can customize the period lengths, the type of moving average (including SMA, EMA, WMA, VWMA, and RMA), and the colors for each. Optional

Indicator v6 Moving averagesTrend
Updated 12 days ago · MIT GitHub repository of 3x MA = Moving Average

MA Spectrum 7

by vtnhqw
2 stars

MA Spectrum 7 plots up to seven configurable moving averages directly on the price chart across two distinct groupings. The faster tier calculates 20, 50, 100, and 200-period averages using a selectable calculation method, including SMA, EMA, RMA, WMA, and VWM

Indicator v6 Moving averagesTrend
Updated 12 days ago · None stated GitHub repository of MA Spectrum 7

Sukepoyo Sub

by Pesci1134
2 stars

This indicator plots two ZigZag lines and five EMAs on the price chart. ZigZag 1 uses depth 12, deviation 5 and backstep 3 for the main trend. ZigZag 2 uses depth 5, deviation 3 and backstep 2 for the fast trend. Five EMAs with lengths 20, 30, 40, 75 and 200 a

Indicator v6 Moving averagesTrend
Updated 2 weeks ago · None stated GitHub repository of Sukepoyo Sub

Calculates Gaussian kernel moving averages adjusted by directional price alignment and normalized by ATR. The indicator applies fast and slow smoothing lengths with custom kernel bandwidth and directional weighting settings to smooth price action while minimiz

Indicator v6 TrendMoving averages
Updated 2 weeks ago · MIT GitHub repository of Directional Kernel Filter [BackQuant]

Algo

by TamTH-Dev
2 stars

Algo is an overlay indicator that combines Deviation Scaled Moving Averages (DSMA), multi-layer Ripster exponential moving average clouds, and ATR-based trading levels on the price chart. It calculates adaptive DSMA lines alongside five configurable EMA pairs

Indicator v6 Moving averagesTrend Repaints
Updated 6 weeks ago · None stated GitHub repository of Algo

Basic Usage Examples

by danielbodnar
2 stars

Demonstrates fundamental Pine Script v6 syntax and built-in technical analysis functions as a reference snippet. It calculates and plots simple and exponential moving averages, Bollinger Bands fills, and visual shapes for price crossovers against the moving av

Indicator v6 Moving averages
Updated 2 months ago · MIT GitHub repository of Basic Usage Examples

ALERTATRON-KSM DEMATRON 2H

by danielvm-git
2 stars

This strategy plots three DEMA lines on the price chart for trend analysis. It generates buy and sell signals on DEMA crossovers between the first and second DEMA (or third DEMA when enabled) with optional trailing stop, stop loss, and take profit levels. The

Strategy v4 TrendMoving averages
Updated 2 months ago · MIT GitHub repository of ALERTATRON-KSM DEMATRON 2H
2 stars

This indicator plots two customizable moving averages on the price chart: a fast MA and a slow MA. Users can select from SMA, EMA, WMA and other types, with source options such as close. It fills the area between the lines with color based on which MA is above

Indicator v6 Moving averages
Updated 3 months ago · Apache-2.0 GitHub repository of Dual Moving Average Ribbon
2 stars

Implements a strategy combining Oliver Kell's Cycle of Price Action with Mark Minervini's Volatility Contraction Pattern (VCP). It identifies breakout setups such as wedge pops and EMA crossbacks aligned with EMA 10/20/50/200 and an optional Minervini Trend Te

Strategy v6 TrendBreakout
Updated 3 months ago · Custom licence GitHub repository of Kell + Minervini VCP Backtest
2 stars

This trend-following strategy for XAUUSD checks alignment across three Simple Moving Averages (20, 50, and 200) calculated on closed bars. It enters long when price and all three SMAs are stacked in ascending order, and enters short when stacked in descending

Strategy v6 TrendMoving averages
Updated 4 months ago · None stated GitHub repository of XAUUSD Dollar Trader Martingale

This indicator calculates grid range boundaries for the Grid Bot system using two moving averages. It supports nine different moving average types, including SMA, EMA, HMA, DEMA, TEMA, and ZLEMA, across customizable fast and slow periods. Users can configure d

Indicator v6 Moving averagesSupport & resistance Repaints
Updated 8 months ago · MIT GitHub repository of Grid Bot [Grid Range Plugin] Two Moving Averages

This breakout strategy uses dynamic moving averages plotted on the price chart for MA10, MA50, MA100, and MA200 based on user selections. It generates entry signals on breakouts that exceed a volume multiplier, with optional requirements for gaps or strong can

Strategy v6 Moving averagesBreakout Repaints
Updated 10 months ago · MIT GitHub repository of Ede – MA + Breakout Strategie (Dynamic MAs)

QQE + AK Trend + EFI

by realanthonyc
2 stars

This Pine Script indicator combines QQE, AK Trend, and EFI indicators. It calculates the QQE using RSI with smoothing and displays it as a histogram in a separate pane. The AK Trend line is formed by two exponential moving averages whose scale adjusts accordin

Indicator v6 Oscillators & momentumTrend
Updated 11 months ago · MPL-2.0 GitHub repository of QQE + AK Trend + EFI
2 stars

This strategy is written for Bitcoin and draws on the price chart. It combines moving averages, an SSL channel, ADX, RSI, stochastic, and a volume oscillator with high-volume thresholds to generate buy and sell signals. Users can limit testing to a date range

Strategy v5 TrendOscillators & momentum
Updated 1 year ago · None stated GitHub repository of TLC_STRATEGY_EMARSIADX for BTC
2 stars

Multi-Indicator Trading System plots 50-period and 200-period exponential moving averages alongside buy and sell signals directly on the price chart. Signals trigger when a short-timeframe EMA crossover aligns with higher timeframe trend filters from 1-hour or

Indicator v5 TrendMoving averages Repaints
Updated 1 year ago · MIT GitHub repository of Multi-Indicator Trading System

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