ST+SQZMOM v.3ST+SQZMOM v.3 Indicator
inspired by Supertrend and SQZMOM of LazyBear
Purpose: This script is designed to help traders identify market trends and potential trading opportunities using two key indicators: Supertrend and Squeeze Momentum Indicator (SQZMOM).
---
Key Features:
1. Supertrend Indicator:
- Trend Detection: Shows whether the market is in an uptrend or downtrend.
- Dynamic Levels: Uses Average True Range (ATR) to set support and resistance levels.
2. Squeeze Momentum Indicator (SQZMOM):
- Volatility Measurement: Identifies periods of low volatility (squeeze) and potential breakout points.
- Bollinger Bands & Keltner Channels: Combines these two tools to assess market conditions.
3. Custom Alerts:
- Trend Change Alerts: Notifies you when the trend changes.
- Squeeze Alerts: Alerts you when the market is entering or exiting a squeeze.
4. Customizable Settings:
- Adjust parameters like ATR length, Bollinger Bands length, and moving average periods to fit your trading style.
---
How It Works:
1. Calculate Trend:
- The script calculates the Supertrend to determine if the market is trending up or down.
2. Identify Squeeze:
- It checks if the market is in a squeeze (low volatility) or has released from a squeeze (high volatility).
3. Set Targets and Stop Loss:
- Based on the trend and squeeze conditions, it calculates entry points, target levels, and stop loss levels for trades.
4. Visual Indicators:
- Plots the Supertrend line, Bollinger Bands, Keltner Channels, and shapes to indicate market conditions (e.g., squeeze on/off, trend changes).
5. Trigger Alerts:
- Sends alerts when specific conditions are met, such as a squeeze release or trend change.
---
Conclusion
The ST+SQZMOM v.3 Indicator is a powerful tool for traders looking to analyze market trends and volatility. By combining the Supertrend and Squeeze Momentum indicators, it provides a comprehensive view of market conditions, helping you make informed trading decisions.
Indicateurs et stratégies
[EmreKb] Dynamic Factor SupertrendThe Dynamic Factor Supertrend is an innovative variation of the classic Supertrend indicator, designed to provide traders with more accurate trend signals while reducing the impact of false breakouts. Unlike the traditional Supertrend, which relies on a fixed multiplier (Factor) applied to the Average True Range (ATR), this enhanced version introduces a dynamic adjustment mechanism based on price movements relative to the Supertrend line.
This indicator works by assessing the distance between the price and the Supertrend line. When the price moves significantly beyond the typical ATR × Factor distance, the remaining gap is recalculated using a Dynamic Factor. This additional scaling adjusts the base factor, effectively modifying the Supertrend line to better reflect current market conditions. This process ensures that the trend line adapts dynamically to changes in price behavior, reducing noise and improving signal reliability in volatile markets.
One of the key advantages of the Dynamic Factor Supertrend is its ability to minimize false trend reversals. By incorporating the Dynamic Factor adjustment, the indicator becomes more resilient to minor price fluctuations that could otherwise trigger incorrect signals. This makes it particularly effective in markets where volatility is high, or during periods of choppy price action, where traditional Supertrend indicators often struggle to maintain accuracy.
Traders can use the Dynamic Factor Supertrend to identify clear trend directions, with uptrends signaled when the price is above the trend line and downtrends when it is below. The Dynamic Factor parameter can be fine-tuned to match individual trading styles, offering greater flexibility. A lower value makes the trend line more responsive to price changes, while a higher value provides more stability by reducing the frequency of adjustments.
In summary, the Dynamic Factor Supertrend is an advanced trend-following tool that combines the foundational concepts of the Supertrend with a novel dynamic adjustment mechanism. It offers traders a more reliable way to navigate complex market conditions, making it a valuable addition to any trading strategy. This indicator is particularly well-suited for those seeking to reduce false signals and enhance the accuracy of their trend analysis in all market environments.
Fibonacci Time-Price Zones🟩 Fibonacci Time-Price Zones is a chart visualization tool that combines Fibonacci ratios with time-based and price-based geometry to analyze market behavior. Unlike typical Fibonacci indicators that focus solely on horizontal price levels, this indicator incorporates time into the analysis, providing a more dynamic perspective on price action.
The indicator offers multiple ways to visualize Fibonacci relationships. Drawing segmented circles creates a unique perspective on price action by incorporating time into the analysis. These segmented circles, similar to TradingView's built-in Fibonacci Circles, are derived from Fibonacci time and price levels, allowing traders to identify potential turning points based on the dynamic interaction between price and time.
As another distinct visualization method, the indicator incorporates orthogonal patterns, created by the intersection of horizontal and vertical Fibonacci levels. These intersections form L-shaped connections on the chart, derived from key Fibonacci price and time intervals, highlighting potential areas of support or resistance at specific points in time.
In addition to these geometric approaches, another option is sloped lines, which project Fibonacci levels that account for both time and price along the trendline. These projections derive their angles from the interplay between Fibonacci price levels and Fibonacci time intervals, creating dynamic zones on the chart. The slope of these lines reflects the direction and angle of the trend, providing a visual representation of price alignment with market direction, while maintaining the time-price relationship unique to this indicator
The indicator also includes horizontal Fibonacci levels similar to traditional retracement and extension tools. However, unlike standard tools, traders can display retracement levels, extension levels, or both simultaneously from a single instance of the indicator. These horizontal levels maintain consistency with the chosen visualization method, automatically scaling and adapting whether used with circles, orthogonal patterns, or slope-based analysis.
By combining these distinct methods—circles, orthogonal patterns, sloped projections, and horizontal levels—the indicator provides a comprehensive approach to Fibonacci analysis based on both time and price relationships. Each visualization method offers a unique perspective on market structure while maintaining the core principle of time-price interaction.
⭕ THEORY AND CONCEPT ⭕
While traditional Fibonacci tools excel at identifying potential support and resistance levels through price-based ratios (0.236, 0.382, 0.618), they do not incorporate the dimension of time in market analysis. Extensions and retracements effectively measure price relationships within trends, yet markets move through both price and time dimensions simultaneously.
Fibonacci circles represent an evolution in technical analysis by incorporating time intervals alongside price levels. Based on the mathematical principle that markets often move in circular patterns proportional to Fibonacci ratios, these circles project potential support and resistance zones as partial circles radiating from significant price points. However, traditional circle-based tools can create visual complexity that obscures key market relationships. The integration of time into Fibonacci analysis reveals how price movements often respect both temporal and price-based ratios, suggesting a deeper geometric structure to market behavior.
The Fibonacci Time-Price Zones indicator advances these concepts by providing multiple geometric approaches to visualize time-price relationships. Each shape option—circles, orthogonal patterns, slopes, and horizontal levels—represents a different mathematical perspective on how Fibonacci ratios manifest across both dimensions. This multi-faceted approach allows traders to observe how price responds to Fibonacci-based zones that account for both time and price movements, potentially revealing market structure that purely price-based tools might miss.
Shape Options
The indicator employs four distinct geometric approaches to analyze Fibonacci relationships across time and price dimensions:
Circular : Represents the cyclical nature of market movements through partial circles, where each radius is scaled by Fibonacci ratios incorporating both time and price components. This geometry suggests market movements may follow proportional circular paths from significant pivot points, reflecting the harmonic relationship between time and price.
Orthogonal : Constructs L-shaped patterns that separate the time and price components of Fibonacci relationships. The horizontal component represents price levels, while the vertical component measures time intervals, allowing analysis of how these dimensions interact independently at key market points.
Sloped : Projects Fibonacci levels along the prevailing trend, incorporating both time and price in the angle of projection. This approach suggests that support and resistance levels may maintain their relationship to price while adjusting to the temporal flow of the market.
Horizontal : Provides traditional static Fibonacci levels that serve as a reference point for comparing price-only analysis with the dynamic time-price relationships shown in the other three shapes. This baseline approach allows traders to evaluate how the incorporation of time dimension enhances or modifies traditional Fibonacci analysis.
By combining these geometric approaches, the Fibonacci Time-Price Zones indicator creates a comprehensive analytical framework that bridges traditional and advanced Fibonacci analysis. The horizontal levels serve as familiar reference points, while the dynamic elements—circular, orthogonal, and sloped projections—reveal how price action responds to temporal relationships. This multi-dimensional approach enables traders to study market structure through various geometric lenses, providing deeper insights into time-price symmetry within technical analysis. Whether applied to retracements, extensions, or trend analysis, the indicator offers a structured methodology for understanding how markets move through both price and time dimensions.
🛠️ CONFIGURATION AND SETTINGS 🛠️
The Fibonacci Time-Price Zones indicator offers a range of configurable settings to tailor its functionality and visual representation to your specific analysis needs. These options allow you to customize zone visibility, structures, horizontal lines, and other features.
Important Note: The indicator's calculations are anchored to user-defined start and end points on the chart. When switching between charts with significantly different price scales (e.g., from Bitcoin at $100,000 to Silver at $30), adjustment of these anchor points is required to ensure correct positioning of the Fibonacci elements.
Fibonacci Levels
The indicator allows users to customize Fibonacci levels for both retracement and extension analysis. Each level can be individually configured with the following options:
Visibility : Toggle the visibility of each level to focus on specific areas of interest.
Level Value : Set the Fibonacci ratio for the level, such as 0.618 or 1.000, to align with your analysis needs.
Color : Customize the color of each level for better visual clarity.
Line Thickness : Adjust the line thickness to emphasize critical levels or maintain a cleaner chart.
Setup
Zone Type : Select which Fibonacci zones to display:
- Retracement : Shows potential pull back levels within the trend
- Extension : Projects levels beyond the trend for potential continuation targets
- Both : Displays both retracement and extension zones simultaneously
Shape : Choose from four visualization methods:
- Circular : Time-price based semicircles centered on point B
- Orthogonal : L-shaped patterns combining time and price levels
- Sloped : Trend-aligned projections of Fibonacci levels
- Horizontal : Traditional horizontal Fibonacci levels
Visual Settings
Fill % : Adjusts the fill intensity of zones:
0% : No fill between levels
100% : Maximum fill between levels
Lines :
Trendline : The base A-B trend with customizable color
Extension : B-C projection line
Retracement : B-D pullback line
Labels :
Points : Show/hide A, B, C, D markers
Levels : Show/hide Fibonacci percentages
Time-Price Points
Set the time and price for the points that define the Fibonacci zones and horizontal levels. These points are defined upon loading the chart. These points can be configured directly in the settings or adjusted interactively on the live chart.
A and B Points : These user-defined time and price points determine the basis for calculating the semicircles and Fibonacci levels. While the settings panel displays their exact values for fine-tuning, the easiest way to modify these points is by dragging them directly on the chart for quick adjustments.
Interactive Adjustments : Any changes made to the points on the chart will automatically synchronize with the settings panel, ensuring consistency and precision.
🖼️ CHART EXAMPLES 🖼️
Fibonacci Time-Price Zones using the 'Circular' Shape option. Note the price interaction at the 0.786 level, which acts as a support zone. Additional points of interest include resistance near the 0.618 level and consolidation around the 0.5 level, highlighting the utility of both horizontal and semicircular Fibonacci projections in identifying key price areas.
Fibonacci Time-Price Zones using the 'Sloped' Shape option. The chart displays price retracing along the sloped Fibonacci levels, with blue arrows highlighting potential support zones at 0.618 and 0.786, and a red arrow indicating potential resistance at the 1.0 level. This visual representation aligns with the prevailing downtrend, suggesting potential selling pressure at the 1.0 Fibonacci level.
Fibonacci Time-Price Zones using the 'Orthogonal' Shape option. The chart demonstrates price action interacting with vertical zones created by the orthogonal lines at the 0.618, 0.786, and 1.0 Fibonacci levels. Blue arrows highlight potential support areas, while red arrows indicate potential resistance areas, revealing how the orthogonal lines can identify distinct points of price interaction.
Fibonacci Time-Price Zones using the 'Circular' Shape option. The chart displays price action in relation to segmented circles emanating from the starting point (point A). The circles represent different Fibonacci ratios (0.382, 0.5, 0.618, 0.786) and their intersections with the price axis create potential zones of support and resistance. This approach offers a visually distinct way to analyze potential turning points based on both price and time.
Fibonacci Time-Price Zones using the 'Sloped' Shape option. The sloped Fibonacci levels (0.786, 0.618, 0.5) create zones of potential support and resistance, with price finding clear interaction within these areas. The ellipses highlight this price action, particularly the support between 0.786 and 0.618, which aligns closely with the trend.
Fibonacci Time-Price Zones using the 'Circular' Shape option. The price action appears to be ‘hugging’ the 0.5 Fibonacci level, suggesting potential resistance. This demonstrates how the circular zones can identify potential turning points and areas of consolidation which might not be seen with linear analysis.
Fibonacci Time-Price Zones using the 'Sloped' Shape option with Point D marker enabled. The chart demonstrates clear price action closely following along the sloped Retracement line until the orthogonal intersection at the 0.618 levels where the trend is broken and price dips throughout the 0.618 to 0.786 horizontal zone. Price jumps back to the retracement slope at the start of the 0.786 horizontal zone and continues to the 1.0 horizontal zone. The aqua-colored retracement line is enabled to further emphasize this retracement slope .
Geometric validation using TradingView's built-in Fibonacci Circle tool (overlaid). The alignment at the 0.5 and 1.0 levels demonstrates the indicator's consistent approximation of Fibonacci Circles.
Comparison of Fibonacci Time-Price Zones (Shape: Horizontal) with TradingView's Built-in Retracement and Extension Tools (overlaid): This example demonstrates how the Horizontal structure aligns with TradingView’s retracement and extension levels, allowing users to integrate multiple tools seamlessly. The Fibonacci circle connects retracement and extension zones, highlighting the potential relationship between past retracements and future extensions.
📐 GEOMETRIC FOUNDATIONS 📐
This indicator integrates circular and straight representations of Fibonacci levels, specifically the Circular , Orthogonal , Sloped , and Horizontal shape options. The geometric principles behind these shapes differ significantly, requiring distinct scaling methods for accurate representation. The Circular shape employs logarithmic scaling with radial expansion, where the distance from a central point determines the level's position, creating partial circles that align with TradingView's built-in Fibonacci Circle tool. The other three shapes utilize geometric progression scaling for linear extension from a starting point, resulting in straight lines that align with TradingView's built-in Fibonacci retracement and extension tools. Due to these distinct geometric foundations and scaling methods, perfectly aligning both the partial circles and straight lines simultaneously is mathematically constrained, though any differences are typically visually imperceptible.
The Circular shape's partial circles are calculated and scaled to align with TradingView's built-in Fibonacci Circles. These circles are plotted from the second swing point onward. This approach ensures consistent and accurate visualization across all market types, including those with gaps or closed sessions, which unlike 24/7 markets, do not have a direct one-to-one correspondence between bar indices and time. To maintain accurate geometric proportions across varying chart scales, the indicator calculates an aspect ratio by normalizing the proportional difference between vertical (price) and horizontal (time) distances of the swing points. This normalization factor ensures geometric shapes maintain their mathematical properties regardless of price scale magnitude or time period span, while maintaining the correct proportions of the geometric constructions at any chart zoom level.
The indicator automatically applies the appropriate scaling factor based on the selected shape option, optimizing either circular proportions and proper radius calculations for each Fibonacci level, or straight-line relationships between Fibonacci levels. These distinct scaling approaches maintain mathematical integrity while preserving the essential characteristics of each geometric representation, ensuring optimal visualization accuracy whether using circular or linear shapes.
⚠️ DISCLAIMER ⚠️
The Fibonacci Time-Price Zones indicator is a visual analysis tool designed to illustrate Fibonacci relationships through geometric constructions incorporating both curved and straight lines, providing a structured framework for identifying potential areas of price interaction. It is not intended as a predictive or standalone trading signal indicator.
The indicator calculates levels and projections using user-defined anchor points and Fibonacci ratios. While it aims to align with TradingView’s Fibonacci extension, retracement, and circle tools by employing mathematical and geometric formulas, no guarantee is made that its calculations are identical to TradingView's proprietary methods.
Like all technical and visual indicators, these visual representations may visually align with key price zones in hindsight, reflecting observed price dynamics. However, these visualizations are not standalone signals for trading decisions and should be interpreted as part of a broader analytical approach.
This indicator is intended for educational and analytical purposes, complementing other tools and methods of market analysis. Users are encouraged to integrate it into a comprehensive trading strategy, customizing its settings to suit their specific needs and market conditions.
🧠 BEYOND THE CODE 🧠
The Fibonacci Time-Price Zones indicator is designed to encourage both education and community engagement. By integrating time-sensitive geometry with Fibonacci-based frameworks, it bridges traditional grid-based analysis with dynamic time-price relationships. The inclusion of semicircles, horizontal levels, orthogonal structures, and sloped trends provides users with versatile tools to explore the interaction between price movements and temporal intervals while maintaining clarity and adaptability.
As an open-source tool, the indicator invites exploration, experimentation, and customization. Whether used as a standalone resource or alongside other technical strategies, it serves as a practical and educational framework for understanding market structure and Fibonacci relationships in greater depth.
Your feedback and contributions are essential to refining and enhancing the Fibonacci Time-Price Zones indicator. We look forward to the creative applications, adaptations, and insights this tool inspires within the trading community.
Inside Bar Multi-Currency ScannerInside Bar Scanner
This indicator for TradingView scans up to 10 customizable assets across multiple, user-defined timeframes to detect Inside Bar patterns. It features two key columns: Ready and Cooking. The Ready column highlights when the previous candle has formed an Inside Bar, signaling traders to watch for potential entry triggers. The Cooking column actively monitors the current candle in progress to identify ongoing Inside Bar formations. The indicator allows full customization of asset lists and independent timeframe selection, making it a powerful tool for multi-timeframe analysis and enhancing trading precision.
Adaptive Volatility-Scaled Oscillator [AVSO] (Zeiierman)█ Overview
The Adaptive Volatility-Scaled Oscillator (AVSO) is a dynamic trading indicator that measures and visualizes volatility-adjusted market behavior. By scaling various metrics (such as volume, price changes, standard deviation, ATR, and Yang-Zhang volatility) and applying adaptive smoothing, AVSO helps traders identify market conditions where volatility deviates significantly from the norm.
This indicator uses standardized scaling (Z-Score logic) to highlight periods of abnormally high or low volatility relative to recent history. With gradient coloring and clear volatility zones, AVSO provides a visually intuitive way to analyze market volatility and adapt trading strategies accordingly.
█ How It Works
⚪ Scaling Metrics: The indicator scales user-selected metrics (e.g., volume, ATR, standard deviation) relative to the market and price, providing a standardized volatility measure.
⚪ Z-Score Standardization: The scaled metric is normalized using a Z-Score to measure how far current volatility deviates from its recent mean.
Positive Z-Score: Above-average volatility.
Negative Z-Score: Below-average volatility.
⚪ Adaptive Smoothing: An Adaptive EMA smooths the Z-Score, dynamically adjusting its length based on the strength of the volatility. Stronger deviations result in shorter smoothing, increasing responsiveness.
█ Unique Feature: Yang-Zhang Volatility
The Yang-Zhang volatility estimator sets this indicator apart by providing a more robust and accurate measure of volatility compared to traditional methods like ATR or standard deviation.
⚪ What Makes Yang-Zhang Volatility Unique?
Comprehensive Calculation: It combines overnight price gaps (log returns from the previous close to the current open) and intraday price movements (high, low, and close).
Accurate for Gapped Markets: Traditional volatility measures can misrepresent price movement when significant gaps occur between sessions. Yang-Zhang accounts for these gaps, making it highly reliable for assets prone to overnight price jumps, such as stocks, cryptocurrencies, and futures.
Adaptable to Real Market Conditions : By including both close-to-open returns and intraday volatility, it provides a balanced and adaptive measure that captures the full volatility picture.
⚪ Why This Matters to Traders
Better Volatility Insights: Yang-Zhang offers a clearer view of true market volatility, especially in markets with price gaps or uneven trading sessions.
Improved Trade Timing: By identifying volatility spikes and calm periods more effectively, traders can time their entries and exits with greater confidence.
█ How to Use
Identify High and Low Volatility
A high Z-Score (>2) indicates significant market volatility. This can signal momentum-driven moves, breakouts, or areas of increased risk.
A low Z-Score (<-2) suggests low volatility or a calm market environment. This often occurs before a potential breakout or reversal.
Trade Signals
High Volatility Zones (background highlight): Monitor for potential breakouts, trend continuations, or reversals.
Low Volatility Zones: Anticipate range-bound conditions or upcoming volatility spikes.
█ Settings
Source: Select the price source for scaling calculations (close, high, low, open).
Metric Measure: Choose the volatility measure:
Volume: Scales raw volume.
Close: Uses closing price changes.
Standard Deviation: Price dispersion.
ATR: Average True Range.
Yang: Yang-Zhang volatility estimate.
Bars to Analyze: Number of historical bars used to calculate the mean and standard deviation of the scaled metric.
ATR / Standard Deviation Period: Lookback period for ATR or Standard Deviation calculation.
Yang Volatility Period: Period for the Yang-Zhang volatility estimator.
Smoothing Period: Base smoothing length for the adaptive smoothing line.
-----------------
Disclaimer
The information contained in my Scripts/Indicators/Ideas/Algos/Systems does not constitute financial advice or a solicitation to buy or sell any securities of any type. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
My Scripts/Indicators/Ideas/Algos/Systems are only for educational purposes!
MVRVZ - MVRVZ Top and Bottom Indicator for ETH [Da_Prof]Market Value-Realized Value Z-score (MVRVZ) for ETH - The MVRV-Z score measures the value of the Ethereum network by comparing its market cap to the realized value and dividing by the standard deviation of the market cap (market cap – realized cap) / stdev(market cap). When the market value is significantly higher than the realized value, the Ethereum network is "overvalued". Very high values have generally signaled price tops in the past and low values have signaled bottoms. For tops, the default trigger value is above 3.85 (default). For bottoms, the indicator is triggered when the MVRVZ is below -0.25 (default). These trigger values can be modified.
Support and Resistance Non-Repainting [AlgoAlpha]Elevate your technical analysis with the Non-Repainting Support and Resistance indicator from AlgoAlpha. Designed for traders who value precision, this tool highlights key support and resistance zones without repainting, ensuring reliable signals for better market decisions.
Key Features
🔍 Concise Zones: Identifies critical levels in real-time without repainting.
🖍 Customizable Appearance: Choose your preferred colors for bullish and bearish zones.
📏 Pivot Sensitivity Settings: Adjust the lookback period to fit different market conditions.
🔔 Visual Alerts: Highlights zones on your chart with clear, dynamic boxes and lines.
How to Use
Add the Indicator : Add it to your favorites chart by clicking the star icon. Adjust the lookback period, max zone duration, and colors to match your strategy.
Analyze the Chart : Look for zones where prices frequently react, indicating strong support or resistance.
Set Alerts : Enable notifications for new zone formations and zone invalidations, ensuring you never miss critical market moves.
How It Works
The indicator detects pivot highs and lows using a specified lookback period. When a pivot is confirmed, it draws corresponding support or resistance zones using TradingView’s built-in drawing tools. These zones extend until price breaks through them or they expire based on a maximum allowed duration. The indicator continuously checks if price interacts with any active zones and adjusts accordingly, ensuring accurate and real-time visualization.
[blackcat] L1 Swing Reversal█ OVERVIEW
The script is an indicator that calculates and plots the L1 Swing Reversal, which involves smoothing price data and calculating a modified RSI to identify potential swing reversals in the market. It overlays columns representing the smoothed price data and a line for the adjusted RSI.
█ LOGICAL FRAMEWORK
The script begins by defining input parameters for customizable periods. It then calculates the typical price, derives components of the swing reversal indicator, smooths these components, and computes an adjusted RSI. The main sections include input parameter definitions, function definition, and plotting. The script flows data through calculations and logical operations to produce final plot values.
█ CUSTOM FUNCTIONS
Function: l1_swing_reversal
This function calculates the L1 Swing Reversal indicators based on high, low, close, and open prices, along with three periods. It computes a smoothed price component and an adjusted RSI.
Parameters:
• high : High prices of the asset.
• low : Low prices of the asset.
• close : Close prices of the asset.
• period_n : Period for the first component calculation.
• period_m : Period for standard deviation and moving average calculations.
• period_n1 : Period for RSI calculation.
Return Values:
• cc1_column_red : Red column values for the first component.
• cc1_column_green : Green column values for the first component.
• rsi : Adjusted RSI values.
█ KEY POINTS AND TECHNIQUES
The script uses several key Pine Script features such as the sma (simple moving average), stdev (standard deviation), max, abs, and ema (exponential moving average) functions. It also demonstrates the use of conditional operators to cap the column values at -100 and 100. The script’s structure is clear and follows best practices by encapsulating the main logic within a function and using descriptive variable names.
█ EXTENDED KNOWLEDGE AND APPLICATIONS
Potential modifications could include adding more sophisticated reversal signals based on the RSI and column values, or enhancing the visualization with additional plot types. This script could be used in scenarios where traders are interested in identifying potential swing reversals using a combination of smoothed price data and momentum indicators. Related Pine Script concepts include using barssince for counting bars since a condition, crossover and crossunder for detecting trend changes, and hline for adding horizontal lines to the chart.
Alternate Bat Harmonic Pattern [TradingFinder] ALT Bat Indicator🔵 Introduction
The Alternate Bat harmonic pattern is one of the most precise and practical tools in technical analysis, introduced by Scott Carney in 2003. This pattern focuses on specific Fibonacci ratios, such as 0.382 at point B and 1.13XA at point D, to identify Potential Reversal Zones (PRZ) where price is likely to reverse.
The Alternative Bat pattern emerged as a result of repeated failures observed in the standard Bat pattern. Traders entering trades near the 0.886XA level of the standard Bat often encountered losses. In the Alternate Bat, point D extends beyond 0.886XA, typically reversing at 1.13XA, offering a more accurate identification of the reversal zone.
A key characteristic of this pattern is its M- or W-shaped structure, where the midpoint B retraces 0.382XA or less. Additionally, the CD leg requires an extension of 2.0 to 3.618 to complete the pattern. Due to its accuracy and the predictable behavior of price near the PRZ, the Alternate Bat pattern is recognized as a powerful tool for forecasting price reversals.
In the bullish Alternative Bat pattern, an M-shaped structure forms. After an initial upward movement (XA), price undergoes a short correction at point B (0.382XA) and then declines toward point D (1.13XA and an extension of 2.0 to 3.618BC), where a potential upward reversal is expected.
In the bearish Alternate Bat pattern, a W-shaped structure forms. After an initial downward movement (XA), price retraces slightly at point B (0.382XA) and then rises toward point D (1.13XA and an extension of 2.0 to 3.618BC), where a potential downward reversal is anticipated.
🔵 How to Use
The Alternate Bat harmonic pattern is a key tool for identifying potential reversal zones (PRZ) in the market. By leveraging the 0.382 retracement at point B and the 1.13XA extension at point D, along with symmetrical price structures, this pattern offers precise reversal opportunities in both bullish and bearish market conditions.
🟣 Bullish Alternate Bat Pattern
The bullish Alternate Bat pattern forms during a downtrend, signaling a potential reversal to the upside. This pattern consists of three downward movements with two corrective waves, ultimately reaching point D, which marks the PRZ.
At the PRZ, the convergence of Fibonacci levels—1.13XA and extensions ranging from 2.0 to 3.618BC—creates a strong support zone where price is likely to reverse upward.
🟣 Bearish Alternative Bat Pattern
The bearish Alternate Bat pattern develops during an uptrend, indicating a potential reversal to the downside. This pattern features three upward price movements with two retracements, ending at point D, where the PRZ forms.
Point D is defined by the 1.13XA extension and the 2.0 to 3.618BC projection, creating a strong resistance zone where price is expected to reverse downward.
🔵 Setting
🟣 Logical Setting
ZigZag Pivot Period : You can adjust the period so that the harmonic patterns are adjusted according to the pivot period you want. This factor is the most important parameter in pattern recognition.
Show Valid Format : If this parameter is on "On" mode, only patterns will be displayed that they have exact format and no noise can be seen in them. If "Off" is, the patterns displayed that maybe are noisy and do not exactly correspond to the original pattern.
Show Formation Last Pivot Confirm : if Turned on, you can see this ability of patterns when their last pivot is formed. If this feature is off, it will see the patterns as soon as they are formed. The advantage of this option being clear is less formation of fielded patterns, and it is accompanied by the latest pattern seeing and a sharp reduction in reward to risk.
Period of Formation Last Pivot : Using this parameter you can determine that the last pivot is based on Pivot period.
🟣 Genaral Setting
Show : Enter "On" to display the template and "Off" to not display the template.
Color : Enter the desired color to draw the pattern in this parameter.
LineWidth : You can enter the number 1 or numbers higher than one to adjust the thickness of the drawing lines. This number must be an integer and increases with increasing thickness.
LabelSize : You can adjust the size of the labels by using the "size.auto", "size.tiny", "size.smal", "size.normal", "size.large" or "size.huge" entries.
🟣 Alert Setting
Alert : On / Off
Message Frequency : This string parameter defines the announcement frequency. Choices include: "All" (activates the alert every time the function is called), "Once Per Bar" (activates the alert only on the first call within the bar), and "Once Per Bar Close" (the alert is activated only by a call at the last script execution of the real-time bar upon closing). The default setting is "Once per Bar".
Show Alert Time by Time Zone : The date, hour, and minute you receive in alert messages can be based on any time zone you choose. For example, if you want New York time, you should enter "UTC-4". This input is set to the time zone "UTC" by default.
🔵 Conclusion
The Alternate Bat harmonic pattern, with its precise Fibonacci ratios like 0.382 and 1.13XA, is a reliable tool for identifying Potential Reversal Zones (PRZ) in financial markets. By recognizing symmetrical price structures and focusing on both bullish and bearish scenarios, traders can identify optimal entry and exit points with high accuracy.
The key strength of this pattern lies in its ability to define strong support and resistance zones near the PRZ, increasing the probability of price reversals. Combining the pattern with candlestick confirmations and volume analysis enhances its effectiveness.
Ultimately, incorporating the Alternative Bat pattern with proper risk management and Fibonacci-based targets allows traders to enter the market confidently and capitalize on potential price reversals.
TASC 2025.01 Linear Predictive Filters█ OVERVIEW
This script implements a suite of tools for identifying and utilizing dominant cycles in time series data, as introduced by John Ehlers in the "Linear Predictive Filters And Instantaneous Frequency" article featured in the January 2025 edition of TASC's Traders' Tips . Dominant cycle information can help traders adapt their indicators and strategies to changing market conditions.
█ CONCEPTS
Conventional technical indicators and strategies often rely on static, unchanging parameters, which may fail to account for the dynamic nature of market data. In his article, John Ehlers applies digital signal processing principles to address this issue, introducing linear predictive filters to identify cyclic information for adapting indicators and strategies to evolving market conditions.
This approach treats market data as a complex series in the time domain. Analyzing the series in the frequency domain reveals information about its cyclic components. To reduce the impact of frequencies outside a range of interest and focus on a specific range of cycles, Ehlers applies second-order highpass and lowpass filters to the price data, which attenuate or remove wavelengths outside the desired range. This band-limited analysis isolates specific parts of the frequency spectrum for various trading styles, e.g., longer wavelengths for position trading or shorter wavelengths for swing trading.
After filtering the series to produce band-limited data, Ehlers applies a linear predictive filter to predict future values a few bars ahead. The filter, calculated based on the techniques proposed by Lloyd Griffiths, adaptively minimizes the error between the latest data point and prediction, successively adjusting its coefficients to align with the band-limited series. The filter's coefficients can then be applied to generate an adaptive estimate of the band-limited data's structure in the frequency domain and identify the dominant cycle.
█ USAGE
This script implements the following tools presented in the article:
Griffiths Predictor
This tool calculates a linear predictive filter to forecast future data points in band-limited price data. The crosses between the prediction and signal lines can provide potential trade signals.
Griffiths Spectrum
This tool calculates a partial frequency spectrum of the band-limited price data derived from the linear predictive filter's coefficients, displaying a color-coded representation of the frequency information in the pane.
Griffiths Dominant Cycle
This tool compares the cyclic components within the partial spectrum and identifies the frequency with the highest power, i.e., the dominant cycle . Traders can use this dominant cycle information to tune other indicators and strategies, which may help promote better alignment with dynamic market conditions.
Notes on parameters
Bandpass boundaries:
In the article, Ehlers recommends an upper bound of 125 bars or higher to capture longer-term cycles for position trading. He recommends an upper bound of 40 bars and a lower bound of 18 bars for swing trading. If traders use smaller lower bounds, Ehlers advises a minimum of eight bars to minimize the potential effects of aliasing.
Data length:
The Griffiths predictor can use a relatively small data length, as autocorrelation diminishes rapidly with lag. However, for optimal spectrum and dominant cycle calculations, the length must match or exceed the upper bound of the bandpass filter. Ehlers recommends avoiding excessively long lengths to maintain responsiveness to shorter-term cycles.
0dte Anchored Expected Move by SyntaxGeekHere is a script that's making use of TradingView's new option data feed, without the OPRA data feed I'm unsure this script will be useful as the data will be delayed and I've not tested it without the data subscription.
The script is meant to demonstrate use of options data to generate ideas in the community and perhaps be a useful tool for 0dte traders.
For securities that have 0dte I like to calculate what I call the "opening expected move", it's just like expected move (EM) but it's a snapshot of the EM value at open and remains static throughout the day.
Expected move is the value of an "at the money" (ATM) call and put combined and then added t the price of the underlying.
For example if SPY opens at 600 and the ATM call + put premium (debit) is 3 dollars, then the EM high is 603 and the EM low is 597.
These levels are often areas where the market will react as any breaches of these prices could potentially be something that market participants will have to respond to being that something has hit the market unexpectedly.
Additionally, I've added calculations for half EM plots and live premium calculations for the ATM call and put from the open.
It's a fascinating script and it's fun to watch the premiums during periods of market volatility or a chop range day.
I make no guarantees for any of the data presented and there could be bugs as options data is still quite new in TradingView and I've not spent a long time coding this or testing.
Enjoy!
Pivot Highs/Lows with Bar CountsWhat does the indicator do?
This indicator adds labels to a chart at swing (a.k.a., "pivot") highs and lows. Each label may contain a date, the closing price at the swing, the number of bars since the last swing in the same direction, and the number of bars from the last swing in the opposite direction. A table is also added to the chart that shows the average, min, and max number of bars between swings.
OK, but how do I use it?
Many markets -- especially sideways-moving ones -- commonly cycle between swing highs and lows at regular time intervals. By measuring the number of bars between highs and lows -- both same-sided swings (i.e., H-H and L-L) and opposite-sided swings (i.e., H-L and L-H) -- you can then project the averages of those bar counts from the last high or low swing to make predictions about where the next swing high or low should occur. Note that this indicator does not make the projection for you. You have to determine which swing you want to project from and then use the bar counts from the indicator to draw a line, place a label, etc.
Example: Chart of BTC/USD
The indicator shows pivot highs and lows with bar counts, and it displays a table of stats on those pivots.
If you focus on the center section of the chart, you can see that prices were moving in a sideways channel with very regular highs and lows. This indicator counts the bars between these pivots, and you could have used those counts to predict when the next high or low may have occurred.
The bar counts do not work as well on the more recent section of the chart because there are no regularly time swings.
Up and Downwhat is "Up and Down"?
It is an indicator designed to show you in detail on the chart and warn you when there is an increase or decrease in the market at a level that you consider important.
what it does?
When the price difference between a top and bottom is greater than the level you selected (the default input is 10 percent), it indicates this along with the percentage value on the chart. Then, it indicates the start and end points with lines so that you can see the change from where to where. It shows the price's current percentage distance from the last bottom or top in the upper right corner.
it also colors the candles so you can better understand how fast the price is moving. The greener the candles, the stronger the rise, and conversely, the greater the decline, the redder the candles. Of course, if you set an alarm, it will tell you in which trading pair, in which time period, at what percentage and in which direction there is a movement.
how it does it?
It uses a moving average with a short length to find bottoms and tops. It then measures the distance from the last peak to the bottom and expresses it as a percentage. It uses momentum using the moving average as a source to paint the candles. To compress this momentum between the values 255 and 0, I used a formula that I also used in my limited fisher transform work (because the inputs in the color.rgb function take values between 0 and 255). It was a bit challenging to use the lines correctly, but with the "ta.valuewhen" function and a little experimenting, they were I made sure they were drawn correctly.
how to use it?
It is quite simple to use. First, select the minimum interval you want to receive alarms. If you make this value too high, you will not receive any alarms; if you make it too low, you will receive too many alarms. Choose the range that will benefit you most for the trading pair you are using. Then all you have to do is set an alarm. When you set an alarm, leave the note section blank and the indicator will send you the necessary information.
BKLevelsThis displays levels from a text input, levels from certain times on the previous day, and high/low/close from previous day. The levels are drawn for the date in the first line of the text input. Newlines are required between each level
Example text input:
2024-12-17
SPY,606,5,1,Lower Hvol Range,FIRM
SPY,611,1,1,Last 20K CBlock,FIRM
SPY,600,2,1,Last 20K PBlock,FIRM
SPX,6085,1,1,HvolC,FIRM
SPX,6080,2,1,HvolP,FIRM
SPX,6095,3,1,Upper PDVR,FIRM
SPX,6060,3,1,Lower PDVR,FIRM
For each line, the format is ,,,,,
For color, there are 9 possible user- configurable colors- so you can input numbers 1 through 9
For line style, the possible inputs are:
"FIRM" -> solid line
"SHORT_DASH" -> dotted line
"MEDIUM_DASH" -> dashed line
"LONG_DASH" -> dashed line
Ema Support & Resistance With Signals [ClarifyChart]Use Case
This indicator is designed for traders who seek to identify key reversal points in the market based on dynamic support and resistance levels. The tool is especially useful for swing traders and trend-followers who rely on price reversals near key levels of support and resistance. By combining exponential moving averages (EMA) with the Average True Range (ATR), this script dynamically adjusts the support and resistance bands to reflect market volatility, helping traders stay aligned with the prevailing trend while spotting potential reversal opportunities.
Logic
The core of the indicator is built around dynamic EMAs that act as support and resistance levels, which adjust according to market volatility (calculated using ATR). These levels form a range in which price is expected to either reverse or continue its movement. The EMA-based support and resistance levels are calculated at multiple distances, allowing traders to identify significant zones where price may change direction. The indicator also integrates a buffer percentage to avoid too many signals by ensuring the price is a reasonable distance from the support or resistance level before a reversal is triggered.
Signal Logic
Reversal signals are generated based on the following conditions:
Bullish Reversal: If the price crosses below a support level by a predefined buffer percentage and then moves back above it, a bullish signal is triggered.
Bearish Reversal: If the price crosses above a resistance level by the buffer percentage and then moves back below it, a bearish signal is generated. These conditions are designed to capture the most relevant reversal points while minimizing false signals.
Example Trade
Let’s say the price is approaching a support level (sup_ma1) and crosses below it by 0.5% (defined by the buffer). If the price then starts to rise back above this support level, a bullish reversal signal will appear. A trader might enter a long position once the price crosses back above the support level, expecting a price increase. Similarly, if the price hits a resistance level (res_ma1) and then reverses downward, a bearish signal would indicate an opportunity to enter a short position.
Flaws
While the indicator is designed to capture major reversals, there are some limitations:
False signals in choppy markets: The indicator may trigger occasional false signals in sideways or range-bound markets, especially if the price crosses support/resistance levels multiple times without a true reversal.
Lagging indicators: Like most trend-following systems, this indicator might not always catch the very beginning of a reversal, especially during high volatility periods.
Over-sensitivity: If the buffer percentage is set too small, the indicator might generate too many signals, leading to overtrading or confusion.
Overall, this tool can be a valuable part of a trader's strategy when combined with other technical indicators or used in markets where price is likely to respect key support and resistance zones.
Heikin Ashi Signals with Positions -Suraj// Signal Conditions
newBuySignal = not inBuy and not inShort and haClose > haClose
newSellSignal = not inShort and inBuy and haHigh < haHigh and haLow > haLow // Inside Candle
newShortSignal = not inShort and not inBuy and haOpen == haHigh
newCoverSignal = inShort and haClose > haHigh
Custom RSI & MACD Momentum Entry SignalsIndicator Explanation: Custom RSI & MACD Momentum Entry Signals
Introduction
The "Custom RSI & MACD Momentum Entry Signals" indicator combines the Relative Strength Index (RSI) and the Moving Average Convergence Divergence (MACD) to generate precise long and short entry signals. This indicator offers a powerful combination of overbought/oversold zones, momentum analysis, and RSI-EMA crossovers to assist traders in making better decisions.
How the Indicator Works
1. RSI Calculation and EMA
The RSI is calculated based on the closing price with an adjustable period (default: 14).
An Exponential Moving Average (EMA) of the RSI (default: 9) is plotted to identify RSI trend changes.
When the RSI crosses its EMA upwards, it signals a bullish impulse. Conversely, a downward cross indicates a bearish impulse.
2. MACD Calculation and Momentum Shifts
The MACD line is derived from the difference between a fast EMA (default: 12) and a slow EMA (default: 26).
The Signal line is the EMA of the MACD line (default: 9).
The MACD histogram represents the difference between the MACD line and the Signal line.
Momentum shifts are detected as follows:
Weakening Bearish: Histogram is negative but increasing (less bearish pressure).
Strengthening Bullish: Histogram is positive and rising.
Weakening Bullish: Histogram is positive but decreasing.
Strengthening Bearish: Histogram is negative and falling.
Signal Generation
Long Signals
A Long signal is triggered when all of the following conditions are met:
The RSI was previously below 30 (oversold condition).
MACD momentum shifts from "strengthening bearish" to "weakening bearish" or turns bullish.
The RSI crosses its EMA upwards.
A green upward arrow is displayed below the bar, and the background is lightly shaded green for additional visualization.
Short Signals
A Short signal is triggered when all of the following conditions are met:
The RSI was previously above 70 (overbought condition).
MACD momentum shifts from "strengthening bullish" to "weakening bullish" or turns bearish.
The RSI crosses its EMA downwards.
A red downward arrow is displayed above the bar, and the background is lightly shaded red for additional visualization.
Visual Elements
RSI and EMA:
The RSI is shown in purple.
The RSI EMA is shown in blue.
Horizontal lines at 30 (oversold) and 70 (overbought) provide additional context.
MACD:
The MACD line is displayed in blue.
The Signal line is displayed in orange.
The zero line is added for easier interpretation.
Signals:
Green arrows: Long signals.
Red arrows: Short signals.
Background color: Light green for long conditions, light red for short conditions.
Use Cases
This indicator is ideal for:
Trend Followers: Combining RSI and MACD allows traders to identify entry points during impulsive trend shifts.
Swing Traders: Long and short signals can be used at reversal points to capture short-term price movements.
Momentum Traders: By considering MACD momentum, the indicator provides additional confidence in signal generation.
Customizable Settings
The indicator provides flexible input options:
RSI Period (default: 14)
RSI EMA Period (default: 9)
MACD Parameters: Fast, slow, and signal EMAs can be adjusted.
Conclusion
The Custom RSI & MACD Momentum Entry Signals indicator is a powerful tool for traders looking to combine RSI and MACD to identify high-probability entry signals. With clear visualization and precise signal generation, traders can make decisions more efficiently and capitalize on market movements.
Fractal levels Gold [AstroHub]This indicator detects key fractal points on a price chart and visually marks them with shapes and levels. It helps traders identify potential reversal zones and dynamic support/resistance levels, enhancing market analysis.
Key Features:
Fractal Detection:
The indicator identifies top and bottom fractals using a 5-bar pattern.
A top fractal forms when the middle bar has a higher high compared to the two bars on either side.
A bottom fractal forms when the middle bar has a lower low compared to the two bars on either side.
Fractal Filtering:
The indicator can filter out "pristine" fractals (uninterrupted fractal patterns) based on custom conditions, making it more selective and reducing false signals.
Fractal Plotting:
are plotted as downward triangles.
are plotted as upward triangles.
Users can choose to display or hide fractal points and their corresponding labels.
Fractal Levels:
The indicator automatically plots fractals' levels on the chart, marking potential resistance and support zones.
Fractal levels change dynamically as new fractals are identified.
Customizable Display Options:
Show or hide fractals and levels with adjustable settings.
Choose whether to apply filtering for pristine fractals.
Display the pivot labels to easily track fractal positions.
How It Works:
The indicator uses a simple approach to recognize top and bottom fractals . When a valid fractal is detected, it highlights it on the chart and plots the corresponding price level.
By default, top fractals are shown above the bars (red color), and bottom fractals are shown below the bars (green color).
Fractal levels represent potential reversal points and can act as dynamic support and resistance zones.
Best Use:
The indicator is particularly useful in identifying reversal points and trend changes, helping traders to spot key price levels.
It can be used across various timeframes and markets, particularly for trend-following or reversal strategies.
Customizable Settings:
Show Pivots: Toggle the display of pivot points.
Show Pivot Labels: Display labels for pivot levels.
Show Fractals: Toggle fractal points on the chart.
Show Fractal Levels: Show or hide the levels corresponding to the detected fractals.
Filter for Pristine Fractals: Enable this option to filter out non-pristine fractals for higher accuracy.
Conclusion:
This indicator provides clear, actionable fractal signals, helping traders easily identify critical levels for entry and exit. With customizable settings and visual cues, it's suitable for both novice and expe
Hamming Trend Visualizer (HTV)This script applies John Ehlers' Hamming Moving Average (HMA) to smooth price data and detects trends with color-coded visualizations. It also generates alerts for significant trend changes.
How to Use:
1. Monitor the bar/candle colors to identify trends and their strength:
Strong green → Robust uptrend
Strong red → Robust downtrend
2. Use the plotted HMA line as confirmation for trend direction.
3. Watch for alerts signaling significant trend shifts:
Crossover above 1 → Strong Buy
Crossunder below -1 → Strong Sell
4. Adjust the Length and Pedestal inputs to fine-tune the indicator's sensitivity for shorter or longer-term strategies.
AI based Buy/Sell Signalpure AI based signal
we generate this code for help people who cant afford paid subscription of indicators
this is proper AI based data indicator
Dynamic Customizable 50% LineThis indicator is for finding the 50% level of the selected range.
Why would you need this? Because price likes to react from the 50% of the daily range.
With this indicator you can select the timeframe of choice and it will calculate the 50% level of it. You also can select the colour you want and change line thickness
Updates will come in the future. Good luck trading
Greetings
APKO
AdibXmos v1// © Adib2024
//@version=5
indicator('AdibXmos ', overlay=true, max_labels_count=500)
show_tp_sl = input.bool(true, 'Display TP & SL', group='Techical', tooltip='Display the exact TP & SL price levels for BUY & SELL signals.')
rrr = input.string('1:2', 'Risk to Reward Ratio', group='Techical', options= , tooltip='Set a risk to reward ratio (RRR).')
tp_sl_multi = input.float(1, 'TP & SL Multiplier', 1, group='Techical', tooltip='Multiplies both TP and SL by a chosen index. Higher - higher risk.')
tp_sl_prec = input.int(2, 'TP & SL Precision', 0, group='Techical')
candle_stability_index_param = 0.5
rsi_index_param = 70
candle_delta_length_param = 4
disable_repeating_signals_param = input.bool(true, 'Disable Repeating Signals', group='Techical', tooltip='Removes repeating signals. Useful for removing clusters of signals and general clarity.')
GREEN = color.rgb(29, 255, 40)
RED = color.rgb(255, 0, 0)
TRANSPARENT = color.rgb(0, 0, 0, 100)
label_size = input.string('huge', 'Label Size', options= , group='Cosmetic')
label_style = input.string('text bubble', 'Label Style', , group='Cosmetic')
buy_label_color = input(GREEN, 'BUY Label Color', inline='Highlight', group='Cosmetic')
sell_label_color = input(RED, 'SELL Label Color', inline='Highlight', group='Cosmetic')
label_text_color = input(color.white, 'Label Text Color', inline='Highlight', group='Cosmetic')
stable_candle = math.abs(close - open) / ta.tr > candle_stability_index_param
rsi = ta.rsi(close, 14)
atr = ta.atr(14)
bullish_engulfing = close < open and close > open and close > open
rsi_below = rsi < rsi_index_param
decrease_over = close < close
var last_signal = ''
var tp = 0.
var sl = 0.
bull_state = bullish_engulfing and stable_candle and rsi_below and decrease_over and barstate.isconfirmed
bull = bull_state and (disable_repeating_signals_param ? (last_signal != 'buy' ? true : na) : true)
bearish_engulfing = close > open and close < open and close < open
rsi_above = rsi > 100 - rsi_index_param
increase_over = close > close
bear_state = bearish_engulfing and stable_candle and rsi_above and increase_over and barstate.isconfirmed
bear = bear_state and (disable_repeating_signals_param ? (last_signal != 'sell' ? true : na) : true)
round_up(number, decimals) =>
factor = math.pow(10, decimals)
math.ceil(number * factor) / factor
if bull
last_signal := 'buy'
dist = atr * tp_sl_multi
tp_dist = rrr == '2:3' ? dist / 2 * 3 : rrr == '1:2' ? dist * 2 : rrr == '1:4' ? dist * 4 : dist
tp := round_up(close + tp_dist, tp_sl_prec)
sl := round_up(close - dist, tp_sl_prec)
if label_style == 'text bubble'
label.new(bar_index, low, 'BUY', color=buy_label_color, style=label.style_label_up, textcolor=label_text_color, size=label_size)
else if label_style == 'triangle'
label.new(bar_index, low, 'BUY', yloc=yloc.belowbar, color=buy_label_color, style=label.style_triangleup, textcolor=TRANSPARENT, size=label_size)
else if label_style == 'arrow'
label.new(bar_index, low, 'BUY', yloc=yloc.belowbar, color=buy_label_color, style=label.style_arrowup, textcolor=TRANSPARENT, size=label_size)
label.new(show_tp_sl ? bar_index : na, low, 'TP: ' + str.tostring(tp) + ' SL: ' + str.tostring(sl), yloc=yloc.price, color=color.gray, style=label.style_label_down, textcolor=label_text_color)
if bear
last_signal := 'sell'
dist = atr * tp_sl_multi
tp_dist = rrr == '2:3' ? dist / 2 * 3 : rrr == '1:2' ? dist * 2 : rrr == '1:4' ? dist * 4 : dist
tp := round_up(close - tp_dist, tp_sl_prec)
sl := round_up(close + dist, tp_sl_prec)
if label_style == 'text bubble'
label.new(bear ? bar_index : na, high, 'SELL', color=sell_label_color, style=label.style_label_down, textcolor=label_text_color, size=label_size)
else if label_style == 'triangle'
label.new(bear ? bar_index : na, high, 'SELL', yloc=yloc.abovebar, color=sell_label_color, style=label.style_triangledown, textcolor=TRANSPARENT, size=label_size)
else if label_style == 'arrow'
label.new(bear ? bar_index : na, high, 'SELL', yloc=yloc.abovebar, color=sell_label_color, style=label.style_arrowdown, textcolor=TRANSPARENT, size=label_size)
label.new(show_tp_sl ? bar_index : na, low, 'TP: ' + str.tostring(tp) + ' SL: ' + str.tostring(sl), yloc=yloc.price, color=color.gray, style=label.style_label_up, textcolor=label_text_color)
alertcondition(bull or bear, 'BUY & SELL Signals', 'New signal!')
alertcondition(bull, 'BUY Signals (Only)', 'New signal: BUY')
alertcondition(bear, 'SELL Signals (Only)', 'New signal: SELL')
TRTo anticipate that the market is entering a **trading range**, watch for the following early signs based on Al Brooks' price action strategies:
1. **Initial Doji Bar**: If the first bar of the day is a doji, it increases the chance of a trading range day because it reflects uncertainty and a lack of directional conviction.
2. **Multiple Reversals**: If there are **4-5 reversals** within the first hour of trading, this is a strong clue that the market is shifting into a range-bound mode. This two-sided trading behavior shows that neither bulls nor bears are gaining control.
3. **Weak Follow-Through**: When strong trend bars (bullish or bearish) lack follow-through in subsequent bars, it indicates that the market is not trending strongly and is more likely to stay range-bound.
4. **Tails and Overlapping Bars**: Look for:
- **Bars with prominent tails** (indicating rejection of highs/lows).
- **Bar overlap** of 50% or more with previous bars.
- **Doji bars** appearing frequently, as they signal indecision.
5. **Price Hovering Around the Moving Average**: If the price frequently crosses the moving average and the moving average becomes relatively flat, it often indicates a developing trading range.
6. **Failure of Breakouts**: Early breakout attempts (above or below prior highs/lows) that fail to sustain momentum and reverse back into the range signal the market is rejecting trends.
7. **Spike and Channel Pattern**: If a strong spike is followed by a shallow or sideways **channel**, this often serves as the first leg of a trading range.
8. **Lack of Momentum**: In trends, pullbacks are shallow and strong. In trading ranges, price action slows, moves horizontally, and legs subdivide into smaller two-legged moves.
### Summary:
Focus on reversals, bar overlap, failed breakouts, and lack of directional momentum within the first hour to spot a trading range early. Combining these signals improves your ability to switch to **range trading strategies**, such as fading the extremes of the range.