Quantum Sniper

//version=5
indicator('Quantum Sniper', overlay=true) // 1. INDICATOR NAME CHANGED TO "Quantum Sniper"
// -----------------------------------------------------------------------------
// 2. SECURITY HARDCODING (Inputs Removed or Fixed)
// -----------------------------------------------------------------------------
var ok = 0
var countBuy = 0
var countSell = 0
// src = input(close, title='OHLC Type') // REMOVED INPUT
src = close // FIXED: Assume close price
// --- EMA Lengths Hardcoded (Change these numbers to your secret settings!)
l_fastEMA = 14 // ⚠️ Change THIS to your Fast EMA length (e.g., 18)
l_slowEMA = 15 // ⚠️ Change THIS to your Slow EMA length (e.g., 35)
l_defEMA = 16 // ⚠️ Change THIS to your Consolidated EMA length
// Allow the option to show single or double EMA
// i_bothEMAs = input(title='Show Both EMAs', defval=true) // REMOVED INPUT
i_bothEMAs = true // FIXED: Always show both EMAs
// Define EMAs
v_fastEMA = ta.ema(src, l_fastEMA)
v_slowEMA = ta.ema(src, l_slowEMA)
v_biasEMA = ta.ema(src, l_defEMA)
// Color the EMAs
emaColor = v_fastEMA > v_slowEMA ? color.green : v_fastEMA < v_slowEMA ? color.red : #FF530D
// Plot EMAs
plot(i_bothEMAs ? na : v_biasEMA, color=emaColor, linewidth=3, title='Consolidated EMA')
plot(i_bothEMAs ? v_fastEMA : na, title='Fast EMA', color=emaColor)
plot(i_bothEMAs ? v_slowEMA : na, title='Slow EMA', color=emaColor)
// Colour the bars
buy = v_fastEMA > v_slowEMA
sell = v_fastEMA < v_slowEMA
if buy
countBuy += 1
countBuy
if buy
countSell := 0
countSell
if sell
countSell += 1
countSell
if sell
countBuy := 0
countBuy
buysignal = countBuy < 2 and countBuy > 0 and countSell < 1 and buy and not buy[1]
sellsignal = countSell > 0 and countSell < 2 and countBuy < 1 and sell and not sell[1]
barcolor(buysignal ? color.green : na)
barcolor(sellsignal ? color.red : na)
// -----------------------------------------------------------------------------
// 3. PLOT SIGNALS CHANGED TO "Long" and "Short"
// -----------------------------------------------------------------------------
plotshape(buysignal, title='Long', text='Long', style=shape.triangleup, location=location.belowbar, color=color.new(color.green, 0), textcolor=color.new(color.black, 0), size=size.tiny)
plotshape(sellsignal, title='Short', text='Short', style=shape.triangledown, location=location.abovebar, color=color.new(color.red, 0), textcolor=color.new(color.black, 0), size=size.tiny)
bull = countBuy > 1
bear = countSell > 1
barcolor(bull ? color.green : na)
barcolor(bear ? color.red : na)
// Set Alerts
alertcondition(ta.crossover(v_fastEMA, v_slowEMA), title='Bullish EMA Cross', message='Bullish EMA crossover')
alertcondition(ta.crossunder(v_fastEMA, v_slowEMA), title='Bearish EMA Cross', message='Bearish EMA Crossover')
// -----------------------------------------------------------------------------
// 4. STOCH RSI Hardcoding
// -----------------------------------------------------------------------------
// Note: All Stochastic/RSI inputs below are now hardcoded to common values (e.g., 3, 14).
// If you use custom StochRSI inputs, you must change these numbers as well.
smoothK = 3 // Hardcoded
smoothD = 3 // Hardcoded
lengthRSI = 14 // Hardcoded
lengthStoch = 14 // Hardcoded
rsi1 = ta.rsi(src, lengthRSI)
k = ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = ta.sma(k, smoothD)
bandno0 = 80 // Hardcoded
bandno2 = 50 // Hardcoded
bandno1 = 20 // Hardcoded
// Alerts
// Crossover Alert Toggles Hardcoded to their default values (false)
crossoverAlertBgColourMidOnOff = false
crossoverAlertBgColourOBOSOnOff = false
crossoverAlertBgColourGreaterThanOnOff = false
crossoverAlertBgColourLessThanOnOff = false
// Moving Average Inputs Hardcoded
maTypeChoice = 'EMA' // Hardcoded
maSrc = close // Hardcoded
maLen = 200 // Hardcoded
maValue = if maTypeChoice == 'EMA'
ta.ema(maSrc, maLen)
else if maTypeChoice == 'WMA'
ta.wma(maSrc, maLen)
else if maTypeChoice == 'SMA'
ta.sma(maSrc, maLen)
else
0
crossupCHECK = maTypeChoice == 'None' or open > maValue and maTypeChoice != 'None'
crossdownCHECK = maTypeChoice == 'None' or open < maValue and maTypeChoice != 'None'
crossupalert = crossupCHECK and ta.crossover(k, d) and (k < bandno2 or d < bandno2)
crossdownalert = crossdownCHECK and ta.crossunder(k, d) and (k > bandno2 or d > bandno2)
crossupOSalert = crossupCHECK and ta.crossover(k, d) and (k < bandno1 or d < bandno1)
crossdownOBalert = crossdownCHECK and ta.crossunder(k, d) and (k > bandno0 or d > bandno0)
aboveBandalert = ta.crossunder(k, bandno0)
belowBandalert = ta.crossover(k, bandno1)
bgcolor(color=crossupalert and crossoverAlertBgColourMidOnOff ? #4CAF50 : crossdownalert and crossoverAlertBgColourMidOnOff ? #FF0000 : na, title='Crossover Alert Background Colour (Middle Level)', transp=70)
bgcolor(color=crossupOSalert and crossoverAlertBgColourOBOSOnOff ? #fbc02d : crossdownOBalert and crossoverAlertBgColourOBOSOnOff ? #000000 : na, title='Crossover Alert Background Colour (OB/OS Level)', transp=70)
bgcolor(color=aboveBandalert and crossoverAlertBgColourGreaterThanOnOff ? #ff0014 : crossdownalert and crossoverAlertBgColourMidOnOff ? #FF0000 : na, title='Crossover Alert - K > Upper level', transp=70)
bgcolor(color=belowBandalert and crossoverAlertBgColourLessThanOnOff ? #4CAF50 : crossdownalert and crossoverAlertBgColourMidOnOff ? #FF0000 : na, title='Crossover Alert - K < Lower level', transp=70)
alertcondition(crossupalert or crossdownalert, title='Stoch RSI Crossover', message='STOCH RSI CROSSOVER')
Invite-only script
Only users approved by the author can access this script. You'll need to request and get permission to use it. This is typically granted after payment. For more details, follow the author's instructions below or contact s6-mxoato8wje3 directly.
TradingView does NOT recommend paying for or using a script unless you fully trust its author and understand how it works. You may also find free, open-source alternatives in our community scripts.
Author's instructions
Disclaimer
Invite-only script
Only users approved by the author can access this script. You'll need to request and get permission to use it. This is typically granted after payment. For more details, follow the author's instructions below or contact s6-mxoato8wje3 directly.
TradingView does NOT recommend paying for or using a script unless you fully trust its author and understand how it works. You may also find free, open-source alternatives in our community scripts.