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 aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.