OPEN-SOURCE SCRIPT

Momentum Permission + VWAP + RelVol (Clean)

31
//version=5
indicator("Momentum Permission + VWAP + RelVol (Clean)", overlay=true)

// ──────────────────────────────────────────────
// Inputs
// ──────────────────────────────────────────────
smaLength = input.int(50, "SMA Length")
relVolThresh = input.float(1.3, "Relative Volume Threshold")

// ──────────────────────────────────────────────
// Core Calculations
// ──────────────────────────────────────────────
sma50 = ta.sma(close, smaLength)
vwap = ta.vwap(close)
relVol = volume / ta.sma(volume, 10)
crossUp = ta.crossover(close, sma50)

// Trend conditions
aboveSMA = close > sma50
aboveVWAP = close > vwap
relStrong = relVol > relVolThresh

// ──────────────────────────────────────────────
// One-Time Daily Trend Permission Logic
// ──────────────────────────────────────────────
var bool permission = false

// Reset permission at start of each session
if ta.change(time("D"))
permission := false

trendStart = crossUp and aboveVWAP and relStrong and not permission

if trendStart
permission := true

// ──────────────────────────────────────────────
// Entry Trigger Logic (Breakout Continuation)
// ──────────────────────────────────────────────
entryTrigger = (
permission and
aboveSMA and
aboveVWAP and
relStrong and
close > high[1] // breakout of prior candle high
)

// ──────────────────────────────────────────────
// Plots
// ──────────────────────────────────────────────

// Trend filters
plot(sma50, title="SMA50", color=color.orange, linewidth=2)
plot(vwap, title="VWAP", color=color.new(color.blue, 0), linewidth=2)

// Permission (one-time trend start)
plotshape(
trendStart,
title="Trend Permission",
style=shape.triangleup,
location=location.belowbar,
color=color.new(color.green, 0),
size=size.large,
text="PERMIT"
)

// Entry trigger (continuation entry)
plotshape(
entryTrigger,
title="Entry Trigger",
style=shape.triangleup,
location=location.abovebar,
color=color.new(color.aqua, 0),
size=size.normal,
text="ENTRY"
)

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.