1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
126 lines of Pine Script v5 from MovingAverage.pinescript, published under MIT. Keep the author's credit and licence lines when you reuse it.
MovingAverage.pinescript
//@version=5
//=============================================================================================
// Creator: Woverine
//
// Source Code: https://github.com/RyKaj/PineScript/tree/main
//
// Purpose:
// Ability to toggle and customize colour display
// - SMA 20, 50, 100, 200, 500
// - ESMA 20, 50, 100, 200, 500
// - Golden Cross (SMA 50 & 200 )
// - Death Cross (SMA 50 & 200 )
// - SMA Trendline
// - EMA Trendline
//
//=============================================================================================
indicator(title='Wonverine - Lines', shorttitle='MA', overlay=true)
// Plot colors
// https://chir.ag/projects/name-that-color/#6195ED
// https://kodify.net/tradingview/colours/basic-colours/
// color colorAquaIsland = #B2DFDB
// color colorAzureRadiance = #0094ff
// color colorBlack = #363A45
color colorBlazeOrange = #ff6a00
color colorBlue = #2196F3
color colorBlueChill = #088A8D
// color colorBlushPink = #fd7fe6
// color colorBurntSienna = #EF5350
// color colorCandelLight = #FCD917
color colorCoral = #FF7F50
// color colorCyan = #17FFFF
color colorDeathCross = #e32636
// color colorFreshEggplant = #800080
color colorFruitSalad = #4CAF50
color colorGoldenCross = #61ed77
// color colorGoldenCross = #61ed77
// color colorJapaneseLaurel = #008000
// color colorGreen = #4CAF50
color colorJungleGreen = #39ff14
// color colorKeyLimePie = #BCBB26
color colorLilacBush = #9575cd
// color colorLime = #00E676
// color colorParsley = #0E4813
// color colorPastelPink = #FFCDD2
// color colorPurple = #9C27B0
color colorRed = #FF5252
// color colorRobinEggBlue = #00C9C9
color colorRoseBudCherry = #880e4f
// color colorRusticRed = #4E0404
color colorSaratoga = #505010
// color colorSpringGreen = #00E676
// color colorStarship = #F2F131
// color colorTamarillo = #991515
// color colorTeal = #00897B
// color colorTealBlue = #055355
// color colorTrendyGreen = #86851b
// color colorWhite = #FFFFFF
color colorYellow = #ffff00
// Durations
int days20 = 20
int days50 = 50
int days100 = 100
int days200 = 200
int days500 = 500
// Simple Moving Average
float sma20 = ta.sma( close, days20 )
float sma50 = ta.sma( close, days50 )
float sma100 = ta.sma( close, days100 )
float sma200 = ta.sma( close, days200 )
float sma500 = ta.sma( close, days500 )
// Expodental Moving Average
float ema20 = ta.ema( close, days20 )
float ema50 = ta.ema( close, days50 )
float ema100 = ta.ema( close, days100 )
float ema200 = ta.ema( close, days200 )
float ema500 = ta.ema( close, days500 )
plot( sma20, color=color.new( colorFruitSalad, transp=0 ), title='SMA(20)' )
plot( sma50, color=color.new( colorYellow, transp=0 ), title='SMA(50)' )
plot( sma100, color=color.new( colorBlueChill, transp=0 ), title='SMA(100)' )
plot( sma200, color=color.new( colorRed, transp=0 ), title='SMA(200)' )
plot( sma500, color=color.new( colorRoseBudCherry, transp=0 ), title='SMA(500)' )
plot( ema20, color=color.new( colorBlueChill, transp=0 ), title='EMA20' )
plot( ema50, color=color.new( colorBlazeOrange, transp=0 ), title='EMA50' )
plot( ema100, color=color.new( colorLilacBush, transp=0 ), title='EMA100' )
plot( ema200, color=color.new( colorSaratoga, transp=0 ), title='EMA200' )
plot( ema500, color=color.new( colorCoral, transp=0 ), title='EMA500' )
//--------------------------------------------------------------------------------
// SMA Cross
//--------------------------------------------------------------------------------
// Golden Cross
plot( ta.crossover( sma50, sma200 ) ? sma200 : na, title='SMA Golden Cross', style=plot.style_cross, color=color.new( colorGoldenCross, transp=0 ), linewidth=5 )
// Death Cross
plot( ta.crossover( sma200, sma50 ) ? sma50 : na, title='SMA Death Cross', style=plot.style_cross, color=color.new( colorDeathCross, transp=0 ), linewidth=5 )
//--------------------------------------------------------------------------------
// EMA Death Cross
//--------------------------------------------------------------------------------
// Golden Cross
plot( ta.crossover( ema50, ema200 ) ? ema200 : na, title='EMA Golden Cross', style=plot.style_cross, color=color.new( colorGoldenCross, transp=0 ), linewidth=5 )
// Death Cross
plot( ta.crossover( ema200, ema50 ) ? ema50 : na, title='EMA Death Cross', style=plot.style_cross, color=color.new( colorDeathCross, transp=0 ), linewidth=5 )
//--------------------------------------------------------------------------------
// Trend color ema
// ema trend direction trigger For Singals 1 & 2
//--------------------------------------------------------------------------------
var smaPlot = input( true, title='Show SMA on chart' )
float smaLength = ta.sma( close, input.int( 8, minval=1, title='SMA Length' ) )
color smaColor = smaLength > smaLength[1] ? colorJungleGreen : smaLength < smaLength[1] ? colorRed : colorBlue
plot( smaLength and smaPlot ? smaLength : na, title='SMA Trend', color=smaColor, linewidth=1 )
var emaPlot = input( true, title='Show EMA on chart' )
float emaLength = ta.ema( close, input.int(8, minval=1, title='EMA Length' ) )
color emaColor = emaLength > emaLength[1] ? colorJungleGreen : emaLength < emaLength[1] ? colorRed : colorBlue
plot( emaLength and emaPlot ? emaLength : na, title='EMA Trend', color=emaColor, linewidth=1 )
Overview
Wonverine - Lines features predefined periods including 20, 50, 100, 200, and 500 bars to help identify short-term, medium-term, and long-term trend direction and potential dynamic support or resistance levels. Users can customize the visibility and color schemes of the moving average lines through the indicator inputs.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Show SMA on chart
bool
true
smaPlot
SMA Length
int
8
SMA Length
Show EMA on chart
bool
true
emaPlot
EMA Length
int
8
EMA Length
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
The Adaptive Laguerre Filter calculates a smoothed, dynamically adjusted trendline plotted directly on the main price chart. It dynamically adjusts its damping factor (alpha) based on recent price range variations and median percentile calculations over a spec
This script plots three moving averages on the price chart: a fast EMA or SMA with 10 periods, a slow EMA or SMA with 20 periods, and a trend EMA or SMA with 100 periods. It signals trend changes by drawing a white cross when the fast moving average crosses ab
This indicator plots four customizable moving averages directly on the main price chart using default lengths of 3, 8, 21, and 50 periods. It fills the space between adjacent averages in green or maroon depending on trend alignment. Additionally, it computes B
This indicator plots three exponential moving averages and ATR volatility envelopes on the price chart. It compares the fast and slow EMAs to shade a trend ribbon and marks confirmed upward and downward crossovers with triangle labels. Settings change the thre
Donald SPX - Options Trading is an overlay indicator designed for intraday SPX analysis. It plots a 200-period Weighted Moving Average (WMA) on the price chart while evaluating multi-timeframe market structure across Daily, 15-minute, 5-minute, and 2-minute ba
This indicator computes moving average and RSI bias signals across the current timeframe and four higher timeframes. It sums biases from the MA and RSI to derive an overall bullish or bearish signal. The results appear in a configurable table that displays eac