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. اقرأ المزيد في شروط الاستخدام.