OPEN-SOURCE SCRIPT
Sniper Entry 2.1

📌 Overview
This script is designed to calculate precise entry levels for long and short trades based on a combination of percentage offsets from the open price and ATR-based volatility filters. It dynamically adjusts stop-loss width and snaps levels to logical increments, then plots them on the chart with labels and dotted lines.
⚙️ Key Components
Inputs
Offset % from Open: Defines how far above/below the open price to set levels.
Label Offset: Controls how many bars forward labels/lines are drawn.
ATR Multiplier & ATR Length: Used to calculate volatility-adjusted stop-loss width.
Base Calculations
Computes upper and lower bounds around the open price using both percentage offset and ATR.
Chooses the larger of the two (percent vs ATR) to ensure realistic stop-loss sizing.
Builds symmetric levels around the open.
Dynamic Step Size
Adjusts snapping increments based on the raw stop-loss width.
Example: Small ranges snap to 0.01 or 0.05, larger ranges snap to 1, 5, 10, etc.
This prevents clutter and ensures levels align with meaningful price ticks.
Snapped Levels
longEntry: Rounded up to the nearest step above the open.
shortEntry: Rounded down to the nearest step below the open.
finalSL: The effective stop-loss width between these two levels.
Chart Drawing
Deletes old labels/lines to keep the chart clean.
Plots dotted horizontal lines for long and short entries.
Labels them with price values (green for long, red for short).
🎯 Purpose
This script helps traders quickly identify balanced entry levels that adapt to volatility. By combining percentage offsets with ATR, it avoids overly tight or unrealistic stops. The snapping logic ensures levels are practical for execution.
This script is designed to calculate precise entry levels for long and short trades based on a combination of percentage offsets from the open price and ATR-based volatility filters. It dynamically adjusts stop-loss width and snaps levels to logical increments, then plots them on the chart with labels and dotted lines.
⚙️ Key Components
Inputs
Offset % from Open: Defines how far above/below the open price to set levels.
Label Offset: Controls how many bars forward labels/lines are drawn.
ATR Multiplier & ATR Length: Used to calculate volatility-adjusted stop-loss width.
Base Calculations
Computes upper and lower bounds around the open price using both percentage offset and ATR.
Chooses the larger of the two (percent vs ATR) to ensure realistic stop-loss sizing.
Builds symmetric levels around the open.
Dynamic Step Size
Adjusts snapping increments based on the raw stop-loss width.
Example: Small ranges snap to 0.01 or 0.05, larger ranges snap to 1, 5, 10, etc.
This prevents clutter and ensures levels align with meaningful price ticks.
Snapped Levels
longEntry: Rounded up to the nearest step above the open.
shortEntry: Rounded down to the nearest step below the open.
finalSL: The effective stop-loss width between these two levels.
Chart Drawing
Deletes old labels/lines to keep the chart clean.
Plots dotted horizontal lines for long and short entries.
Labels them with price values (green for long, red for short).
🎯 Purpose
This script helps traders quickly identify balanced entry levels that adapt to volatility. By combining percentage offsets with ATR, it avoids overly tight or unrealistic stops. The snapping logic ensures levels are practical for execution.
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.