OPEN-SOURCE SCRIPT
ATR Trailing SL Fibonacci

ATR Trailing SL Fibonacci Indicator
This indicator combines ZigZag pattern detection with Fibonacci analysis to identify potential support and resistance levels for setting trailing stop losses.
Core Components:
ZigZag Pattern Detection
Uses imported ZigZag library to identify significant price swings
Configurable parameters:
depth: Minimum price movement threshold
deviation: Minimum deviation between swing points
backstep: Number of bars required for reversal confirmation
Fibonacci Analysis
Two display modes:
Retracements: Horizontal Fibonacci levels between ZigZag points
Timezone: Vertical Fibonacci time projections
Customizable Fibonacci levels with individual color settings
Customizable Fibonacci Levels:
Fib 0 (0%) - White
Fib A (23.6%) - Blue
Fib B (38.2%) - Green
Fib C (50%) - Gray (Default: ON)
Fib D (61.8%) - Orange
Fib E (78.6%) - Red
Fib F (100%) - White (Default: ON)
Display Features:
Visual Elements:
ZigZag line connecting swing points (toggleable)
Fibonacci level lines with colored labels
Price level labels at each Fibonacci line
Background color indicating trend direction
Customization Options:
Adjustable label sizes for Fibonacci levels and price labels
Timeframe selection for analysis
Source price selection (High/Low)
Technical Implementation:
Dynamic Updates: Automatically redraws Fibonacci levels when new ZigZag points are detected
Memory Management: Cleans up previous lines and labels to maintain chart cleanliness
Multi-timeframe Analysis: Uses request.security() for higher timeframe analysis
Trading Applications:
Stop Loss Placement: Use Fibonacci levels as dynamic trailing stop levels
Support/Resistance Identification: Key Fibonacci levels act as potential reversal zones
Trend Analysis: ZigZag direction helps identify overall market structure
Risk Management: ATR-based approach to setting stop losses relative to volatility
Usage Tips:
The 50% and 100% levels are enabled by default as they represent key psychological levels
Combine with other indicators for confirmation of Fibonacci level reactions
Use the background color as a quick visual reference for trend direction
Adjust the ZigZag parameters based on market volatility and timeframe
This indicator is particularly useful for traders who employ Fibonacci-based trading strategies and want a systematic approach to setting trailing stop losses based on market structure and key retracement levels.
This indicator combines ZigZag pattern detection with Fibonacci analysis to identify potential support and resistance levels for setting trailing stop losses.
Core Components:
ZigZag Pattern Detection
Uses imported ZigZag library to identify significant price swings
Configurable parameters:
depth: Minimum price movement threshold
deviation: Minimum deviation between swing points
backstep: Number of bars required for reversal confirmation
Fibonacci Analysis
Two display modes:
Retracements: Horizontal Fibonacci levels between ZigZag points
Timezone: Vertical Fibonacci time projections
Customizable Fibonacci levels with individual color settings
Customizable Fibonacci Levels:
Fib 0 (0%) - White
Fib A (23.6%) - Blue
Fib B (38.2%) - Green
Fib C (50%) - Gray (Default: ON)
Fib D (61.8%) - Orange
Fib E (78.6%) - Red
Fib F (100%) - White (Default: ON)
Display Features:
Visual Elements:
ZigZag line connecting swing points (toggleable)
Fibonacci level lines with colored labels
Price level labels at each Fibonacci line
Background color indicating trend direction
Customization Options:
Adjustable label sizes for Fibonacci levels and price labels
Timeframe selection for analysis
Source price selection (High/Low)
Technical Implementation:
Dynamic Updates: Automatically redraws Fibonacci levels when new ZigZag points are detected
Memory Management: Cleans up previous lines and labels to maintain chart cleanliness
Multi-timeframe Analysis: Uses request.security() for higher timeframe analysis
Trading Applications:
Stop Loss Placement: Use Fibonacci levels as dynamic trailing stop levels
Support/Resistance Identification: Key Fibonacci levels act as potential reversal zones
Trend Analysis: ZigZag direction helps identify overall market structure
Risk Management: ATR-based approach to setting stop losses relative to volatility
Usage Tips:
The 50% and 100% levels are enabled by default as they represent key psychological levels
Combine with other indicators for confirmation of Fibonacci level reactions
Use the background color as a quick visual reference for trend direction
Adjust the ZigZag parameters based on market volatility and timeframe
This indicator is particularly useful for traders who employ Fibonacci-based trading strategies and want a systematic approach to setting trailing stop losses based on market structure and key retracement levels.
Script de código aberto
No verdadeiro espirito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam entendê-lo e verificá-lo. Parabéns ao autor Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações e regida pelas Regras da Casa.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.
Script de código aberto
No verdadeiro espirito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam entendê-lo e verificá-lo. Parabéns ao autor Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações e regida pelas Regras da Casa.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.