PROTECTED SOURCE SCRIPT
Zaktualizowano

AstroTrading_TrendKanalı

63
1. Input and Initialization
Bar Lookback Settings:

The script defines how many bars to use for calculating pivot points on either side of a potential pivot (using left_bars and right_bars).
The lookback input specifies how many bars in the past the script will search for the pattern.
Pivot Arrays:

Four arrays are initialized to store pivot low and pivot high values along with their corresponding bar indices. These arrays are populated as the script processes each bar.
2. Pivot Point Calculation
Detecting Pivots:
Using ta.pivotlow(left_bars, right_bars) and ta.pivothigh(left_bars, right_bars), the script identifies local lows and highs.
When a pivot is found (i.e. not na), it pushes the adjusted bar index and the pivot value into the respective arrays.
3. Filtering Pivot Points
Restricting to a Lookback Window:
Once the last bar is reached (barstate.islast), the script defines a start and end bar based on the user’s lookback value.
It then filters the collected pivot lows and highs so that only those within the specified historical window are kept for further analysis.
4. Pattern Recognition and Fibonacci Calculation
The script attempts to find one of two patterns in the filtered data:

A. Bullish Formation (Dip–Peak–Dip Pattern):
Sequence Identification:

Dip1: A pivot low is chosen as the first point.
Peak: The script then looks for a pivot high that occurs after Dip1.
Dip2: Next, it seeks a later pivot low (after the peak).
Fibonacci Levels:

Once Dip1, Peak, and Dip2 are identified, the difference between the Peak and Dip1 is computed.
An array of Fibonacci multipliers is created (with values 0.0, 0.382, 0.707, 0.786, and 1.618). These correspond to different potential levels such as STOP, Entry, and various Target levels.
For each multiplier, the price level is calculated using:
priceLevel = dip2 + diff × multiplier
For each calculated level, a horizontal line is drawn (extending from slightly after the dip2 bar to the end of the lookback window) and a label is added indicating the level name and its numeric value.
B. Bearish Formation (Peak–Dip–Peak Pattern):
Sequence Identification:

Peak1: A pivot high is chosen as the first point.
Dip: A subsequent pivot low is identified after Peak1.
Peak2: Finally, a later pivot high (after the dip) is found.
Fibonacci Levels:

The difference between Peak1 and the Dip is calculated.
The same set of Fibonacci multipliers is used, but the price level is now determined by:
priceLevel = peak2 – diff × multiplier
As before, the script draws lines for these levels and places labels indicating their role (STOP, Entry, Target 1, Target 2, or Target 3).
Fallback:

If no valid bullish or bearish pattern is found within the defined lookback range, the script displays a label on the chart informing the user that no valid formation was detected.
5. Visual Output
Plotting Levels:
The indicator draws horizontal lines at the calculated Fibonacci extension levels.
Each line is extended to the right so that traders can see these levels clearly across future bars.
Labels accompanying the lines show both the level’s name (e.g., “Giriş”, “1. Hedef”) and its price value formatted to three decimal places.
Summary
The “AstroTrading_SpecialLevels” indicator automates the process of finding special price levels based on pivot point formations and Fibonacci extensions. By scanning a historical lookback period for either a bullish (dip–peak–dip) or bearish (peak–dip–peak) pattern, it calculates key levels that may act as support, resistance, or potential reversal areas. The results are then visually represented on the chart using horizontal lines and labels. This tool can be used as a standalone reference or in conjunction with other technical analysis methods to help traders time their entries and exits.

This explanation adheres to TradingView’s publication guidelines by clearly breaking down the indicator’s structure, logic, and visual components in an objective and detailed manner.
Informacje o Wersji
1. Input and Initialization
Bar Lookback Settings:

The script defines how many bars to use for calculating pivot points on either side of a potential pivot (using left_bars and right_bars).
The lookback input specifies how many bars in the past the script will search for the pattern.
Pivot Arrays:

Four arrays are initialized to store pivot low and pivot high values along with their corresponding bar indices. These arrays are populated as the script processes each bar.
2. Pivot Point Calculation
Detecting Pivots:
Using ta.pivotlow(left_bars, right_bars) and ta.pivothigh(left_bars, right_bars), the script identifies local lows and highs.
When a pivot is found (i.e. not na), it pushes the adjusted bar index and the pivot value into the respective arrays.
3. Filtering Pivot Points
Restricting to a Lookback Window:
Once the last bar is reached (barstate.islast), the script defines a start and end bar based on the user’s lookback value.
It then filters the collected pivot lows and highs so that only those within the specified historical window are kept for further analysis.
4. Pattern Recognition and Fibonacci Calculation
The script attempts to find one of two patterns in the filtered data:

A. Bullish Formation (Dip–Peak–Dip Pattern):
Sequence Identification:

Dip1: A pivot low is chosen as the first point.
Peak: The script then looks for a pivot high that occurs after Dip1.
Dip2: Next, it seeks a later pivot low (after the peak).
Fibonacci Levels:

Once Dip1, Peak, and Dip2 are identified, the difference between the Peak and Dip1 is computed.
An array of Fibonacci multipliers is created (with values 0.0, 0.382, 0.707, 0.786, and 1.618). These correspond to different potential levels such as STOP, Entry, and various Target levels.
For each multiplier, the price level is calculated using:
priceLevel = dip2 + diff × multiplier
For each calculated level, a horizontal line is drawn (extending from slightly after the dip2 bar to the end of the lookback window) and a label is added indicating the level name and its numeric value.
B. Bearish Formation (Peak–Dip–Peak Pattern):
Sequence Identification:

Peak1: A pivot high is chosen as the first point.
Dip: A subsequent pivot low is identified after Peak1.
Peak2: Finally, a later pivot high (after the dip) is found.
Fibonacci Levels:

The difference between Peak1 and the Dip is calculated.
The same set of Fibonacci multipliers is used, but the price level is now determined by:
priceLevel = peak2 – diff × multiplier
As before, the script draws lines for these levels and places labels indicating their role (STOP, Entry, Target 1, Target 2, or Target 3).
Fallback:

If no valid bullish or bearish pattern is found within the defined lookback range, the script displays a label on the chart informing the user that no valid formation was detected.
5. Visual Output
Plotting Levels:
The indicator draws horizontal lines at the calculated Fibonacci extension levels.
Each line is extended to the right so that traders can see these levels clearly across future bars.
Labels accompanying the lines show both the level’s name (e.g., “Giriş”, “1. Hedef”) and its price value formatted to three decimal places.
Summary
The “AstroTrading_SpecialLevels” indicator automates the process of finding special price levels based on pivot point formations and Fibonacci extensions. By scanning a historical lookback period for either a bullish (dip–peak–dip) or bearish (peak–dip–peak) pattern, it calculates key levels that may act as support, resistance, or potential reversal areas. The results are then visually represented on the chart using horizontal lines and labels. This tool can be used as a standalone reference or in conjunction with other technical analysis methods to help traders time their entries and exits.

This explanation adheres to TradingView’s publication guidelines by clearly breaking down the indicator’s structure, logic, and visual components in an objective and detailed manner.

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.