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"
)

Thông báo miễn trừ trách nhiệm

Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.