Indicator · Pine Script v6 · On the chart

The Quant Lady · Golden Cross (Ep 1 / Ep 3 rules)

by thequantlady

This indicator plots fast and slow Simple Moving Averages to identify Golden Cross and Death Cross signals directly on the price chart.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code64
Settings12inputs
LicenceMIT
Last update2 weeks ago7 Nov 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

64 lines of Pine Script v6 from indicators/QuantLady_GoldenCross.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

QuantLady_GoldenCross.pine
// MIT License · © The Quant Lady
// Education only. Not investment advice. No buy/sell recommendations.
//
// Golden Cross with the exact rules tested on The Quant Lady channel:
//   Episode 1 (daily):  50/200 SMA cross + volume, 52-week-high, liquidity and price filters
//   Episode 3 (weekly): 10/40-week SMA cross with the same filters on weekly bars
// The Episode 2 ROC study is a separate script: QuantLady_ROC.pine

//@version=6
indicator("The Quant Lady · Golden Cross (Ep 1 / Ep 3 rules)", shorttitle = "QL Golden Cross", overlay = true)

// ---------- Inputs ----------
preset      = input.string("Daily · Ep 1", "Preset", options = ["Daily · Ep 1", "Weekly · Ep 3", "Custom"],
     tooltip = "Daily · Ep 1 = 50/200 on a DAILY chart. Weekly · Ep 3 = 10/40 on a WEEKLY chart. Custom = use the values below.")
useFilters  = input.bool(true, "Apply channel filters", tooltip = "Volume, near 52-week high, liquidity and minimum price")
fastIn      = input.int(50, "Custom · fast SMA length", minval = 1, group = "Custom values")
slowIn      = input.int(200, "Custom · slow SMA length", minval = 2, group = "Custom values")
volLenIn    = input.int(20, "Custom · volume average length (bars)", minval = 1, group = "Custom values")
hiLenIn     = input.int(250, "Custom · high lookback (bars)", minval = 1, group = "Custom values")
liqLenIn    = input.int(50, "Custom · median turnover/price length (bars)", minval = 1, group = "Custom values")
minTurnIn   = input.float(50, "Custom · min median turnover per bar (₹ lakh)", minval = 0, group = "Custom values")
volMult     = input.float(1.2, "Volume must be above × average", minval = 0, group = "Filters")
nearHiPct   = input.float(30, "Close within % of the high", minval = 0, maxval = 100, group = "Filters")
minPrice    = input.float(20, "Min median price (₹)", minval = 0, group = "Filters")
showFiltered = input.bool(true, "Show crosses that failed the filters (grey dots)", group = "Display")

isDaily  = preset == "Daily · Ep 1"
isWeekly = preset == "Weekly · Ep 3"
fastLen  = isDaily ? 50  : isWeekly ? 10  : fastIn
slowLen  = isDaily ? 200 : isWeekly ? 40  : slowIn
volLen   = isDaily ? 20  : isWeekly ? 4   : volLenIn
hiLen    = isDaily ? 250 : isWeekly ? 52  : hiLenIn
liqLen   = isDaily ? 50  : isWeekly ? 10  : liqLenIn
minTurn  = isDaily ? 50.0 : isWeekly ? 250.0 : minTurnIn   // weekly turnover ≈ 5 × daily

// ---------- Logic ----------
fast = ta.sma(close, fastLen)
slow = ta.sma(close, slowLen)
goldenCross = ta.crossover(fast, slow)
deathCross  = ta.crossunder(fast, slow)

volOK   = volume > volMult * ta.sma(volume, volLen)
nearHi  = close >= (1 - nearHiPct / 100) * ta.highest(high, hiLen)
liqOK   = ta.median(close * volume, liqLen) >= minTurn * 1e5
priceOK = ta.median(close, liqLen) >= minPrice
passes  = not useFilters or (volOK and nearHi and liqOK and priceOK)

buySignal = goldenCross and passes

