OPEN-SOURCE SCRIPT

Momentum Permission + Pivot Entry + Exit (v1.4)

30
//version=5
indicator("Momentum Permission + Pivot Entry + Exit (v1.4)", overlay=true)

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

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

crossUp = ta.crossover(close, sma50)

aboveSMA = close > sma50
aboveVWAP = close > vwap
relStrong = relVol > relVolThresh
greenCandle = close > open

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

if ta.change(time("D"))
permission := false

trendStart = crossUp and aboveVWAP and relStrong and not permission
if trendStart
permission := true

// ──────────────────────────────────────────────
// Pullback Pivot Breakout Entry (Continuation Long)
// ──────────────────────────────────────────────
pivotHighBreak = close > ta.highest(high[1], pivotLookback)

entryTrigger = (
permission and
aboveSMA and
aboveVWAP and
relStrong and
greenCandle and
pivotHighBreak
)

// ──────────────────────────────────────────────
// EXIT Signal (Trend Exhaustion)
// ──────────────────────────────────────────────
smaChange = sma50 - sma50[1]

exitSignal = (
permission and // only after trend started
close < vwap and // VWAP breakdown
close < open and // red candle body
relVol > relVolThresh and // volume spike on selling
smaChange < 0 // SMA turning down / flattening
)

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

// Permission marker (1 per day)
plotshape(
trendStart,
title="Trend Permission",
style=shape.triangleup,
location=location.belowbar,
color=color.new(color.green, 0),
size=size.large,
text="PERMIT"
)

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

// EXIT marker (trend exhaustion)
plotshape(
exitSignal,
title="Exit Signal",
style=shape.triangledown,
location=location.abovebar,
color=color.new(color.red, 0),
size=size.large,
text="EXIT"
)

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.