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)
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。