OPEN-SOURCE SCRIPT
Momentum Permission + Pivot Entry + Exit (v1.4)

//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"
)
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"
)
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。