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

//version=5
indicator("Momentum Permission + Pivot Entry + Exit (v1.4 FULL)", overlay=true)
// ──────────────────────────────────────────────
// Inputs
// ──────────────────────────────────────────────
smaLength = input.int(50, "SMA Length")
relVolThresh = input.float(1.3, "Relative Volume Threshold")
pivotLookback = input.int(3, "Pivot Lookback Bars")
// ──────────────────────────────────────────────
// Core Calculations
// ──────────────────────────────────────────────
sma50 = ta.sma(close, smaLength)
vwap = ta.vwap(close)
relVol = volume / ta.sma(volume, 10)
aboveSMA = close > sma50
aboveVWAP = close > vwap
relStrong = relVol > relVolThresh
greenCandle = close > open
crossUp = ta.crossover(close, sma50)
// ──────────────────────────────────────────────
// One-Time Daily Permission
// ──────────────────────────────────────────────
var bool permission = false
if ta.change(time("D"))
permission := false
permitSignal = crossUp and aboveVWAP and relStrong and not permission
if permitSignal
permission := true
// ──────────────────────────────────────────────
// Entry: Pivot Break Continuation
// ──────────────────────────────────────────────
pivotHighBreak = close > ta.highest(high[1], pivotLookback)
entrySignal = (
permission and
aboveSMA and
aboveVWAP and
relStrong and
greenCandle and
pivotHighBreak
)
// ──────────────────────────────────────────────
// Exit: Trend Exhaustion / VWAP Breakdown
// ──────────────────────────────────────────────
smaChange = sma50 - sma50[1]
exitSignal = (
permission and
close < vwap and
close < open and
relStrong and
smaChange < 0
)
// ──────────────────────────────────────────────
// VISUAL PLOTS (same as before)
// ──────────────────────────────────────────────
plot(sma50, title="SMA50", color=color.orange, linewidth=2)
plot(vwap, title="VWAP", color=color.new(color.blue, 0), linewidth=2)
plotshape(
permitSignal,
title="Trend Permission",
style=shape.triangleup,
location=location.belowbar,
color=color.new(color.green, 0),
size=size.large,
text="PERMIT"
)
plotshape(
entrySignal,
title="Entry Trigger",
style=shape.triangleup,
location=location.abovebar,
color=color.new(color.aqua, 0),
size=size.normal,
text="ENTRY"
)
plotshape(
exitSignal,
title="Exit Signal",
style=shape.triangledown,
location=location.abovebar,
color=color.new(color.red, 0),
size=size.large,
text="EXIT"
)
// ──────────────────────────────────────────────
// SCREENER OUTPUT (persistent 0/1 for the day)
// ──────────────────────────────────────────────
var bool permitToday = false
var bool entryToday = false
var bool exitToday = false
if ta.change(time("D"))
permitToday := false
entryToday := false
exitToday := false
if permitSignal
permitToday := true
if entrySignal
entryToday := true
if exitSignal
exitToday := true
// Hidden plots for screener columns
plot(permitToday ? 1 : 0, title="PERMIT", display=display.none)
plot(entryToday ? 1 : 0, title="ENTRY", display=display.none)
plot(exitToday ? 1 : 0, title="EXIT", display=display.none)
// Alerts
alertcondition(permitSignal, title="PERMIT", message="Momentum PERMISSION fired")
alertcondition(entrySignal, title="ENTRY", message="Momentum ENTRY fired")
alertcondition(exitSignal, title="EXIT", message="Momentum EXIT fired")
indicator("Momentum Permission + Pivot Entry + Exit (v1.4 FULL)", overlay=true)
// ──────────────────────────────────────────────
// Inputs
// ──────────────────────────────────────────────
smaLength = input.int(50, "SMA Length")
relVolThresh = input.float(1.3, "Relative Volume Threshold")
pivotLookback = input.int(3, "Pivot Lookback Bars")
// ──────────────────────────────────────────────
// Core Calculations
// ──────────────────────────────────────────────
sma50 = ta.sma(close, smaLength)
vwap = ta.vwap(close)
relVol = volume / ta.sma(volume, 10)
aboveSMA = close > sma50
aboveVWAP = close > vwap
relStrong = relVol > relVolThresh
greenCandle = close > open
crossUp = ta.crossover(close, sma50)
// ──────────────────────────────────────────────
// One-Time Daily Permission
// ──────────────────────────────────────────────
var bool permission = false
if ta.change(time("D"))
permission := false
permitSignal = crossUp and aboveVWAP and relStrong and not permission
if permitSignal
permission := true
// ──────────────────────────────────────────────
// Entry: Pivot Break Continuation
// ──────────────────────────────────────────────
pivotHighBreak = close > ta.highest(high[1], pivotLookback)
entrySignal = (
permission and
aboveSMA and
aboveVWAP and
relStrong and
greenCandle and
pivotHighBreak
)
// ──────────────────────────────────────────────
// Exit: Trend Exhaustion / VWAP Breakdown
// ──────────────────────────────────────────────
smaChange = sma50 - sma50[1]
exitSignal = (
permission and
close < vwap and
close < open and
relStrong and
smaChange < 0
)
// ──────────────────────────────────────────────
// VISUAL PLOTS (same as before)
// ──────────────────────────────────────────────
plot(sma50, title="SMA50", color=color.orange, linewidth=2)
plot(vwap, title="VWAP", color=color.new(color.blue, 0), linewidth=2)
plotshape(
permitSignal,
title="Trend Permission",
style=shape.triangleup,
location=location.belowbar,
color=color.new(color.green, 0),
size=size.large,
text="PERMIT"
)
plotshape(
entrySignal,
title="Entry Trigger",
style=shape.triangleup,
location=location.abovebar,
color=color.new(color.aqua, 0),
size=size.normal,
text="ENTRY"
)
plotshape(
exitSignal,
title="Exit Signal",
style=shape.triangledown,
location=location.abovebar,
color=color.new(color.red, 0),
size=size.large,
text="EXIT"
)
// ──────────────────────────────────────────────
// SCREENER OUTPUT (persistent 0/1 for the day)
// ──────────────────────────────────────────────
var bool permitToday = false
var bool entryToday = false
var bool exitToday = false
if ta.change(time("D"))
permitToday := false
entryToday := false
exitToday := false
if permitSignal
permitToday := true
if entrySignal
entryToday := true
if exitSignal
exitToday := true
// Hidden plots for screener columns
plot(permitToday ? 1 : 0, title="PERMIT", display=display.none)
plot(entryToday ? 1 : 0, title="ENTRY", display=display.none)
plot(exitToday ? 1 : 0, title="EXIT", display=display.none)
// Alerts
alertcondition(permitSignal, title="PERMIT", message="Momentum PERMISSION fired")
alertcondition(entrySignal, title="ENTRY", message="Momentum ENTRY fired")
alertcondition(exitSignal, title="EXIT", message="Momentum EXIT fired")
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que la republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que la republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.