Indicator · Pine Script v6 · On the chart

EMA / SMA MP

by midngtpickle· code credited to midnight pickle

This indicator plots six exponential moving averages, three simple moving averages, and a session volume-weighted average price directly on the price chart.

View on GitHub

GitHub stars2on the repository
Pine versionv6current
Lines of code145
Settings40inputs
LicenceCustom licencefile: MPL-2.0
Last update4 weeks ago27 Sep 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

145 lines of Pine Script v6 from individual_scripts/ema_sma_.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

ema_sma_.pine
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © midnight pickle
//
// ============================================================================
//  EMA / SMA MP
//  Six EMAs, three SMAs, VWAP, and golden/death cross labels for both.
//
//  Split out of "EMA & PVSR Master". Logic unchanged. This script is now a
//  native overlay, so the force_overlay=true arguments that the plots needed
//  while living in the volume pane have been removed — plots land on the price
//  chart directly.
// ============================================================================

//@version=6
indicator("EMA / SMA MP", shorttitle="EMA/SMA MP", overlay=true)

// ==========================================
// 🔹 MASTER TOGGLE - QUICK ACCESS
// ==========================================

master_show_ema       = input.bool(true,  title="🔘 MASTER: Show EMAs",            group="⚡ MASTER TOGGLES", tooltip="Master toggle for all EMAs")
master_show_ema_cross = input.bool(true,  title="🔘 MASTER: Show EMA Cross Labels", group="⚡ MASTER TOGGLES", tooltip="Master toggle for EMA crossover labels")
master_show_sma       = input.bool(true,  title="🔘 MASTER: Show SMAs",            group="⚡ MASTER TOGGLES", tooltip="Master toggle for all SMAs")
master_show_sma_cross = input.bool(true,  title="🔘 MASTER: Show SMA Cross Labels", group="⚡ MASTER TOGGLES", tooltip="Master toggle for SMA crossover labels")
master_show_vwap      = input.bool(true,  title="🔘 MASTER: Show VWAP",            group="⚡ MASTER TOGGLES", tooltip="Master toggle for VWAP")

// ==========================================
// 🔹 INPUT MENU - EMA/SMA/VWAP SECTION
// ==========================================

// --- EMA Individual Settings ---
show_ema1 = input.bool(true, title="Show EMA 1", inline="e1", group="📈 EMA Settings")
len_ema1  = input.int(10,  title="", inline="e1", group="📈 EMA Settings")
col_ema1  = input.color(color.orange, title="", inline="e1", group="📈 EMA Settings")

show_ema2 = input.bool(true, title="Show EMA 2", inline="e2", group="📈 EMA Settings")
len_ema2  = input.int(21,  title="", inline="e2", group="📈 EMA Settings")
col_ema2  = input.color(color.green,  title="", inline="e2", group="📈 EMA Settings")

show_ema3 = input.bool(true, title="Show EMA 3", inline="e3", group="📈 EMA Settings")
len_ema3  = input.int(50,  title="", inline="e3", group="📈 EMA Settings")
col_ema3  = input.color(color.blue,   title="", inline="e3", group="📈 EMA Settings")

show_ema4 = input.bool(true, title="Show EMA 4", inline="e4", group="📈 EMA Settings")
len_ema4  = input.int(100, title="", inline="e4", group="📈 EMA Settings")
col_ema4  = input.color(color.gray,   title="", inline="e4", group="📈 EMA Settings")

show_ema5 = input.bool(true, title="Show EMA 5", inline="e5", group="📈 EMA Settings")
len_ema5  = input.int(200, title="", inline="e5", group="📈 EMA Settings")
col_ema5  = input.color(color.purple, title="", inline="e5", group="📈 EMA Settings")

show_ema6 = input.bool(true, title="Show EMA 6", inline="e6", group="📈 EMA Settings")
len_ema6  = input.int(800, title="", inline="e6", group="📈 EMA Settings")
col_ema6  = input.color(color.red,    title="", inline="e6", group="📈 EMA Settings")

// --- EMA Crossover Settings ---
show_ema_cross_labels = input.bool(true, title="Show EMA Cross Labels", group="🔄 EMA Crossover Settings")
len_ema_cross_fast    = input.int(9,  title="Fast Length", group="🔄 EMA Crossover Settings")
len_ema_cross_slow    = input.int(21, title="Slow Length", group="🔄 EMA Crossover Settings")

// --- SMA Individual Settings ---
show_sma1 = input.bool(true, title="Show SMA 1", inline="s1", group="📊 SMA Settings")
len_sma1  = input.int(50,  title="", inline="s1", group="📊 SMA Settings")
col_sma1  = input.color(color.purple,  title="", inline="s1", group="📊 SMA Settings")

