PROTECTED SOURCE SCRIPT
My script

//version=5
indicator("NQ Fib + True Open Strategy [Error-Free]", overlay=true, max_lines_count=500)
// === Inputs ===
fibLevel1 = input.float(0.79, "79% Fib Level", minval=0, maxval=1, step=0.01)
fibLevel2 = input.float(0.85, "85% Fib Level", minval=0, maxval=1, step=0.01)
trueOpenTime = input.session("0930-1000", "True Open Time (EST)")
useVolumeFilter = input(true, "Use Volume Filter")
minVolumeRatio = input.float(1.5, "Volume Spike Ratio", minval=1, step=0.1)
trendLength = input.int(5, "Trend Leg Length", minval=1)
// === Trend Detection ===
upTrend = ta.highest(high, trendLength) > ta.highest(high, trendLength)[trendLength] and
ta.lowest(low, trendLength) > ta.lowest(low, trendLength)[trendLength]
downTrend = ta.lowest(low, trendLength) < ta.lowest(low, trendLength)[trendLength] and
ta.highest(high, trendLength) < ta.highest(high, trendLength)[trendLength]
// === Fibonacci Levels ===
swingHigh = ta.highest(high, 10)
swingLow = ta.lowest(low, 10)
priceRange = swingHigh - swingLow
fib79 = swingLow + priceRange * fibLevel1
fib85 = swingLow + priceRange * fibLevel2
// === True Open Price ===
isTrueOpenTime = time(timeframe.period, trueOpenTime)
var float trueOpenPrice = na
if isTrueOpenTime
trueOpenPrice := open
// === Volume Filter ===
volumeAvg = ta.sma(volume, 20)
validVolume = not useVolumeFilter or (volume >= volumeAvg * minVolumeRatio)
// === Entry Conditions ===
nearFib79 = math.abs(close - fib79) <= ta.atr(14) * 0.25
nearFib85 = math.abs(close - fib85) <= ta.atr(14) * 0.25
nearOpenPrice = not na(trueOpenPrice) and math.abs(close - trueOpenPrice) <= ta.atr(14) * 0.25
buySignal = upTrend and (nearFib79 or nearFib85) and nearOpenPrice and validVolume
sellSignal = downTrend and (nearFib79 or nearFib85) and nearOpenPrice and validVolume
// === Plots ===
plot(fib79, "79% Fib", color.new(color.blue, 0), linewidth=1)
plot(fib85, "85% Fib", color.new(color.purple, 0), linewidth=1)
plot(trueOpenPrice, "True Open Price", color.new(color.orange, 0), linewidth=2)
plotshape(buySignal, "Buy", shape.triangleup, location.belowbar, color.new(color.green, 0), size=size.small)
plotshape(sellSignal, "Sell", shape.triangledown, location.abovebar, color.new(color.red, 0), size=size.small)
indicator("NQ Fib + True Open Strategy [Error-Free]", overlay=true, max_lines_count=500)
// === Inputs ===
fibLevel1 = input.float(0.79, "79% Fib Level", minval=0, maxval=1, step=0.01)
fibLevel2 = input.float(0.85, "85% Fib Level", minval=0, maxval=1, step=0.01)
trueOpenTime = input.session("0930-1000", "True Open Time (EST)")
useVolumeFilter = input(true, "Use Volume Filter")
minVolumeRatio = input.float(1.5, "Volume Spike Ratio", minval=1, step=0.1)
trendLength = input.int(5, "Trend Leg Length", minval=1)
// === Trend Detection ===
upTrend = ta.highest(high, trendLength) > ta.highest(high, trendLength)[trendLength] and
ta.lowest(low, trendLength) > ta.lowest(low, trendLength)[trendLength]
downTrend = ta.lowest(low, trendLength) < ta.lowest(low, trendLength)[trendLength] and
ta.highest(high, trendLength) < ta.highest(high, trendLength)[trendLength]
// === Fibonacci Levels ===
swingHigh = ta.highest(high, 10)
swingLow = ta.lowest(low, 10)
priceRange = swingHigh - swingLow
fib79 = swingLow + priceRange * fibLevel1
fib85 = swingLow + priceRange * fibLevel2
// === True Open Price ===
isTrueOpenTime = time(timeframe.period, trueOpenTime)
var float trueOpenPrice = na
if isTrueOpenTime
trueOpenPrice := open
// === Volume Filter ===
volumeAvg = ta.sma(volume, 20)
validVolume = not useVolumeFilter or (volume >= volumeAvg * minVolumeRatio)
// === Entry Conditions ===
nearFib79 = math.abs(close - fib79) <= ta.atr(14) * 0.25
nearFib85 = math.abs(close - fib85) <= ta.atr(14) * 0.25
nearOpenPrice = not na(trueOpenPrice) and math.abs(close - trueOpenPrice) <= ta.atr(14) * 0.25
buySignal = upTrend and (nearFib79 or nearFib85) and nearOpenPrice and validVolume
sellSignal = downTrend and (nearFib79 or nearFib85) and nearOpenPrice and validVolume
// === Plots ===
plot(fib79, "79% Fib", color.new(color.blue, 0), linewidth=1)
plot(fib85, "85% Fib", color.new(color.purple, 0), linewidth=1)
plot(trueOpenPrice, "True Open Price", color.new(color.orange, 0), linewidth=2)
plotshape(buySignal, "Buy", shape.triangleup, location.belowbar, color.new(color.green, 0), size=size.small)
plotshape(sellSignal, "Sell", shape.triangledown, location.abovebar, color.new(color.red, 0), size=size.small)
Script protetto
Questo script è pubblicato come codice protetto. Tuttavia, è possibile utilizzarlo liberamente e senza alcuna limitazione – per saperne di più clicca qui.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script protetto
Questo script è pubblicato come codice protetto. Tuttavia, è possibile utilizzarlo liberamente e senza alcuna limitazione – per saperne di più clicca qui.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.