Indicator · Pine Script v6 · On the chart

EMA Gold Trader 2026

by alexhb-maker

An overlay for the price chart that plots a 60-period EMA, a 60-period double EMA and a 200-period EMA.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code112
Settings8inputs
LicenceMIT
Last update3 months ago12 Jul 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

112 lines of Pine Script v6 from strategy/ema-gold-trader-2026.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

ema-gold-trader-2026.pine
//@version=6
indicator(
     title             = "EMA Gold Trader 2026",
     shorttitle        = "EMA-GT_26",
     overlay           = true
)

// PARAMETERS
emaPeriod      = input.int  (60,   "EMA Period",              minval=1,            group="Indicators")
demaPeriod     = input.int  (60,   "DEMA Period",             minval=1,            group="Indicators")
ema200Period   = input.int  (200,  "EMA 200 Period",          minval=1,            group="Indicators")
swLookback     = input.int  (10,   "Level lookback",          minval=3, maxval=50, group="Liquidity Sweep")
wickRatio      = input.float(0.55, "Minimum wick ratio",      minval=0.3, maxval=0.9, step=0.05, group="Liquidity Sweep")
sweepBoxBars   = input.int  (8,    "Box duration (bars)",     minval=1,            group="Liquidity Sweep")
showBullSweep  = input.bool (true, "Show bullish sweep",                          group="Liquidity Sweep")
showBearSweep  = input.bool (true, "Show bearish sweep",                          group="Liquidity Sweep")

// INDICATORS
ema  = ta.ema(close, emaPeriod)
ema1 = ta.ema(close, demaPeriod)
dema = 2.0 * ema1 - ta.ema(ema1, demaPeriod)
ema200 = ta.ema(close, ema200Period)

plot(ema,    "EMA",     color=color.new(color.orange, 0), linewidth=2)
plot(dema,   "DEMA",    color=color.new(color.blue,   0), linewidth=2)
plot(ema200, "EMA 200", color=color.new(color.white,  0), linewidth=2)

// BUY SIGNAL — CONSERVATIVE
// Requires: previous close > EMA and previous close > DEMA
buySignal = close[1] > ema[1] and close[1] > dema[1]

// EMA/DEMA CROSS — yellow visual when EMA crosses above DEMA
emaCrossAbove = ema[1] <= dema[1] and ema > dema

// VISUALS — TRIANGLES
// Green: valid BUY entry
plotshape(buySignal,
     title="BUY", style=shape.triangleup, location=location.belowbar,
     color=color.lime, size=size.tiny)

// Yellow: EMA crosses above DEMA (trend confirmation)
plotshape(emaCrossAbove,
     title="EMA > DEMA", style=shape.triangleup, location=location.abovebar,
     color=color.new(color.yellow, 0), size=size.tiny)

// LIQUIDITY SWEEPS
recentLow  = ta.lowest (low,  swLookback)[1]
recentHigh = ta.highest(high, swLookback)[1]
barRange   = high - low

wickLow  = math.min(open, close) - low
bullSweep = showBullSweep and close >= open and low <= recentLow
         and barRange > 0 and wickLow / barRange >= wickRatio

wickHigh  = high - math.max(open, close)
bearSweep = showBearSweep and close <= open and high >= recentHigh
         and barRange > 0 and wickHigh / barRange >= wickRatio

if bullSweep
    box.new(left=bar_index, top=math.max(open,close), right=bar_index+sweepBoxBars, bottom=low,
         border_color=color.new(color.lime,20), bgcolor=color.new(color.lime,82),
         text="Sweep BUY", text_color=color.new(color.lime,0), text_size=size.tiny)

if bearSweep
    box.new(left=bar_index, top=high, right=bar_index+sweepBoxBars, bottom=math.min(open,close),
         border_color=color.new(color.red,20), bgcolor=color.new(color.red,82),
         text="Sweep SELL", text_color=color.new(color.red,0), text_size=size.tiny)

// STATUS TABLE
var table tbl = table.new(position.top_right, 2, 7,
     bgcolor=color.new(color.black,75), border_width=1,
     border_color=color.new(color.gray,60))