// ---------- Plots ----------
plot(fast, "Fast SMA", color = color.new(#f6c453, 0), linewidth = 2)
plot(slow, "Slow SMA", color = color.new(#6aa8ff, 0), linewidth = 2)
plotshape(buySignal, "Golden cross (passes filters)", shape.triangleup, location.belowbar, color.new(#26d68c, 0), size = size.small, text = "GC", textcolor = color.new(#26d68c, 0))
plotshape(showFiltered and goldenCross and not passes, "Golden cross (filtered out)", shape.circle, location.belowbar, color.new(color.gray, 20), size = size.tiny)
plotshape(deathCross, "Death cross (exit)", shape.triangledown, location.abovebar, color.new(#ff4f6d, 0), size = size.small, text = "DC", textcolor = color.new(#ff4f6d, 0))

// Gentle reminder when the preset does not match the chart timeframe
var label warn = na
if barstate.islast
    wrongTf = (isDaily and not timeframe.isdaily) or (isWeekly and not timeframe.isweekly)
    label.delete(warn)
    if wrongTf
        warn := label.new(bar_index, high, isDaily ? "Preset is Daily · switch chart to 1D" : "Preset is Weekly · switch chart to 1W",
             style = label.style_label_down, color = color.new(#0a1430, 0), textcolor = color.new(#f6c453, 0), size = size.small)

Overview

The Quant Lady · Golden Cross (Ep 1 / Ep 3 rules) features built-in presets for daily (50/200 SMA) and weekly (10/40 SMA) timeframes alongside customizable moving average periods. An optional filtering system evaluates volume spikes, proximity to multi-period highs, minimum price thresholds, and median turnover to confirm signals. Valid Golden Crosses display green triangle labels, Death Crosses mark exits, and filtered-out crosses optionally render as grey dots.

Details

Published by

thequantlady on GitHub

Draws

On the price chart

Markets

Stocks

Timeframes

H4 and above, M15-H1

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
PresetstringDaily · Ep 1preset
Apply channel filtersbooltrueuseFilters
Custom · fast SMA lengthint50fastIn
Custom · slow SMA lengthint200slowIn
Custom · volume average length (bars)int20volLenIn
Custom · high lookback (bars)int250hiLenIn
Custom · median turnover/price length (bars)int50liqLenIn
Custom · min median turnover per bar (₹ lakh)float50minTurnIn
Volume must be above × averagefloat1.2volMult
Close within % of the highfloat30nearHiPct
Min median price (₹)float20minPrice
Show crosses that failed the filters (grey dots)booltrueshowFiltered
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

Adaptive MA Slope

by capissimo
114 stars

This indicator calculates Kaufman's Adaptive Moving Average (KAMA) on a chosen price source and determines trend direction based on the slope across a configurable lookback window. Signals can be filtered by short-term volatility expansion using ATR comparison

Indicator v4 Moving averagesTrend
Updated 2 years ago · None stated GitHub repository of Adaptive MA Slope

Signal Strategy 15m

by tripolskypetr
72 stars

This indicator generates trend-following trade signals on the price chart by combining moving average crossovers with multi-factor filters. It triggers entry alerts when fast and slow EMAs cross in the direction of a baseline trend EMA, confirmed by non-extrem

Indicator v5 TrendMoving averages
Updated 4 weeks ago · MIT GitHub repository of Signal Strategy 15m
46 stars

This overlay indicator plots a SuperTrend using a 10-period ATR with a multiplier of 3, drawing up and down stop lines and a faint trend fill on the price chart. It compares a 9-period EMA with an 18-period EMA and a 12/26/9 MACD against its signal, and it req

Indicator v5 TrendOscillators & momentum
Updated 3 years ago · None stated GitHub repository of SuperTrend + MACD + EMA
34 stars

72s: Adaptive Hull Moving Average+ is an overlay indicator that dynamically adjusts its period length based on volatility or volume changes. When volatility or volume breaks out, the indicator contracts its calculation period for faster response, expanding it

Indicator v4 Moving averagesTrend
Updated 2 weeks ago · MIT GitHub repository of 72s: Adaptive Hull Moving Average+

Bte Acc

by f-cksociety
11 stars

Bte Acc is a chart indicator form of the PineCoders Backtesting and Trading Engine. It seeks an entry trigger from a main or alternate entry method, then checks trade direction, filters, date range, ATR readiness, and remaining capital before filling on the ne

Indicator v5 TrendOscillators & momentum Repaints
Updated 4 years ago · MPL-2.0 GitHub repository of Bte Acc

Signal Forge

by jayadevrana
11 stars

Signal Forge is a multi-filtered trend-following indicator displayed on the main price chart. It calculates an ATR trailing stop line alongside a long-term EMA baseline to identify market direction. Raw signal flips are filtered through ADX chop detection, a v

Indicator v6 TrendVolatility & bands
Updated 4 weeks ago · MPL-2.0 GitHub repository of Signal Forge

More Moving averages scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

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

Compare brokers