0% found this document useful (0 votes)
4 views4 pages

FREE INDICATOR 4

The document is a TradingView Pine Script for an indicator named 'SNIPER MAX' that provides trend analysis and trading signals. It includes settings for trend detection, continuation confirmation, and target levels for take profit and stop loss. The script also features visual elements for entry points, stop loss, and take profit levels, along with alert conditions for significant price movements.

Uploaded by

pagalop421
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

FREE INDICATOR 4

The document is a TradingView Pine Script for an indicator named 'SNIPER MAX' that provides trend analysis and trading signals. It includes settings for trend detection, continuation confirmation, and target levels for take profit and stop loss. The script also features visual elements for entry points, stop loss, and take profit levels, along with alert conditions for significant price movements.

Uploaded by

pagalop421
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

//@version=6

indicator("SNIPER MAX", "SNIPER MAX", overlay = true)

// ───── Trend Settings ─────


st_factor = input.float(12, title="Supertrend Factor", minval=1, step=0.5,
group="SNIPER MAX - Trend Settings")
st_atr_period = input.int(90, title="Supertrend ATR Period", minval=1,
group="SNIPER MAX - Trend Settings")
wma_length = input.int(40, title="Trend WMA Length", minval=1, group="SNIPER MAX -
Trend Settings")
ema_length = input.int(14, title="Trend EMA Length", minval=1, group="SNIPER MAX -
Trend Settings")

// ───── Continuation Settings ─────


cont_factor = input.int(3, title="Confirmation Count", minval=1, group="SNIPER MAX
- Rejection Settings")

// ───── Target Settings ─────


shw_TP1 = input.bool(true, title="Show Take Profit Levels", group="SNIPER MAX -
Target Settings")
atr_period = input.int(14, title="ATR Period (for SL/TP)", minval=1, group="SNIPER
MAX - Target Settings")
sl_multiplier = input.float(5, title="Stop Loss Multiplier (ATR)", minval=0.1,
step=0.1, group="SNIPER MAX - Target Settings")
tp1_multiplier = input.float(0.5, title="Take Profit 1 Multiplier", minval=0.1,
step=0.1, group="SNIPER MAX - Target Settings")
tp2_multiplier = input.float(1.0, title="Take Profit 2 Multiplier", minval=0.1,
step=0.1, group="SNIPER MAX - Target Settings")
tp3_multiplier = input.float(1.5, title="Take Profit 3 Multiplier", minval=0.1,
step=0.1, group="SNIPER MAX - Target Settings")

// ───── Appearance ─────


green = input.color(#00ffbb, title="Bullish Color", group="SNIPER MAX -
Appearance")
red = input.color(#ff1100, title="Bearish Color", group="SNIPER MAX - Appearance")

// ───── Internal Calculations ─────


pine_supertrend(factor, atrPeriod) =>
src = hl2
atr = ta.atr(atrPeriod)
upperBand = src + factor * atr
lowerBand = src - factor * atr
prevLowerBand = nz(lowerBand[1])
prevUpperBand = nz(upperBand[1])
lowerBand := lowerBand > prevLowerBand or close[1] < prevLowerBand ?
lowerBand : prevLowerBand
upperBand := upperBand < prevUpperBand or close[1] > prevUpperBand ?
upperBand : prevUpperBand
[lowerBand, upperBand]

[lwr, upr] = pine_supertrend(st_factor, st_atr_period)


tL = ta.ema(ta.wma(math.avg(lwr, upr), wma_length), ema_length)

var trend = 0
if ta.crossover(tL, tL[1])
trend := 1
if ta.crossunder(tL, tL[1])
trend := -1
plot(tL, "SNIPER MAX Baseline", color=trend == 1 ? color.new(green, 50) :
color.new(red, 50))

plotshape(ta.crossover(tL, tL[1]) ? tL : na, title="SNIPER MAX: Bullish Trend


Change", style=shape.labelup, location=location.absolute, size=size.small,
color=green)
plotshape(ta.crossunder(tL, tL[1]) ? tL : na, title="SNIPER MAX: Bearish Trend
Change", style=shape.labeldown, location=location.absolute, size=size.small,
color=red)

longSignal = ta.crossover(trend, 0)
shortSignal = ta.crossunder(trend, 0)

var SL = 0.0
var TP1_lvl = 0.0
var TP2_lvl = 0.0
var TP3_lvl = 0.0
var line entry_line = na
var line sl_line = na
var line tp1_line = na
var line tp2_line = na
var line tp3_line = na
var label entry_label = na
var label sl_label = na
var label tp1_label = na
var label tp2_label = na
var label tp3_label = na

volatility = ta.atr(atr_period)

// ───── Long Entry ─────


if longSignal and shw_TP1
SL := low - volatility * sl_multiplier
TP1_lvl := close + math.abs(close - SL) * tp1_multiplier
TP2_lvl := close + math.abs(close - SL) * tp2_multiplier
TP3_lvl := close + math.abs(close - SL) * tp3_multiplier

entry_line := line.new(bar_index, close, bar_index, close, color = green, width


= 3)
entry_label := label.new(bar_index, close, text = "Entry ▸ " +
str.tostring(close, format.mintick), style = label.style_label_left, color = green,
textcolor = color.white)

sl_line := line.new(bar_index, SL, bar_index, SL, color = color.new(red, 80),


width = 3)
sl_label := label.new(bar_index, SL, text = "✘ SL ▸ " + str.tostring(SL,
format.mintick), style = label.style_label_left, color = color.new(red, 80),
textcolor = color.white)

tp1_line := line.new(bar_index, TP1_lvl, bar_index, TP1_lvl, color =


color.new(green, 80), width = 3)
tp1_label := label.new(bar_index, TP1_lvl, text = "✔ TP1 ▸ " +
str.tostring(TP1_lvl, format.mintick), style = label.style_label_left, color =
color.new(green, 80), textcolor = color.white)

tp2_line := line.new(bar_index, TP2_lvl, bar_index, TP2_lvl, color =


color.new(green, 80), width = 3)
tp2_label := label.new(bar_index, TP2_lvl, text = "✔ TP2 ▸ " +
str.tostring(TP2_lvl, format.mintick), style = label.style_label_left, color =
color.new(green, 80), textcolor = color.white)

tp3_line := line.new(bar_index, TP3_lvl, bar_index, TP3_lvl, color =


color.new(green, 80), width = 3)
tp3_label := label.new(bar_index, TP3_lvl, text = "✔ TP3 ▸ " +
str.tostring(TP3_lvl, format.mintick), style = label.style_label_left, color =
color.new(green, 80), textcolor = color.white)

// Remove previous lines


line.delete(entry_line[1])
label.delete(entry_label[1])
line.delete(sl_line[1])
label.delete(sl_label[1])
line.delete(tp1_line[1])
label.delete(tp1_label[1])
line.delete(tp2_line[1])
label.delete(tp2_label[1])
line.delete(tp3_line[1])
label.delete(tp3_label[1])
else
line.set_x2(entry_line, bar_index)
label.set_x(entry_label, bar_index)
line.set_x2(sl_line, bar_index)
label.set_x(sl_label, bar_index)
line.set_x2(tp1_line, bar_index)
label.set_x(tp1_label, bar_index)
line.set_x2(tp2_line, bar_index)
label.set_x(tp2_label, bar_index)
line.set_x2(tp3_line, bar_index)
label.set_x(tp3_label, bar_index)

// ───── Short Entry ─────


if shortSignal and shw_TP1
SL := high + volatility * sl_multiplier
TP1_lvl := close - math.abs(close - SL) * tp1_multiplier
TP2_lvl := close - math.abs(close - SL) * tp2_multiplier
TP3_lvl := close - math.abs(close - SL) * tp3_multiplier

entry_line := line.new(bar_index, close, bar_index, close, color = red, width =


3)
entry_label := label.new(bar_index, close, text = "Entry ▸ " +
str.tostring(close, format.mintick), style = label.style_label_left, color = red,
textcolor = color.white)

sl_line := line.new(bar_index, SL, bar_index, SL, color = color.new(red, 80),


width = 3)
sl_label := label.new(bar_index, SL, text = "✘ SL ▸ " + str.tostring(SL,
format.mintick), style = label.style_label_left, color = color.new(red, 80),
textcolor = color.white)

tp1_line := line.new(bar_index, TP1_lvl, bar_index, TP1_lvl, color =


color.new(green, 80), width = 3)
tp1_label := label.new(bar_index, TP1_lvl, text = "✔ TP1 ▸ " +
str.tostring(TP1_lvl, format.mintick), style = label.style_label_left, color =
color.new(green, 80), textcolor = color.white)

tp2_line := line.new(bar_index, TP2_lvl, bar_index, TP2_lvl, color =


color.new(green, 80), width = 3)
tp2_label := label.new(bar_index, TP2_lvl, text = "✔ TP2 ▸ " +
str.tostring(TP2_lvl, format.mintick), style = label.style_label_left, color =
color.new(green, 80), textcolor = color.white)

tp3_line := line.new(bar_index, TP3_lvl, bar_index, TP3_lvl, color =


color.new(green, 80), width = 3)
tp3_label := label.new(bar_index, TP3_lvl, text = "✔ TP3 ▸ " +
str.tostring(TP3_lvl, format.mintick), style = label.style_label_left, color =
color.new(green, 80), textcolor = color.white)

// Remove previous lines


line.delete(entry_line[1])
label.delete(entry_label[1])
line.delete(sl_line[1])
label.delete(sl_label[1])
line.delete(tp1_line[1])
label.delete(tp1_label[1])
line.delete(tp2_line[1])
label.delete(tp2_label[1])
line.delete(tp3_line[1])
label.delete(tp3_label[1])
else
line.set_x2(entry_line, bar_index+40)
label.set_x(entry_label, bar_index+40)
line.set_x2(sl_line, bar_index+40)
label.set_x(sl_label, bar_index+40)
line.set_x2(tp1_line, bar_index+40)
label.set_x(tp1_label, bar_index+40)
line.set_x2(tp2_line, bar_index+40)
label.set_x(tp2_label, bar_index+40)
line.set_x2(tp3_line, bar_index+40)
label.set_x(tp3_label, bar_index+40)

liness = array.new_linefill()
liness.unshift(linefill.new(entry_line, sl_line, color.new(color.red, 95)))
liness.unshift(linefill.new(entry_line, tp3_line, color.new(color.green, 95)))

// ───── Alerts ─────


alertcondition(ta.crossover(close, SL), title="SNIPER MAX: Bullish Breakout",
message="SNIPER MAX: Price crossed above Stop Loss - Bullish Breakout")
alertcondition(ta.crossunder(close, SL), title="SNIPER MAX: Bearish Breakdown",
message="SNIPER MAX: Price crossed below Stop Loss - Bearish Breakdown")
alertcondition(ta.crossover(close, TP1_lvl), title="SNIPER MAX: TP1 Hit",
message="SNIPER MAX: TP1 Level Hit")
alertcondition(ta.crossover(close, TP2_lvl), title="SNIPER MAX: TP2 Hit",
message="SNIPER MAX: TP2 Level Hit")
alertcondition(ta.crossover(close, TP3_lvl), title="SNIPER MAX: TP3 Hit",
message="SNIPER MAX: TP3 Level Hit")

You might also like