ATR (Average True Range) mit relative/absolute Zahlen GERMAN:
Schnelle Zusammenfassung:
Dieses Skript basiert auf dem ATR-Indikator und wurde so angepasst, dass sowohl relative (%) als auch absolute Zahlen angezeigt werden. Es bietet eine Darstellung des ATR in absoluten und prozentualen Werten sowie multipliziert mit den Faktoren x2, x2.5 und x3. Diese Darstellung erleichtert die Festlegung von Stop-Kursen, insbesondere für Trailing Stops und Trailing Abstände.
Periode:
Die Periode ist einstellbar und definiert die Länge der Berechnung des ATR (Standardwert: 14).
Glättung: Es stehen verschiedene Methoden zur Auswahl, um die Daten zu glätten (RMA, SMA, EMA, WMA).
Berechnungen:
ATR (Absolute Zahl): Berechnung der durchschnittlichen wahren Reichweite (ATR) unter Verwendung der ausgewählten Glättungsmethode und Periode.
ATR (Prozentualer Wert): Berechnung des ATR als Prozentsatz des aktuellen Schlusskurses.
Multiplikation des ATR: Berechnung des ATR multipliziert mit den Faktoren 2, 2.5 und 3 zur Einschätzung verschiedener Handelsszenarien.
Darstellung:
Absoluter ATR-Wert: Darstellung der absoluten ATR-Werte in Blau.
Relative ATR-Werte (%): Darstellung der prozentualen ATR-Werte, ohne Linie in der Grafik (transparent).
Multiplizierte ATR-Werte (x2, x2.5, x3): Darstellung der multiplizierten ATR-Werte in den Farben Grün (x2), Orange (x2.5) und Lila (x3).
Textbeschriftungen: Für jeden absoluten ATR-Wert und seine Multiplikationen werden Textbeschriftungen links im Chart angezeigt.
Verwendung des Indikators:
Dieser Indikator unterstützt Trader und Analysten dabei, die durchschnittliche wahre Reichweite (ATR) eines Finanzinstruments zu verstehen und zu visualisieren. Die verschiedenen Multiplikationen des ATR ermöglichen es, potenzielle Preisbewegungen zu analysieren und Handelsstrategien zu entwickeln, die auf der Volatilität basieren.
Hinweis:
Dies ist meine persönliche Meinung und Einstellung. Dieses Skript stellt keine Bankberatung oder Anlageempfehlung dar. Die Nutzung erfolgt auf eigenes Risiko und Verantwortung des Nutzers.
----------------------------------------------------------------------
ENGLISH:
Quick Summary:
This script is based on the ATR (Average True Range) indicator and has been modified to display both relative (%) and absolute values. It provides a representation of ATR in absolute and percentage terms, as well as multiplied by factors x2, x2.5, and x3. This visualization aids in setting stop-loss levels, especially for trailing stops and trailing distances.
Period:
The period is adjustable and defines the length of the ATR calculation (default: 14).
Smoothing: Various methods are available to smooth the data (RMA, SMA, EMA, WMA).
Calculations:
ATR (Absolute Value): Computes the Average True Range using the selected smoothing method and period.
ATR (Percentage Value): Calculates the ATR as a percentage of the current closing price.
Multiplication of ATR: Computes the ATR multiplied by factors 2, 2.5, and 3 to assess different trading scenarios.
Visualization:
Absolute ATR Value: Displays the absolute ATR values in blue.
Relative ATR Values (%): Shows the ATR values as percentages, without lines in the chart (transparent).
Multiplied ATR Values (x2, x2.5, x3): Presents the multiplied ATR values in green (x2), orange (x2.5), and purple (x3).
Text Labels: Text labels are shown on the left side of the chart for each absolute ATR value and its multiples.
Use of the Indicator:
This indicator helps traders and analysts understand and visualize the Average True Range (ATR) of a financial instrument. The different multipliers of ATR allow for the analysis of potential price movements and the development of trading strategies based on volatility.
Disclaimer:
This represents my personal opinion and viewpoint. This script does not constitute bank advice or investment recommendations. Use it at your own risk and responsibility.
볼래틸리티
ALT - ATR Percent Rank🔵 Description
The "ALT - ATR Percent Rank" indicator is a financial analysis tool designed to assess the volatility of an asset relative to its historical behavior, using the Average True Range (ATR) metric.
🔵 Purpose
The indicator aims to provide traders with insights into how the current volatility of an asset compares to its past levels. By evaluating the Percent Rank of the ATR, traders can determine if the current ATR value is high or low in the context of a specified historical period.
🔵 Functionality
• Asset and Timeframe Flexibility
Selectable Asset: Users can choose to apply the indicator to a different asset than the one currently displayed on the chart. This is particularly useful for comparing the volatility of multiple assets without switching charts.
Customizable Timeframe: The indicator can be set to analyze the ATR on different timeframes, regardless of the chart's current timeframe. This allows for multi-timeframe analysis without changing the view of the current chart.
• ATR Calculation
The Average True Range (ATR) is calculated over a user-defined number of bars (ATR Length). ATR is a commonly used measure of volatility that captures the degree of price movement per bar.
REF: Average True Range (ATR) Calculation
• Percent Rank Analysis
The indicator computes the Percent Rank of the current ATR value based on a specified lookback period (Percent Rank Lookback). This tells users how the current ATR compares to ATR values over the recent past, expressed as a percentile. For example, a Percent Rank of 90% indicates that the current ATR is higher than 90% of its values over the chosen lookback period, suggesting higher volatility.
• Visualization
The result is plotted as a line on a separate panel below the main trading chart, making it easy to view changes in volatility relative to historical levels.
🔵 Use Cases
• Trend Confirmation
Traders might use the indicator to confirm if a price movement is backed by significant volatility changes, which could validate the strength of a trend.
• Risk Management
Understanding when an asset is experiencing unusually high or low volatility could help in adjusting trading strategies, such as altering position sizes or setting stop-loss orders.
• Comparative Analysis
By enabling the analysis of different assets or timeframes, traders can perform comparative volatility studies, which can be essential in portfolio management or when seeking diversification opportunities.
This indicator is a valuable tool for traders who rely on volatility analysis to make informed trading decisions, providing a clear, quantifiable measure of how current market conditions compare to historical data.
Wyckoff Springs [QuantVue]The Wyckoff Springs indicator is designed to identify potential bullish reversal patterns known as "springs" in the Wyckoff Method. A Wyckoff spring occurs when the price temporarily dips below a support level, then quickly rebounds, suggesting a false breakdown and a
potential buying opportunity.
How it works:
Pivot detection:
The indicator identifies pivot lows based on the specified pivot length.
These pivot points are stored and analyzed for potential spring patterns.
Volume and Range Checks:
If volume confirmation is enabled, the indicator checks if the current volume exceeds a threshold based on the average volume over the specified period.
The indicator ensures that the price undercuts the defined trading range before confirming a spring pattern.
Spring Identification
The indicator checks for price conditions indicative of a Wyckoff spring: a temporary dip below a pivot low followed by a close above it. The recovery must take place within 3 bars.
If these conditions are met, a spring label is placed below the bar.
Features:
Pivot Length:
The user can set the pivot length to match any style of trading.
Volume Confirmation:
An optional feature where the user can specify if volume confirmation is required for a spring signal.
Volume threshold can be set to determine what constitutes significant volume compared to the average volume over a specified period. By default it is set to 1.5
How to Trade a Spring:
Give this indicator a BOOST and COMMENT your thoughts below!
We hope you enjoy.
Cheers!
MA MACD BB BackTesterOverview:
This Pine Script™ code provides a comprehensive backtesting tool that combines Moving Average (MA), Moving Average Convergence Divergence (MACD), and Bollinger Bands (BB). It is designed to help traders analyze market trends and make informed trading decisions by testing various strategies over historical data.
Key Features:
1. Customizable Indicators:
Moving Average (MA): Smooths out price data for clearer trend direction.
MACD: Measures trend momentum through MACD Line, Signal Line, and Histogram.
Bollinger Bands (BB): Identifies overbought or oversold conditions with upper and lower bands.
2. Flexible Trading Direction: Choose between long or short positions to adapt to different market conditions.
3. Risk Management: Efficiently allocate your capital with customizable position sizes.
4. Signal Generation:
Buy Signals: Triggered by crossovers for MACD, MA, and BB.
Sell Signals: Triggered by crossunders for MACD, MA, and BB.
5. Automated Trading: Automatically enter and exit trades based on signal conditions and strategy parameters.
How It Works:
1. Indicator Selection: Select your preferred indicator (MA, MACD, BB) and trading direction (Long/Short).
2. Risk Management Configuration: Set the percentage of capital to allocate per position to manage risk effectively.
3.Signal Detection: The algorithm identifies and plots buy/sell signals directly on the chart based on the chosen indicator.
4. Trade Execution: The strategy automatically enters and exits trades based on signal conditions and configured strategy parameters.
Use Cases:
- Backtesting: Evaluate the effectiveness of trading strategies using historical data to understand potential performance.
- Strategy Development: Customize and expand the strategy to incorporate additional indicators or conditions to fit specific trading styles.
ADDONS That Affect Strategy:
1. Indicator Parameters:
Adjustments to the settings of MACD (e.g., fast length, slow length), MA (e.g., length), and BB (e.g., length, multiplier) will directly impact the detection of signals and the strategy's performance.
2. Trading Direction:
Changing the trading direction (Long/Short) will alter the entry and exit conditions based on the detected signals.
3. Risk Management Settings:
Modifying the position size percentage affects capital allocation and overall risk exposure per trade.
ADDONS That Do Not Affect Strategy:
1. Visual Customizations:
Changes to the color, shape, and style of the plotted lines and signals do not impact the core functionality of the strategy but enhance visual clarity.
2. Text and Labels:
Modifying text labels for the signals (such as renaming "Buy MACD" to "MACD Buy Signal") is purely cosmetic and does not influence the strategy’s logic or outcomes.
Notes:
- Customization: The indicator is highly customizable to fit various trading styles and market conditions.
- Risk Management: Adjust position sizes and risk parameters according to your risk tolerance and account size.
- Optimization: Regularly backtest and optimize parameters to adapt to changing market dynamics for better performance.
Getting Started:
-Add the script to your chart.
-Adjust the input parameters to suit your analysis preferences.
-Observe the marked buy and sell signals on your chart to make informed trading decisions.
[KVA] KATRThe KATR indicator enhances the traditional ATR by leveraging the most common candle body percentage range, tailoring volatility measurement to specific market contexts. This advanced tool provides more relevant insights tailored to current market conditions.
Key Features:
Configurable ATR Length : Allows users to set the period for the ATR calculation, providing flexibility to adapt to different trading strategies and timeframes.
Multiple Smoothing Options : Offers a choice of RMA, SMA, EMA, and WMA for smoothing the ATR, enabling traders to select the method that best suits their analysis style.
Histogram Visualization for ATR Differences: The histogram visually represents the difference between the ATR and its moving average. This difference, or "dif," is calculated and smoothed, then multiplied by a user-defined factor. The histogram color indicates market conditions:
Light Red: Increasing but below zero, signaling potential weakening.
Light Green: Increasing and above zero, indicating strengthening.
Dark Green: Decreasing but above zero, showing potential weakening.
Dark Red: Decreasing and below zero, indicating strong weakening.
Ideal for Traders:
This indicator is perfect for traders seeking precise, context-sensitive volatility assessments to optimize trade timing and risk management strategies. Integrated seamlessly with other technical indicators, the KATR enhances your trading dashboard by adding depth to volatility analysis.
Detailed Explanation:
ATR Calculation: The ATR is derived by taking the average true range over a specified period, multiplied by the most common body percentage found in historical data.
Smoothing: Users can smooth the ATR using different methods, adding flexibility and customization to suit various trading styles.
Histogram: The histogram's primary function is to visualize the difference between the current ATR and its smoothed average. This provides clear, visual signals for potential volatility expansions or contractions, aiding in better decision-making.
Whether you're a day trader or a long-term investor, the KATR helps you stay ahead of market trends with reliable and easy-to-interpret insights. Elevate your trading strategy with the KATR's innovative approach to volatility measurement.
Bollinger Bands Fast Trend Indicator [DCD]Description:
The Bollinger Bands Fast Trend Detector indicator is an advanced tool designed to provide traders with more precise trend detection and clearer entry and exit signals. This script builds upon the traditional Bollinger Bands indicator by adding customizable standard deviations and incorporating multiple moving averages to enhance the accuracy of the signals.
Main Features:
1. **Customizable Bollinger Bands**:
- Each Bollinger Band has its own standard deviation setting, allowing for more granular control and better trend detection.
- The short Bollinger Band is set to a 10-period SMA for faster trend recognition.
2. **Multiple Moving Averages**:
- The indicator includes several types of moving averages (SMA, EMA, LSMA, HMA, WMA) applied to the Bollinger Trend value, giving traders flexibility to choose the best fit for their strategy.
3. **Crossover and Crossdown Detection**:
- The script identifies crossover and crossdown points between the Bollinger Trend value and the selected moving average, marking potential buy and sell signals with green and red circles, respectively.
4. **Color-Coded Histogram**:
- The histogram bars are color-coded to indicate the strength and direction of the trend, making it easy to visualize market conditions at a glance.
Instructions:
1. **Adding the Script to Your Chart**:
- Open your TradingView chart and add the Bollinger Bands Fast Trend Detector indicator.
2. **Adjusting Parameters**:
- Customize the Bollinger Bands and moving average settings according to your trading preferences:
- `Short BB Length` (default: 10): Adjusts the length of the short Bollinger Band.
- `Long BB Length` (default: 50): Adjusts the length of the long Bollinger Band.
- `StdDev` (for both bands): Sets the standard deviation multiplier.
- `Moving Average Type`: Choose between SMA, EMA, LSMA, HMA, and WMA.
- `Moving Average Length` (default: 14): Sets the length of the moving average.
3. **Interpreting the Output**:
- Observe the BBTrend and moving average plots on your chart.
- Look for green circles indicating crossover points (potential buy signals) and red circles indicating crossdown points (potential sell signals).
- Use the color-coded histogram bars to assess the strength and direction of the trend.
Configurable Parameters:
- `shortLengthInput` (default: 10): Length of the short Bollinger Band.
- `longLengthInput` (default: 50): Length of the long Bollinger Band.
- `shortDevMultInput` (default: 1.0): Standard deviation multiplier for the short Bollinger Band.
- `longDevMultInput` (default: 2.0): Standard deviation multiplier for the long Bollinger Band.
- `maTypeInput` (default: SMA): Type of moving average (options: SMA, EMA, LSMA, HMA, WMA).
- `maLengthInput` (default: 14): Length of the moving average.
Code Explanation:
The script calculates two sets of Bollinger Bands with distinct lengths and standard deviations. The difference between the lower bands and upper bands is normalized by the short middle band to compute the BBTrend value. A selected moving average is then applied to this BBTrend value. The script plots the BBTrend, the moving average, and uses color-coded histogram bars to represent trend strength and direction. It also identifies and marks crossover and crossdown points to provide potential trading signals.
Disclaimer:
This script is for educational purposes only and should not be considered financial advice. Always perform your own analysis before making any trading decisions.
Dynamic Bollinger Bands with Momentum and Volume (DBBMV)Overview
The Dynamic Bollinger Bands with Momentum and Volume (DBBMV) indicator enhances the traditional Bollinger Bands by dynamically adjusting their width and position based on momentum and volume. This provides a more responsive and context-aware indication of price volatility and potential reversals.
Key Features
Momentum Adjusted Bands: Adjusts the bands' width based on the momentum indicator, reflecting the rate of change in price.
Volume Weighted Bands: Further adjusts the bands based on trading volume to reflect market activity and price volatility.
Signal Alerts: Provides buy and sell signals based on price action relative to the dynamic bands, helping traders identify entry and exit points.
Customizable Parameters: Allows users to adjust the lookback period, momentum sensitivity, and volume weighting for personalized analysis.
How It Works
The DBBMV indicator starts with the traditional Bollinger Bands, which are calculated using a moving average and standard deviation of the selected price source. The width of these bands is then adjusted based on the momentum of the price, making them more sensitive to price changes. Further adjustments are made based on trading volume, which ensures that the bands accurately reflect current market conditions. This results in a set of dynamic Bollinger Bands that provide more nuanced insights into price volatility and potential reversals.
Usage Instructions
Identify Volatile Periods: Use the dynamically adjusted bands to identify periods of high and low volatility in the market.
Spot Reversals: Look for buy signals when the price crosses above the lower band and sell signals when the price crosses below the upper band.
Adjust Sensitivity: Customize the lookback period, momentum sensitivity, and volume weighting to fine-tune the indicator to your specific trading strategy and market conditions.
Enhance Analysis: Combine the DBBMV indicator with other technical analysis tools for a more comprehensive market analysis.
Volume Confirmation: Use the volume-weighted adjustments to confirm the strength of price movements and potential breakouts.
The Dynamic Bollinger Bands with Momentum and Volume (DBBMV) indicator provides traders with a powerful tool to understand market dynamics better and make informed trading decisions based on adjusted volatility and market activity.
Average Session Range [QuantVue]The Average Session Range or ASR is a tool designed to find the average range of a user defined session over a user defined lookback period.
Not only is this indicator is useful for understanding volatility and price movement tendencies within sessions, but it also plots dynamic support and resistance levels based on the ASR.
The average session range is calculated over a specific period (default 14 sessions) by averaging the range (high - low) for each session.
Knowing what the ASR is allows the user to determine if current price action is normal or abnormal.
When a new session begins, potential support and resistance levels are calculated by breaking the ASR into quartiles which are then added and subtracted from the sessions opening price.
The indicator also shows an ASR label so traders can know what the ASR is in terms of dollars.
Session Time Configuration:
The indicator allows users to define the session time, with default timing set from 13:00 to 22:00.
ASR Calculation:
The ASR is calculated over a specified period (default 14 sessions) by averaging the range (high - low) of each session.
Various levels based on the ASR are computed: 0.25 ASR, 0.5 ASR, 0.75 ASR, 1 ASR, 1.25 ASR, 1.5 ASR, 1.75 ASR, and 2 ASR.
Visual Representation:
The indicator plots lines on the chart representing different ASR levels.
Customize the visibility, color, width, and style (Solid, Dashed, Dotted) of these lines for better visualization.
Labels for these lines can also be displayed, with customizable positions and text properties.
Give this indicator a BOOST and COMMENT your thoughts!
We hope you enjoy.
Cheers!
Historical Volatility (adjustable time period)Historical Volatility with Adjustable Time Period and Moving Average
This indicator calculates the historical volatility of an asset within a user-defined date range. Volatility is a measure of the dispersion of returns and is commonly used to assess the risk and potential price fluctuations of an asset.
How It Works
User-Defined Date Range: You can specify the start and end dates to focus on a particular period for volatility calculation. This is useful for analyzing specific historical events or trends within a defined timeframe.
Daily Returns Calculation: The script calculates the daily returns as the percentage change between the current close price and the previous close price. This percentage change is essential for determining the asset's volatility.
Volatility Calculation: The historical volatility is computed as the standard deviation of the daily returns over a specified period. The standard deviation is a statistical measure that quantifies the amount of variation or dispersion in a set of values.
Moving Average: An optional feature allows you to plot a moving average of the volatility. You can customize the type (SMA, EMA, WMA, VWMA) and the period of the moving average, helping to smooth out the volatility data and identify trends.
Indicator Settings
Start Date: Select the beginning date of the period for which you want to calculate volatility.
End Date: Select the end date of the period.
Period: Set the number of bars (days) over which to calculate the average volatility.
Show Moving Average: Toggle to display the moving average of the volatility.
Moving Average Period: Define the length of the moving average.
Moving Average Type: Choose the type of moving average: Simple (SMA), Exponential (EMA), Weighted (WMA), or Volume-Weighted (VWMA).
How to Use
Configure Date Range: Set the start and end dates to focus on the specific historical period you are interested in.
Adjust Period for Volatility Calculation: Select the period over which you want to calculate the average volatility. A shorter period will be more sensitive to recent price changes, while a longer period will provide a more smoothed view.
Enable and Configure Moving Average: If desired, enable the moving average and select the type and period that best fits your analysis style.
Example Use Cases
Market Analysis: Identify periods of high or low volatility to assess market conditions.
Risk Management: Use historical volatility to evaluate the risk associated with a particular asset.
Event Impact: Analyze how specific events within the selected date range affected the asset's volatility.
By providing these functionalities, this indicator is a valuable tool for traders looking to understand and analyze the volatility of assets over custom time periods with the flexibility of adding a moving average for trend analysis.
LBR-S310ROC @shrilssOriginally made by Linda Raschke, The S310ROC Indicator combines the Rate of Change (ROC) indicator with the 3-10 Oscillator (Modified MACD) and plots to capture rapid price movements and gauge market momentum.
- Rate of Change (ROC): This component of the indicator measures the percentage change in price over a specified short interval, which can be set by the user (default is 2 days). It is calculated by subtracting the closing price from 'X' days ago from the current close.
- 3-10 Oscillator (MACD; 3,10,16): This is a specialized version of the Moving Average Convergence Divergence (MACD) but uses simple moving averages instead of exponential. Using a fast moving average of 3 days and a slow moving average of 10 days with a smoothing period of 16.
- ROC Dots: A great feature based on the oscillator's readings. Dots are displayed directly on the oscillator or the price chart to provide visual momentum cues:
- Aqua Dots: Appear when all lines (ROC, MACD, Slowline) are sloping downwards, indicating bearish momentum and potentially signaling a sell opportunity.
- White Dots: Appear when all lines are sloping upwards, suggesting bullish momentum and possibly a buy signal.
ROC [CHE] with Kernel SelectionIntroduction:
The script titled "ROC with Kernel Selection" utilizes Rate of Change (ROC) to analyze price momentum in financial markets. It incorporates a kernel selection mechanism to smooth ROC values, enhancing clarity in trend identification.
Middle Part:
The script begins by calculating ROC over a specified period using the formula:
roc = (close - close ) / close * 100
The period length determined by the user. The result is plotted alongside a zero line for reference.
The kernel selection aspect allows users to choose from various smoothing techniques:
Linear
Exponential
Epanechnikov
Triangular
Cosine
Each kernel applies a different weighting function to ROC values, influencing the sensitivity and smoothness of the plotted line. Users can customize parameters such as bandwidth and color preferences for up and down movements, facilitating visual interpretation.
The main logic of the script involves iterating through historical data to compute weighted averages of ROC values based on the selected kernel. It adjusts graphical elements dynamically, highlighting changes in momentum direction with color-coded lines and directional symbols (▲ or ▼).
Conclusion:
In conclusion, "ROC with Kernel Selection" offers a flexible toolset for traders and analysts to assess price momentum robustly. By integrating kernel-based smoothing techniques, it enhances the clarity of ROC signals, aiding in the identification of trends and potential reversals in financial markets.
Implied Volatility LevelsOverview:
The Implied Volatility Levels Indicator is a powerful tool designed to visualize different levels of implied volatility on your trading chart. This indicator calculates various implied volatility levels based on historical price data and plots them as dynamic dotted lines, helping traders identify significant market thresholds and potential reversal points.
Features:
Multi-Level Implied Volatility: The indicator calculates and plots multiple levels of implied volatility, including the mean and both positive and negative standard deviation multiples.
Dynamic Updates: The levels update in real-time, reflecting the latest market conditions without cluttering your chart with outdated information.
Customizable Parameters: Users can adjust the lookback period and the standard deviation multiplier to tailor the indicator to their trading strategy.
Visual Clarity: Implied volatility levels are displayed using distinct colors and dotted lines, providing clear visual cues without obstructing the view of price action.
Support for Multiple Levels: Includes additional levels (up to ±5 standard deviations) for in-depth market analysis.
How It Works:
The indicator computes the standard deviation of the closing prices over a user-defined lookback period. It then calculates various implied volatility levels by adding and subtracting multiples of this standard deviation from the mean price. These levels are plotted as dotted lines on the chart, offering traders a clear view of the current market's volatility landscape.
Usage:
Identify Key Levels: Use the plotted lines to spot potential support and resistance levels based on implied volatility.
Analyze Market Volatility: Understand how volatile the market is relative to historical data.
Plan Entry and Exit Points: Make informed trading decisions by observing where the price is in relation to the implied volatility levels.
Parameters:
Lookback Period (Days): The number of days to consider for calculating historical volatility (default is 252 days).
Standard Deviation Multiplier: A multiplier to adjust the distance of the levels from the mean (default is 1.0).
This indicator is ideal for traders looking to incorporate volatility analysis into their technical strategy, providing a robust framework for anticipating market movements and potential reversals.
Dickey-Fuller Test for Mean Reversion and Stationarity **IF YOU NEED EXTRA SPECIAL HELP UNDERSTANDING THIS INDICATOR, GO TO THE BOTTOM OF THE DESCRIPTION FOR AN EVEN SIMPLER DESCRIPTION**
Dickey Fuller Test:
The Dickey-Fuller test is a statistical test used to determine whether a time series is stationary or has a unit root (a characteristic of a time series that makes it non-stationary), indicating that it is non-stationary. Stationarity means that the statistical properties of a time series, such as mean and variance, are constant over time. The test checks to see if the time series is mean-reverting or not. Many traders falsely assume that raw stock prices are mean-reverting when they are not, as evidenced by many different types of statistical models that show how stock prices are almost always positively autocorrelated or statistical tests like this one, which show that stock prices are not stationary.
Note: This indicator uses past results, and the results will always be changing as new data comes in. Just because it's stationary during a rare occurrence doesn't mean it will always be stationary. Especially in price, where this would be a rare occurrence on this test. (The Test Statistic is below the critical value.)
The indicator also shows the option to either choose Raw Price, Simple Returns, or Log Returns for the test.
Raw Prices:
Stock prices are usually non-stationary because they follow some type of random walk, exhibiting positive autocorrelation and trends in the long term.
The Dickey-Fuller test on raw prices will indicate non-stationary most of the time since prices are expected to have a unit root. (If the test statistic is higher than the critical value, it suggests the presence of a unit root, confirming non-stationarity.)
Simple Returns and Log Returns:
Simple and log returns are more stationary than prices, if not completely stationary, because they measure relative changes rather than absolute levels.
This test on simple and log returns may indicate stationary behavior, especially over longer periods. (The test statistic being below the critical value suggests the absence of a unit root, indicating stationarity.)
Null Hypothesis (H0): The time series has a unit root (it is non-stationary).
Alternative Hypothesis (H1): The time series does not have a unit root (it is stationary)
Interpretation: If the test statistic is less than the critical value, we reject the null hypothesis and conclude that the time series is stationary.
Types of Dickey-Fuller Tests:
1. (What this indicator uses) Standard Dickey-Fuller Test:
Tests the null hypothesis that a unit root is present in a simple autoregressive model.
This test is used for simple cases where we just want to check if the series has a consistent statistical property over time without considering any trends or additional complexities.
It examines the relationship between the current value of the series and its previous value to see if the series tends to drift over time or revert to the mean.
2. Augmented Dickey-Fuller (ADF) Test:
Tests for a unit root while accounting for more complex structures like trends and higher-order correlations in the data.
This test is more robust and is used when the time series has trends or other patterns that need to be considered.
It extends the regular test by including additional terms to account for the complexities, and this test may be more reliable than the regular Dickey-Fuller Test.
For things like stock prices, the ADF would be more appropriate because stock prices are almost always trending and positively autocorrelated, while the Dickey-Fuller Test is more appropriate for more simple time series.
Critical Values
This indicator uses the following critical values that are essential for interpreting the Dickey-Fuller test results. The critical values depend on the chosen significance levels:
1% Significance Level: Critical value of -3.43.
5% Significance Level: Critical value of -2.86.
10% Significance Level: Critical value of -2.57.
These critical values are thresholds that help determine whether to reject the null hypothesis of a unit root (non-stationarity). If the test statistic is less than (or more negative than) the critical value, it indicates that the time series is stationary. Conversely, if the test statistic is greater than the critical value, the series is considered non-stationary.
This indicator uses a dotted blue line by default to show the critical value. If the test-static, which is the gray column, goes below the critical value, then the test-static will become yellow, and the test will indicate that the time series is stationary or mean reverting for the current period of time.
What does this mean?
This is the weekly chart of BTCUSD with the Dickey-Fuller Test, with a length of 100 and a critical value of 1%.
So basically, in the long term, mean-reversion strategies that involve raw prices are not a good idea. You don't really need a statistical test either for this; just from seeing the chart itself, you can see that prices in the long term are trending and no mean reversion is present.
For the people who can't understand that the gray column being above the blue dotted line means price doesn't mean revert, here is a more simple description (you know you are):
Average (I have to include the meaning because they may not know what average is): The middle number is when you add up all the numbers and then divide by how many numbers there are. EX: If you have the numbers 2, 4, and 6, you add them up to get 12, and then divide by 3 (because there are 3 numbers), so the average is 4. It tells you what a typical number is in a group of numbers.
This indicator checks if a time series (like stock prices) tends to return to its average value or time.
Raw prices, which is just the regular price chart, are usually not mean-reverting (It's "always" positively autocorrelating but this group of people doesn't like that word). Price follows trends.
Simple returns and log returns are more likely to have periods of mean reversion.
How to use it:
Gray Column (the gray bars) Above the Blue Dotted Line: The price does not mean revert (non-stationary).
Gray Column Below Blue Line: The time series mean reverts (stationary)
So, if the test statistic (gray column) is below the critical value, which is the blue dotted line, then the series is stationary and mean reverting, but if it is above the blue dotted line, then the time series is not stationary or mean reverting, and strategies involving mean reversion will most likely result in a loss given enough occurrences.
[SGM GARCH Volatility]I'm excited to share with you a Pine Script™ that I developed to analyze GARCH (Generalized Autoregressive Conditional Heteroskedasticity) volatility. This script allows you to calculate and plot GARCH volatility on TradingView. Let's see together how it works!
Introduction
Volatility is a key concept in finance that measures the variation in prices of a financial asset. The GARCH model is a statistical method that predicts future volatility based on past volatilities and prediction residuals (errors).
Indicator settings
We define several parameters for our indicator:
length = input.int(20, title="Length")
p = input.int(1, title="Lag order (p)")
q = input.int(1, title="Degree of moving average (q)")
cluster_value = input(0.2,title="cluster value")
length: The period used for the calculations, default 20.
p: The order of the delay for the GARCH model.
q: The degree of the moving average for the GARCH model.
cluster_value: A threshold value used to color the graph.
Calculation of logarithmic returns
We calculate logarithmic returns to capture price changes:
logReturns = math.log(close) - math.log(close )
Initializing arrays
We initialize arrays to store residuals and volatilities:
var float residuals = array.new_float(length, 0)
var float volatilities = array.new_float(length, 0)
We add the new logarithmic returns to the tables and keep their size constant:
array.unshift(residuals, logReturns)
if (array.size(residuals) > length)
array.pop(residuals)
We then calculate the mean and variance of the residuals:
meanResidual = array.avg(residuals)
varianceResidual = array.stdev(residuals, meanResidual)
volatility = math.sqrt(varianceResidual)
We update the volatility table with the new value:
array.unshift(volatilities, volatility)
if (array.size(volatilities) > length)
array.pop(volatilities)
GARCH volatility is calculated from accumulated data:
var float garchVolatility = na
if (array.size(volatilities) >= length and array.size(residuals) >= length)
alpha = 0.1 // Alpha coefficient
beta = 0.85 // Beta coefficient
omega = 0.01 // Omega constant
sumVolatility = 0.0
for i = 0 to p-1
sumVolatility := sumVolatility + beta * math.pow(array.get(volatilities, i), 2)
sumResiduals = 0.0
for j = 0 to q-1
sumResiduals := sumResiduals + alpha * math.pow(array.get(residuals, j), 2)
garchVolatility := math.sqrt(omega + sumVolatility + sumResiduals)
Plot GARCH volatility
We finally plot the GARCH volatility on the chart and add horizontal lines for easier visual analysis:
plt = plot(garchVolatility, title="GARCH Volatility", color=color.rgb(33, 149, 243, 100))
h1 = hline(0.1)
h2 = plot(cluster_value)
h3 = hline(0.3)
colorGarch = garchVolatility > cluster_value ? color.red: color.green
fill(plt, h2, color = colorGarch)
colorGarch: Determines the fill color based on the comparison between garchVolatility and cluster_value.
Using the script in your trading
Incorporating this Pine Script™ into your trading strategy can provide you with a better understanding of market volatility and help you make more informed decisions. Here are some ways to use this script:
Identification of periods of high volatility:
When the GARCH volatility is greater than the cluster value (cluster_value), it indicates a period of high volatility. Traders can use this information to avoid taking large positions or to adjust their risk management strategies.
Anticipation of price movements:
An increase in volatility can often precede significant price movements. By monitoring GARCH volatility spikes, traders can prepare for potential market reversals or accelerations.
Optimization of entry and exit points:
By using GARCH volatility, traders can better identify favorable times to enter or exit a position. For example, entering a position when volatility begins to decrease after a peak can be an effective strategy.
Adjustment of stops and objectives:
Since volatility is an indicator of the magnitude of price fluctuations, traders can adjust their stop-loss and take-profit orders accordingly. Periods of high volatility may require wider stops to avoid being exited from a position prematurely.
That's it for the detailed explanation of this Pine Script™ script. Don’t hesitate to use it, adapt it to your needs and share your feedback! Happy analysis and trading everyone!
DeltaDetector PINESCRIPTLABSDescription:
This technical indicator, DeltaDetector PINESCRIPTLABS, is designed to identify significant changes in the price of an asset relative to the previous close. Users can customize the percentage change they want to monitor.
Usage Instructions:
Adjust the desired percentage change using the "Price Change Value (%)" user input.
Observe the green diamonds to identify significant price increases above the specified percentage.
Observe the red diamonds to identify significant price decreases below the specified percentage.
"In the following image, we observe a 4-hour timeframe for EURUSD, where we set a candle change percentage of 0.45%. We can see how the price reacts afterwards to the size of these candles."
"In the pair BTCUSDT.P, we designated a single candle change percentage of 3%, and observed how the price reacted after that candle."
This allows you to easily identify significant price movements within the range specified by the percentage change you have set.
Español:
Descripción:
Este indicador técnico, DeltaDetector PINESCRIPTLABS, está diseñado para identificar cambios significativos en el precio de un activo en relación con el cierre anterior. Los usuarios pueden personalizar el porcentaje de cambio que desean monitorear.
Instrucciones de uso:
Ajuste el porcentaje de cambio deseado utilizando la entrada de usuario "Price Change Value (%)".
Observe los diamantes verdes para identificar aumentos significativos en el precio por encima del porcentaje especificado.
Observe los diamantes rojos para identificar disminuciones significativas en el precio por debajo del porcentaje especificado.
"En la siguiente imagen, observamos un marco de tiempo de 4 horas para EURUSD, donde establecimos un porcentaje de cambio de vela del 0,45%. Podemos ver cómo reacciona el precio después al tamaño de estas velas."
"En el par BTCUSDT.P, designamos un porcentaje de cambio de vela único del 3%, y observamos cómo reaccionó el precio después de esa vela."
Esto te permite identificar fácilmente movimientos significativos en el precio dentro del rango especificado por el porcentaje de cambio que has establecido.
VIX Percentile Rank HistogramVIX Percentile Rank Histogram
The VIX Percentile Rank Histogram provides a visual representation of the CBOE Volatility Index (VIX) percentile rank over a customizable lookback period, helping traders gauge market sentiment and make informed trading decisions.
Overview:
This indicator calculates the percentile rank of the VIX over a specified lookback period and displays it as a histogram. The histogram helps traders understand whether the current VIX level is relatively high or low compared to its recent history. This information is particularly useful for timing entries and exits in the S&P 500 or related ETFs and Mega Caps.
How It Works:
VIX Data Integration: The script fetches daily VIX close prices, regardless of the chart you are viewing, to analyze market volatility.
Percentile Rank Calculation: The indicator calculates the rank percentile of the VIX over the chosen lookback period.
Histogram Visualization: The histogram plots the difference between the flipped VIX percentile rank and 50, showing green bars for ranks below 50 (indicating lower market volatility) and red bars for ranks above 50 (indicating higher market volatility).
Usage:
This indicator is most effective when trading the S&P 500 (SPX, SPY, ES1!) or ETFs and Mega Caps that closely follow the S&P 500. It provides insight into market sentiment, helping traders make more informed decisions.
Timing Entries and Exits: Green histogram readings suggest it's a good time to enter or hold long positions, while red readings suggest considering exits or short positions.
Market Sentiment: A high VIX percentile rank (red bars) indicates market fear and uncertainty, while a low percentile rank (green bars) suggests investor confidence and reduced volatility.
Key Features:
Customizable Lookback Period: The default lookback period is set to 20 days, but can be adjusted based on the trader's average trade duration. For example, if your trades typically last 20 days, a 20-day lookback period helps contextualize the VIX level relative to its recent history.
Histogram Visualization: The histogram provides a clear visual representation of market volatility.
Green Bars: Indicate a lower-than-median VIX percentile rank, suggesting reduced market volatility.
Red Bars: Indicate a higher-than-median VIX percentile rank, suggesting increased market volatility.
Threshold Line: A dashed gray line at the 0 level serves as a visual reference for the median VIX rank.
Important Note:
This indicator always shows readings from the VIX, regardless of the chart you are viewing. For example, if you are looking at Natural Gas futures, this indicator will provide no relevant data. It works best when trading the S&P 500 or related ETFs and Mega Caps.
Supertrend + BB + Consecutive Candles + QQE + EMA [Pineify]Overview
This indicator, developed by Pineify, is a comprehensive tool designed to assist traders in making informed decisions by combining multiple technical analysis methods. It integrates Supertrend, Bollinger Bands (BB), Consecutive Candles, Quantitative Qualitative Estimation (QQE), and Exponential Moving Averages (EMA) into a single, cohesive script. This multi-faceted approach allows traders to analyze market trends, volatility, and potential buy/sell signals with greater accuracy.
Key Features
1. Supertrend: Utilizes the Supertrend indicator to identify the prevailing market trend. It provides clear buy and sell signals based on the direction of the trend.
2. Bollinger Bands (BB): Measures market volatility and identifies overbought or oversold conditions. The script calculates the middle, upper, and lower bands, along with the Bollinger Band Width (BBW) and Bollinger Band %B (BBR).
3. Consecutive Candles: Detects sequences of consecutive bullish or bearish candles, providing signals when a specified number of consecutive candles are detected.
4. Quantitative Qualitative Estimation (QQE): Combines the Relative Strength Index (RSI) with a smoothing factor to generate buy and sell signals based on the QQE methodology.
5. Exponential Moving Averages (EMA): Includes both fast and slow EMAs to identify potential crossovers, which are used as buy and sell signals.
How It Works
- Supertrend: The Supertrend indicator is calculated using a factor and ATR length. It plots the trend direction and generates buy/sell signals when the trend changes.
- Bollinger Bands: The BB indicator calculates the middle band as a Simple Moving Average (SMA) of the closing prices. The upper and lower bands are derived by adding and subtracting a multiple of the standard deviation from the middle band.
- Consecutive Candles: This feature counts the number of consecutive candles that close higher or lower than the previous candle. When the count reaches a specified threshold, it generates a buy or sell signal.
- QQE: The QQE indicator smooths the RSI values and calculates the QQE Fast and QQE Slow lines. Buy and sell signals are generated based on the crossover of these lines.
- EMA: The script calculates fast and slow EMAs and generates buy/sell signals based on their crossovers.
How to Use
1. Inputs: Customize the indicator settings through the input parameters:
- Supertrend Factor and ATR Length
- BB Length
- Consecutive Candles Counting
- QQE RSI Length
- Fast and Slow EMA Lengths
- Enable/Disable Alerts for various signals
2. Alerts: Set up alerts for Supertrend, Consecutive Candles, and EMA crossovers. Alerts can be enabled or disabled based on user preference.
3. Visualization: The indicator plots the Supertrend, Bollinger Bands, and EMA lines on the chart. It also marks buy and sell signals with arrows and labels for easy identification.
Concepts Underlying Calculations
- Supertrend: Based on the Average True Range (ATR) to determine the trend direction and potential reversal points.
- Bollinger Bands: Utilizes standard deviation to measure market volatility and identify overbought/oversold conditions.
- Consecutive Candles: A method to detect momentum by counting consecutive bullish or bearish candles.
- QQE: Enhances the traditional RSI by smoothing it and using a dynamic threshold to generate signals.
- EMA: A widely used moving average that gives more weight to recent prices, making it responsive to market changes.
This indicator is a powerful tool for traders looking to combine multiple technical analysis methods into a single, easy-to-use script. By integrating these diverse techniques, it provides a comprehensive view of market conditions and potential trading opportunities.
ATR by Time [QuantVue]"ATR by Time" incorporates time-specific volatility patterns by calculating the Average True Range (ATR) over a customizable period and comparing it to historical ATR values
at specific times of the day.
The Average True Range (ATR) is a popular technical indicator that measures market volatility by decomposing the entire range of an asset price for that period.
By taking the ATR at certain times of the day and comparing it to the current bar's ATR, traders can gain several potential advantages:
Volatility Pattern Recognition: Different times of the trading day often exhibit different levels of volatility. For instance, markets might be more volatile at the open and close compared to midday. By tracking ATR at specific times, traders can recognize these patterns and better predict periods of high or low volatility.
Risk Management: Understanding volatility trends throughout the day helps in better risk management. During periods of high expected volatility (indicated by higher ATR compared to the historical average), traders can adjust their stop-loss levels and position sizes accordingly to protect their capital.
Trend Confirmation and Divergence: This indicator can help confirm trends or identify potential reversals. For example, if the current ATR consistently exceeds the average ATR at specific times, it may confirm a strong trend. Conversely, if the current ATR falls below the historical average, it could signal a potential slowdown or reversal.
This indicator will work on all markets on all time frames. User can customize ATR length as well as the lookback period.
This script utilizes TradingView's RelativeValue library and averageAtTime function, which is used to compare a current data point in a time interval to an average of data points with corresponding time offsets across historical periods. Its purpose is to assess the significance of a value by considering the historical context within past time intervals.
Give this indicator a BOOST and COMMENT your thoughts!
We hope you enjoy.
Cheers!
Supertrend Alert with Arrows and Time FilterOverview
This script is designed to generate trading signals based on the Supertrend indicator, a popular technical analysis tool. The Supertrend indicator is used to identify the direction of the market trend and potential reversal points.
Supertrend Settings
The script uses two sets of Supertrend settings:
Small Supertrend
Factor: 3.0
ATR Period: 10
Big Supertrend
Factor: 10.0
ATR Period: 30
These settings are fixed and should not be altered to maintain the integrity of the signal generation process.
Configurable Parameters
startHour: The hour at which signal generation begins.
endHour: The hour at which signal generation ends.
These parameters allow users to focus on specific trading hours, optimizing the signal relevance to their trading strategy.
Signal Types
The script generates two types of signals:
Type 1: Reversal Signal
Long Signal: Triggered when the big Supertrend is in an uptrend, and the small Supertrend transitions from a downtrend to an uptrend.
Short Signal: Triggered when the big Supertrend is in a downtrend, and the small Supertrend transitions from an uptrend to a downtrend.
Type 2: Trend Change Signal
Long Signal: Triggered when the big Supertrend changes from a downtrend to an uptrend.
Short Signal: Triggered when the big Supertrend changes from an uptrend to a downtrend.
How the Script Works
Initialization: The script initializes with predefined Supertrend settings.
Data Input: Market data (e.g., price data) is fed into the script.
Supertrend Calculation: The script calculates the Supertrend values using the predefined factors and ATR periods.
Signal Detection: The script monitors the Supertrend values and detects the defined signals based on the conditions mentioned above.
Time Filtering: Signals are filtered based on the specified startHour and endHour, ensuring only relevant signals are displayed within the desired timeframe.
Usage
Set Parameters: Define startHour and endHour according to your trading schedule.
Run Script: Execute the script with market data input.
Interpret Signals: Monitor the generated signals and use them to inform your trading decisions.
Originality
Dual Supertrend Usage: The use of both a small and a big Supertrend to generate signals adds a layer of complexity and reliability to the signals.
Time-Based Filtering: Allows traders to focus on specific trading hours, enhancing the relevance and accuracy of signals.
Two Signal Types: The combination of reversal signals and trend change signals provides comprehensive market insights.
Conclusion
This Supertrend Signal Generator is a robust tool for traders seeking to leverage the Supertrend indicator for more informed trading decisions. By combining dual Supertrend settings and configurable trading hours, the script offers unique and flexible signal generation capabilities.
Downside DeviationDownside deviation is a measure of downside risk that focuses on returns that fall below a minimum threshold or minimum acceptable return (MAR). It is used in the calculation of the Sortino ratio, a measure of risk-adjusted return. The Sortino ratio is like the Sharpe ratio, except that it replaces the standard deviation with downside deviation.
Sortino RatioThe Sortino ratio is a variation of the Sharpe ratio that differentiates harmful volatility from total overall volatility by using the asset's standard deviation of negative portfolio returns—downside deviation—instead of the total standard deviation of portfolio returns. The Sortino ratio takes an asset or portfolio's return and subtracts the risk-free rate, and then divides that amount by the asset's downside deviation. The ratio was named after Frank A. Sortino.
BBTrend w SuperTrend decision - Strategy [presentTrading]This strategy aims to improve upon the performance of Traidngview's newly published "BB Trend" indicator by incorporating the SuperTrend for better trade execution and risk management. Enjoy :)
█Introduction and How it is Different
The "BBTrend w SuperTrend decision - Strategy " is a trading strategy designed to identify market trends using Bollinger Bands and SuperTrend indicators. What sets this strategy apart is its use of two Bollinger Bands with different lengths to capture both short-term and long-term market trends, providing a more comprehensive view of market dynamics. Additionally, the strategy includes customizable take profit (TP) and stop loss (SL) settings, allowing traders to tailor their risk management according to their preferences.
BTCUSD 4h Long Performance
█ Strategy, How It Works: Detailed Explanation
The BBTrend strategy employs two key indicators: Bollinger Bands and SuperTrend.
🔶 Bollinger Bands Calculation:
- Short Bollinger Bands**: Calculated using a shorter period (default 20).
- Long Bollinger Bands**: Calculated using a longer period (default 50).
- Bollinger Bands use the standard deviation of price data to create upper and lower bands around a moving average.
Upper Band = Middle Band + (k * Standard Deviation)
Lower Band = Middle Band - (k * Standard Deviation)
🔶 BBTrend Indicator:
- The BBTrend indicator is derived from the absolute differences between the short and long Bollinger Bands' lower and upper values.
BBTrend = (|Short Lower - Long Lower| - |Short Upper - Long Upper|) / Short Middle * 100
🔶 SuperTrend Indicator:
- The SuperTrend indicator is calculated using the average true range (ATR) and a multiplier. It helps identify the market trend direction by plotting levels above and below the price, which act as dynamic support and resistance levels. * @EliCobra makes the SuperTrend Toolkit. He is GOAT.
SuperTrend Upper = HL2 + (Factor * ATR)
SuperTrend Lower = HL2 - (Factor * ATR)
The strategy determines market trends by checking if the close price is above or below the SuperTrend values:
- Uptrend: Close price is above the SuperTrend lower band.
- Downtrend: Close price is below the SuperTrend upper band.
Short: 10 Long: 20 std 2
Short: 20 Long: 40 std 2
Short: 20 Long: 40 std 4
█ Trade Direction
The strategy allows traders to choose their trading direction:
- Long: Enter long positions only.
- Short: Enter short positions only.
- Both: Enter both long and short positions based on market conditions.
█ Usage
To use the "BBTrend - Strategy " effectively:
1. Configure Inputs: Adjust the Bollinger Bands lengths, standard deviation multiplier, and SuperTrend settings.
2. Set TPSL Conditions: Choose the take profit and stop loss percentages to manage risk.
3. Choose Trade Direction: Decide whether to trade long, short, or both directions.
4. Apply Strategy: Apply the strategy to your chart and monitor the signals for potential trades.
█ Default Settings
The default settings are designed to provide a balance between sensitivity and stability:
- Short BB Length (20): Captures short-term market trends.
- Long BB Length (50): Captures long-term market trends.
- StdDev (2.0): Determines the width of the Bollinger Bands.
- SuperTrend Length (10): Period for calculating the ATR.
- SuperTrend Factor (12): Multiplier for the ATR to adjust the SuperTrend sensitivity.
- Take Profit (30%): Sets the level at which profits are taken.
- Stop Loss (20%): Sets the level at which losses are cut to manage risk.
Effect on Performance
- Short BB Length: A shorter length makes the strategy more responsive to recent price changes but can generate more false signals.
- Long BB Length: A longer length provides smoother trend signals but may be slower to react to price changes.
- StdDev: Higher values create wider bands, reducing the frequency of signals but increasing their reliability.
- SuperTrend Length and Factor: Shorter lengths and higher factors make the SuperTrend more sensitive, providing quicker signals but potentially more noise.
- Take Profit and Stop Loss: Adjusting these levels affects the risk-reward ratio. Higher take profit percentages can increase gains but may result in fewer closed trades, while higher stop loss percentages can decrease the likelihood of being stopped out but increase potential losses.
ATR Price Range Prediction V.2### ATR Price Range Prediction V.2
This script calculates the expected high and low prices for the current day based on the Average True Range (ATR) and displays the proportion of days where the daily range (high - low) is greater than or equal to the ATR. Additionally, the script provides an option to adjust the size of the text displayed in the top-right corner of the chart.
#### How It Works
1. **ATR Calculation**: The script calculates the ATR for a specified period (`atrPeriod`). ATR is a measure of volatility that represents the average range between the high and low prices over a specified number of periods.
2. **Expected High and Low Calculation**:
- **Expected High**: Calculated by adding the ATR value to the low price of the current day.
- **Expected Low**: Calculated by subtracting the ATR value from the high price of the current day.
3. **Proportion Calculation**: The script calculates the proportion of days where the daily range (high - low) is greater than or equal to the ATR value. This proportion is updated in real-time as new data comes in.
4. **Table Display**: Instead of displaying labels on each candle, the script shows the expected high, expected low, and the calculated proportion in a table located at the top-right corner of the chart. The size of the text in this table can be adjusted using the `Table Size` input.
5. **Color Coding**: The script changes the color of the bars to yellow if the daily range is greater than or equal to the ATR value, making it easy to identify these bars visually.
#### How to Use
- **ATR Period (`atrPeriod`)**: Adjust the period for the ATR calculation using the input parameter. The default value is 14.
- **Table Size (`tableSizeOption`)**: Choose the size of the text displayed in the table. Options include `tiny`, `small`, `normal`, `large`, and `huge`.
- **Expected High and Low**: Use the green and red lines to identify potential target prices or stop-loss levels for your trades. The green line represents the expected high, and the red line represents the expected low.
- **Proportion**: The table in the top-right corner of the chart shows the proportion of days where the daily range is greater than or equal to the ATR value. This can provide insight into the volatility of the asset.
- **Color Coding**: Yellow bars indicate days where the daily range is greater than or equal to the ATR value.
---
### ภาษาไทย
### ATR คาดการณ์ราคาสูงสุดและต่ำสุด พร้อมสัดส่วน
สคริปต์นี้คำนวณราคาสูงสุดและต่ำสุดที่คาดการณ์สำหรับวันปัจจุบันโดยอิงจากค่าเฉลี่ยช่วงที่แท้จริง (ATR) และแสดงสัดส่วนของวันที่ช่วงราคาต่อวัน (สูง - ต่ำ) มากกว่าหรือเท่ากับค่า ATR นอกจากนี้ยังมีตัวเลือกในการปรับขนาดข้อความที่แสดงในกล่องข้อความมุมขวาบนของกราฟ
#### วิธีการทำงาน
1. **การคำนวณ ATR**: สคริปต์คำนวณค่า ATR สำหรับช่วงเวลาที่กำหนด (`atrPeriod`) ATR เป็นมาตรวัดความผันผวนที่แสดงช่วงเฉลี่ยระหว่างราคาสูงสุดและต่ำสุดในช่วงเวลาที่กำหนด
2. **การคำนวณราคาสูงสุดและต่ำสุดที่คาดการณ์**:
- **ราคาสูงสุดที่คาดการณ์**: คำนวณโดยการบวกค่า ATR กับราคาต่ำสุดของวันปัจจุบัน
- **ราคาต่ำสุดที่คาดการณ์**: คำนวณโดยการลบค่า ATR จากราคาสูงสุดของวันปัจจุบัน
3. **การคำนวณสัดส่วน**: สคริปต์คำนวณสัดส่วนของวันที่ช่วงราคาต่อวัน (สูง - ต่ำ) มากกว่าหรือเท่ากับค่า ATR สัดส่วนนี้จะอัปเดตแบบเรียลไทม์เมื่อมีข้อมูลใหม่เข้ามา
4. **การแสดงผลในตาราง**: แทนที่จะแสดงป้ายกำกับบนแท่งเทียนแต่ละแท่ง สคริปต์จะแสดงราคาสูงสุดที่คาดการณ์ ราคาต่ำสุดที่คาดการณ์ และสัดส่วนที่คำนวณในตารางที่มุมขวาบนของกราฟ โดยสามารถปรับขนาดข้อความในตารางได้
5. **การใช้สี**: สคริปต์จะเปลี่ยนสีของแท่งเทียนเป็นสีเหลืองหากช่วงราคาต่อวันมากกว่าหรือเท่ากับค่า ATR ทำให้สามารถระบุแท่งเทียนเหล่านี้ได้ง่ายขึ้น
#### วิธีการใช้งาน
- **ATR Period (`atrPeriod`)**: ปรับช่วงเวลาสำหรับการคำนวณ ATR โดยใช้พารามิเตอร์การป้อนค่า ค่าเริ่มต้นคือ 14
- **Table Size (`tableSizeOption`)**: เลือกขนาดข้อความที่แสดงในตาราง ตัวเลือกได้แก่ `tiny`, `small`, `normal`, `large`, และ `huge`
- **ราคาสูงสุดและต่ำสุดที่คาดการณ์**: ใช้เส้นสีเขียวและสีแดงเพื่อระบุราคาที่เป็นเป้าหมายหรือระดับการหยุดขาดทุนสำหรับการซื้อขายของคุณ เส้นสีเขียวแสดงถึงราคาสูงสุดที่คาดการณ์และเส้นสีแดงแสดงถึงราคาต่ำสุดที่คาดการณ์
- **สัดส่วน**: ตารางที่มุมขวาบนของกราฟแสดงสัดส่วนของวันที่ช่วงราคาต่อวันมากกว่าหรือเท่ากับค่า ATR ซึ่งสามารถให้ข้อมูลเชิงลึกเกี่ยวกับความผันผวนของสินทรัพย์
- **การใช้สี**: แท่งเทียนสีเหลืองบ่งบอกถึงวันที่ช่วงราคาต่อวันมากกว่าหรือเท่ากับค่า ATR
_____