show_sma2 = input.bool(true, title="Show SMA 2", inline="s2", group="📊 SMA Settings")
len_sma2  = input.int(100, title="", inline="s2", group="📊 SMA Settings")
col_sma2  = input.color(color.fuchsia, title="", inline="s2", group="📊 SMA Settings")

show_sma3 = input.bool(true, title="Show SMA 3", inline="s3", group="📊 SMA Settings")
len_sma3  = input.int(200, title="", inline="s3", group="📊 SMA Settings")
col_sma3  = input.color(color.navy,    title="", inline="s3", group="📊 SMA Settings")

// --- SMA Crossover Settings ---
show_sma_cross_labels = input.bool(true, title="Show SMA Cross Labels", group="🔄 SMA Crossover Settings")
len_sma_cross_fast    = input.int(50,  title="Fast Length", group="🔄 SMA Crossover Settings")
len_sma_cross_slow    = input.int(200, title="Slow Length", group="🔄 SMA Crossover Settings")

// --- VWAP Settings ---
show_vwap = input.bool(true, title="Show VWAP", group="📉 VWAP Settings")
col_vwap  = input.color(color.orange, title="VWAP Color", group="📉 VWAP Settings")
wid_vwap  = input.int(2, title="VWAP Width", minval=1, group="📉 VWAP Settings")

// ==========================================
// 🔹 CALCULATIONS - EMA/SMA/VWAP
// ==========================================

ema1 = ta.ema(close, len_ema1)
ema2 = ta.ema(close, len_ema2)
ema3 = ta.ema(close, len_ema3)
ema4 = ta.ema(close, len_ema4)
ema5 = ta.ema(close, len_ema5)
ema6 = ta.ema(close, len_ema6)

ema_c_fast = ta.ema(close, len_ema_cross_fast)
ema_c_slow = ta.ema(close, len_ema_cross_slow)
ema_golden = ta.crossover(ema_c_fast, ema_c_slow)
ema_death  = ta.crossunder(ema_c_fast, ema_c_slow)

sma1 = ta.sma(close, len_sma1)
sma2 = ta.sma(close, len_sma2)
sma3 = ta.sma(close, len_sma3)

sma_c_fast   = ta.sma(close, len_sma_cross_fast)
sma_c_slow   = ta.sma(close, len_sma_cross_slow)
golden_cross = ta.crossover(sma_c_fast, sma_c_slow)
death_cross  = ta.crossunder(sma_c_fast, sma_c_slow)

vwap_value = ta.vwap(close)

// ==========================================
// 🔹 PLOTTING
// ==========================================

plot(master_show_ema and show_ema1 ? ema1 : na, title='EMA 1 (10)',  color=col_ema1, linewidth=1)
plot(master_show_ema and show_ema2 ? ema2 : na, title='EMA 2 (21)',  color=col_ema2, linewidth=1)
plot(master_show_ema and show_ema3 ? ema3 : na, title='EMA 3 (50)',  color=col_ema3, linewidth=1)
plot(master_show_ema and show_ema4 ? ema4 : na, title='EMA 4 (100)', color=col_ema4, linewidth=1)
plot(master_show_ema and show_ema5 ? ema5 : na, title='EMA 5 (200)', color=col_ema5, linewidth=1)
plot(master_show_ema and show_ema6 ? ema6 : na, title='EMA 6 (800)', color=col_ema6, linewidth=1)

plot(master_show_sma and show_sma1 ? sma1 : na, title='SMA 1 (50)',  color=col_sma1, linewidth=2)
plot(master_show_sma and show_sma2 ? sma2 : na, title='SMA 2 (100)', color=col_sma2, linewidth=2)
plot(master_show_sma and show_sma3 ? sma3 : na, title='SMA 3 (200)', color=col_sma3, linewidth=2)

plot(master_show_vwap and show_vwap ? vwap_value : na, title="VWAP", color=col_vwap, linewidth=wid_vwap)

plotshape(master_show_sma_cross and show_sma_cross_labels and golden_cross, title='SMA Golden Cross', style=shape.triangleup,
         location=location.belowbar, color=color.green, text='SMA GOLD', textcolor=color.rgb(255, 255, 255), size=size.small)
plotshape(master_show_sma_cross and show_sma_cross_labels and death_cross, title='SMA Death Cross', style=shape.triangledown,
         location=location.abovebar, color=color.red, text='SMA DEATH', textcolor=color.white, size=size.small)
plotshape(master_show_ema_cross and show_ema_cross_labels and ema_golden, title='EMA Golden Cross', style=shape.triangleup,
         location=location.belowbar, color=color.green, text='EMA GOLD', textcolor=color.rgb(255, 255, 255), size=size.small)