if barstate.islast
    table.cell(tbl, 0, 0, "EMA 60", text_color=color.silver, text_size=size.small)
    table.cell(tbl, 1, 0, str.tostring(math.round(ema, 2)), text_color=color.orange, text_size=size.small)

    table.cell(tbl, 0, 1, "DEMA 60", text_color=color.silver, text_size=size.small)
    table.cell(tbl, 1, 1, str.tostring(math.round(dema, 2)), text_color=color.aqua, text_size=size.small)

    table.cell(tbl, 0, 2, "EMA 200", text_color=color.silver, text_size=size.small)
    table.cell(tbl, 1, 2, str.tostring(math.round(ema200, 2)), text_color=color.white, text_size=size.small)

    buyTxt = buySignal ? "YES" : "NO"
    buyCol = buySignal ? color.lime : color.gray
    table.cell(tbl, 0, 3, "BUY Signal", text_color=color.silver, text_size=size.small)
    table.cell(tbl, 1, 3, buyTxt, text_color=buyCol, text_size=size.small)

    sweepTxt = bullSweep ? "BUY zone" : bearSweep ? "SELL zone" : "-"
    sweepCol = bullSweep ? color.lime : bearSweep ? color.red : color.gray
    table.cell(tbl, 0, 4, "Sweep", text_color=color.silver, text_size=size.small)
    table.cell(tbl, 1, 4, sweepTxt, text_color=sweepCol, text_size=size.small)

    crossTxt = emaCrossAbove ? "YES" : "NO"
    crossCol = emaCrossAbove ? color.yellow : color.gray
    table.cell(tbl, 0, 5, "EMA > DEMA", text_color=color.silver, text_size=size.small)
    table.cell(tbl, 1, 5, crossTxt, text_color=crossCol, text_size=size.small)

    table.cell(tbl, 0, 6, "Price", text_color=color.silver, text_size=size.small)
    table.cell(tbl, 1, 6, str.tostring(math.round(close, 2)), text_color=color.aqua, text_size=size.small)

// === SHORT SIGNAL === extra info
sellSignal = close[1] < ema and close[1] < dema

plotshape(sellSignal, title="SELL Signal", location=location.abovebar,
     color=color.red, style=shape.triangledown, size=size.tiny)

// === BEARISH CROSS (EMA crosses below DEMA) ===
bearCross = ta.crossunder(ema, dema)

plotshape(bearCross, title="Bearish Cross", location=location.belowbar,
     color=color.rgb(6, 164, 255), style=shape.triangledown, size=size.small)

Overview

EMA Gold Trader 2026 marks a buy triangle when the previous close sits above both the EMA and the double EMA, and a second triangle when the EMA crosses above the double EMA. It also detects liquidity sweeps, where a candle with a long wick pierces a recent high or low, and draws a labelled box. A status table is shown on the last bar.

Details

Published by

alexhb-maker on GitHub

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Trend, Moving averages, SMC / ICT / price action

Markets

Gold

Timeframes

H4 and above

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.

Topics

algorithmic-trading-quantitativebacktestingbehavioral-financedata-analysisdecision-makingpine-scriptprocess-improvementtradingview-ideas

Settings

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

SettingTypeDefaultVariable
EMA Periodint60emaPeriod
DEMA Periodint60demaPeriod
EMA 200 Periodint200ema200Period
Level lookbackint10swLookback
Minimum wick ratiofloat0.55wickRatio
Box duration (bars)int8sweepBoxBars
Show bullish sweepbooltrueshowBullSweep
Show bearish sweepbooltrueshowBearSweep
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

HH-LL Buy/Sell + EMA

by vinitpatil519
5 stars

This overlay indicator classifies market structure with an ATR-based ZigZag that marks higher highs, higher lows, lower highs, and lower lows. A state machine plots buy and sell labels on the confirmation bar, not on the earlier pivot, and by default waits for

Indicator v5 TrendSupport & resistance
Updated 2 months ago · None stated GitHub repository of HH-LL Buy/Sell + EMA

This technical indicator combines multiple popular analysis tools into a single price chart overlay to optimize chart space. It calculates and plots the complete Ichimoku Cloud, 50 and 200 Simple Moving Averages, and standard Bollinger Bands. Furthermore, it t

Indicator v5 TrendMoving averages Repaints
Updated 3 years ago · None stated GitHub repository of Ichimoku + MAs + Bollinger + Liquidity Zone
4 stars

This indicator computes the Watchtower Axis as a 257-period weighted moving average of closing prices to establish the main trend baseline. It defines volatility gates using the highest high and lowest low over 463 periods, along with a 377-period exponential

Indicator v6 TrendMoving averages
Updated 10 months ago · MIT GitHub repository of Miela Labs | John Dee's Watchtower
3 stars

Identifies continuation trade setups based on Beat the Market Maker (BTMM) second-leg patterns directly on the price chart. It defines trading session phases across Asian, London, and New York sessions, filters impulse legs using fast and slow exponential movi

Indicator v5 SMC / ICT / price actionSessions & time
Updated 1 year ago · None stated GitHub repository of BTMM Second Leg Confirmation

This indicator identifies Smart Money Concepts structure alongside a four-line moving average ribbon on the price chart. It detects swing highs and lows across a user-defined lookback period, generating price action labels such as higher highs, lower highs, hi

Indicator v5 SMC / ICT / price actionSupport & resistance
Updated 1 year ago · None stated GitHub repository of FluidTrades - SMC Lite + Moving Average Ribbon

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