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.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。