plotshape(master_show_ema_cross and show_ema_cross_labels and ema_death, title='EMA Death Cross', style=shape.triangledown,
         location=location.abovebar, color=color.red, text='EMA DEATH', textcolor=color.white, size=size.small)

// ==========================================
// 🔹 ALERTS
// ==========================================

alertcondition(ema_golden, title="EMA Golden Cross", message="EMA Bullish Cross")
alertcondition(ema_death,  title="EMA Death Cross",  message="EMA Bearish Cross")
alertcondition(golden_cross, title="SMA Golden Cross", message="SMA Bullish Cross")
alertcondition(death_cross,  title="SMA Death Cross",  message="SMA Bearish Cross")
alertcondition(ta.cross(close, vwap_value), title="Price Cross VWAP", message="Price crossed VWAP")

Overview

EMA / SMA MP signals through chart labels triggered by moving average crossovers, including fast and slow exponential moving average crosses and simple moving average crosses. Master toggles and individual inputs allow users to adjust lengths, visibility, and colors for each moving average line. As an analytical overlay, the script provides visual trend cues without trade execution, stop loss parameters, or exit logic.

Details

Published by

midngtpickle on GitHub

Code credit

midnight pickle, as written in the script's header

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Moving averages, Trend

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
🔘 MASTER: Show EMAsbooltruemaster_show_ema
🔘 MASTER: Show EMA Cross Labelsbooltruemaster_show_ema_cross
🔘 MASTER: Show SMAsbooltruemaster_show_sma
🔘 MASTER: Show SMA Cross Labelsbooltruemaster_show_sma_cross
🔘 MASTER: Show VWAPbooltruemaster_show_vwap
Show EMA 1booltrueshow_ema1
len_ema1int10len_ema1
col_ema1colorcolor.orangecol_ema1
Show EMA 2booltrueshow_ema2
len_ema2int21len_ema2
col_ema2colorcolor.greencol_ema2
Show EMA 3booltrueshow_ema3
Show all 40 settings
SettingTypeDefaultVariable
len_ema3int50len_ema3
col_ema3colorcolor.bluecol_ema3
Show EMA 4booltrueshow_ema4
len_ema4int100len_ema4
col_ema4colorcolor.graycol_ema4
Show EMA 5booltrueshow_ema5
len_ema5int200len_ema5
col_ema5colorcolor.purplecol_ema5
Show EMA 6booltrueshow_ema6
len_ema6int800len_ema6
col_ema6colorcolor.redcol_ema6
Show EMA Cross Labelsbooltrueshow_ema_cross_labels
Fast Lengthint9len_ema_cross_fast
Slow Lengthint21len_ema_cross_slow
Show SMA 1booltrueshow_sma1
len_sma1int50len_sma1
col_sma1colorcolor.purplecol_sma1
Show SMA 2booltrueshow_sma2
len_sma2int100len_sma2
col_sma2colorcolor.fuchsiacol_sma2
Show SMA 3booltrueshow_sma3
len_sma3int200len_sma3
col_sma3colorcolor.navycol_sma3
Show SMA Cross Labelsbooltrueshow_sma_cross_labels
Fast Lengthint50len_sma_cross_fast
Slow Lengthint200len_sma_cross_slow
Show VWAPbooltrueshow_vwap
VWAP Colorcolorcolor.orangecol_vwap
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.

Similar Pine Scripts

948 stars

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

Indicator v4 TrendMoving averages
Updated 10 days ago · GPL-3.0 GitHub repository of Adaptive Laguerre Filter
330 stars

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

Indicator v4 TrendMoving averages
Updated 2 months ago · None stated GitHub repository of 3 EMA/SMA + Cross [Alorse]
318 stars

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

Indicator v5 Moving averagesTrend
Updated 2 months ago · MIT GitHub repository of Multiple Moving Averages

NVDA Trend Ribbon

by longsurf-ai
277 stars

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

Indicator v6 TrendMoving averages
Updated yesterday · MIT GitHub repository of NVDA Trend Ribbon
257 stars

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

Indicator v5 Moving averagesTrend Repaints
Updated 6 weeks ago · None stated GitHub repository of Donald SPX - Options Trading

60K均線

by TaichiS
219 stars

This multi-timeframe indicator calculates and plots 20-period and 60-period simple moving averages from the 60-minute timeframe directly onto the price chart. The 20-period average displays as a green line, while the 60-period average appears in blue. It serve

Indicator v4 Moving averagesTrend Repaints
Updated 5 years ago · None stated GitHub repository of 60K均線

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers