ICT Digital open Daily DividersDescription for "ICT Digital Open Daily Dividers" TradingView Indicator
Overview
The "ICT Digital Open Daily Dividers" is a versatile and comprehensive TradingView Pine Script indicator designed for traders who utilize Institutional Order Flow methodologies, particularly in ICT (Inner Circle Trader) trading. This indicator provides a structured visual framework to assist traders in identifying key daily market sessions, critical opening prices, and distinguishing different trading days, especially focusing on the Sunday open, which is a crucial element in the ICT trading strategy.
Core Functionalities
Daily Vertical Lines: The script plots vertical lines at the start of each trading day, which helps to demarcate daily trading sessions. These lines are customizable, allowing traders to choose their color, style (solid, dashed, or dotted), and width. This feature helps in visually segmenting each trading day, making it easier to analyze daily price action patterns.
Sunday Open Differentiation: Unlike many other daily divider indicators, this script uniquely provides the option to highlight the Sunday open at 6 PM EST with distinct lines. This feature is especially valuable for ICT traders who consider the Sunday open as a critical reference point for weekly analysis. The color, style, and width of the Sunday open lines can be set separately, providing a clear visual distinction from regular weekday separators.
12 AM Open Toggle: For markets that are influenced by midnight opens, the indicator includes an option to shift the daily open line to 12 AM instead of the default 6 PM. This flexibility allows traders to adapt the indicator to different market dynamics or trading strategies.
Timezone Customization: The indicator allows traders to set the timezone for the open lines, ensuring that the vertical lines align accurately with the trader’s specific market hours, whether they follow New York time or any other timezone.
Session Time Filters: The script can hide or show specific trading session markers, such as the New York session open and close, which are pivotal for ICT traders. These markers help in focusing on the most active and liquid trading times.
Customizable Style Settings: The script includes comprehensive styling options for the plotted lines and session markers, allowing traders to personalize their charts to suit their visual preferences and improve clarity.
Day of the Week Labels: The indicator can plot labels for each day of the week, providing a quick reference to the day’s price action. This feature is particularly useful in reviewing weekly trading patterns and performance.
Use in ICT Trading
In ICT trading, the concept of the "open" is fundamental. The "ICT Digital Open Daily Dividers" indicator serves multiple purposes:
Market Structure Identification: By clearly marking daily opens, traders can easily identify market structure changes such as breakouts, retracements, or consolidations around these key levels.
Reference Points: The Sunday open is often a key level in ICT analysis, serving as a benchmark for assessing market direction for the upcoming week. This indicator’s ability to plot Sunday opens separately makes it uniquely suited for ICT strategies.
Time-based Analysis: ICT methodology often involves analyzing the market at specific times of the day. This indicator supports such analysis by marking significant session opens and closes.
Uniqueness and Advantages
The "ICT Digital Open Daily Dividers" stands out from other similar indicators due to its specialized features:
Sunday Open Highlighting: Few indicators offer the capability to specifically mark the Sunday open with distinct styling options.
Flexibility in Time Adjustments: With options to adjust the open time to either 6 PM or 12 AM, this indicator caters to a broader range of trading strategies and market conditions.
Enhanced Visualization: The wide range of customization options ensures that traders can tailor the indicator to their specific needs, enhancing the usability and visual clarity of their charts.
Compliance with TradingView's Pine Script Community Guidelines
The description adheres to TradingView's guidelines by being comprehensive, clear, and informative. It highlights the utility of the script, its unique features, and its application in trading strategies without making exaggerated claims about performance or profitability. The detailed customization options and unique functionalities are emphasized to differentiate this script from other standard daily divider indicators.
Educational
RSI + CHOP + Stochastic Strategy ( LONG/SHORT ) TP/SLMożna edytować poziomy TP i SL dla pozycji LONG i SHORT
SCALPING - interwał 5min
nifty supertrend tritonTrend based Strategy based on EMA , ATR and supertrend . Currently being used and testing on Nifty and Banknifty with adjusted parameters .
Do backtest before taking any trade
[ADDYad] Google Search Trends - Bitcoin (2012 Jan - 2025 Jan)This Pine Script shows the Google Search Trends as an indicator for Bitcoin from January 2012 to January 2025, based on monthly data retrieved from Google Trends. It calculates and displays the relative search interest for Bitcoin over time, offering a historical perspective on its popularity mainly built for BITSTAMP:BTCUSD .
Important note: This is not a live indicator. It visualizes historical search trends based on Google Trends data.
Key Features:
Data Source : Google Trends (Last retrieved in January 10 2025).
Timeframe : The script is designed to be used on a monthly chart, with the data reflecting monthly search trends from January 2012 to January 2025. For other timeframes, the data is linearly interpolated to estimate the trends at finer resolutions.
Purpose : This indicator helps visualize Bitcoin's search interest over the years, offering insights into public interest and sentiment during specific periods (e.g., major price movements or news events).
Data Handling : The data is interpolated for use on non-monthly timeframes, allowing you to view search trends on any chart timeframe. This makes it versatile for use in longer-term analysis or shorter timeframes, despite the raw data being available only on a monthly basis. However, it is most relevant for Monthly, Weekly, and Daily timeframes.
How It Works:
The script calculates the number of months elapsed since January 1, 2012, and uses this to interpolate Google Trends data values for any given point in time on the chart.
The linear interpolation function adjusts the monthly data to provide an approximate trend for intermediate months.
Why It's Useful:
Track Bitcoin's historic search trends to understand how interest in Bitcoin evolved over time, potentially correlating with price movements.
Correlate search trends with price action and other market indicators to analyze the effects of public sentiment and sentiment-driven market momentum.
Final Notes:
This script is unique because it shows real-world, non-financial dataset (Google Trends) to understand price action of Bitcoin correlating with public interest. Hopefully is a valuable addition to the TradingView community.
ADDYad
13, 21, 34 SMAs tradewithshamincluded 13,21 and 34 simple moving average for swing trade. use it in day candle
Percentage Calculator by Akshay GaurThis indicator calculates and displays percentage levels above and below the current price. It allows you to easily identify any percentage levels which can be used in many things like creating strangles and straddles and make informed trading decisions. The indicator automatically adjusts and redraws the lines and labels on the latest bar to reflect real-time market conditions.
Key Features:
• Calculates percentage levels above and below the current price
• Displays percentage levels on big labels with the horizontal lines on the chart
• Allows you to adjust the percentage value and every details.
• Allows you to see Fluctuation line on the chart.
How to Use:
1. Set the percentage value to the desired level (e.g. 1%, 2%, etc.)
2. If you want to see Fluctuation lines also then turn on it from Input settings.
3. Use the displayed levels to identify desired percentage levels.
4. Make informed trading decisions based on the calculated levels
Implied and Historical VolatilityAbstract
This TradingView indicator visualizes implied volatility (IV) derived from the VIX index and historical volatility (HV) computed from past price data of the S&P 500 (or any selected asset). It enables users to compare market participants' forward-looking volatility expectations (via VIX) with realized past volatility (via historical returns). Such comparisons are pivotal in identifying risk sentiment, volatility regimes, and potential mispricing in derivatives.
Functionality
Implied Volatility (IV):
The implied volatility is extracted from the VIX index, often referred to as the "fear gauge." The VIX represents the market's expectation of 30-day forward volatility, derived from options pricing on the S&P 500. Higher values of VIX indicate increased uncertainty and risk aversion (Whaley, 2000).
Historical Volatility (HV):
The historical volatility is calculated using the standard deviation of logarithmic returns over a user-defined period (default: 20 trading days). The result is annualized using a scaling factor (default: 252 trading days). Historical volatility represents the asset's past price fluctuation intensity, often used as a benchmark for realized risk (Hull, 2018).
Dynamic Background Visualization:
A dynamic background is used to highlight the relationship between IV and HV:
Yellow background: Implied volatility exceeds historical volatility, signaling elevated market expectations relative to past realized risk.
Blue background: Historical volatility exceeds implied volatility, suggesting the market might be underestimating future uncertainty.
Use Cases
Options Pricing and Trading:
The disparity between IV and HV provides insights into whether options are over- or underpriced. For example, when IV is significantly higher than HV, options traders might consider selling volatility-based derivatives to capitalize on elevated premiums (Natenberg, 1994).
Market Sentiment Analysis:
Implied volatility is often used as a proxy for market sentiment. Comparing IV to HV can help identify whether the market is overly optimistic or pessimistic about future risks.
Risk Management:
Institutional and retail investors alike use volatility measures to adjust portfolio risk exposure. Periods of high implied or historical volatility might necessitate rebalancing strategies to mitigate potential drawdowns (Campbell et al., 2001).
Volatility Trading Strategies:
Traders employing volatility arbitrage can benefit from understanding the IV/HV relationship. Strategies such as "long gamma" positions (buying options when IV < HV) or "short gamma" (selling options when IV > HV) are directly informed by these metrics.
Scientific Basis
The indicator leverages established financial principles:
Implied Volatility: Derived from the Black-Scholes-Merton model, implied volatility reflects the market's aggregate expectation of future price fluctuations (Black & Scholes, 1973).
Historical Volatility: Computed as the realized standard deviation of asset returns, historical volatility measures the intensity of past price movements, forming the basis for risk quantification (Jorion, 2007).
Behavioral Implications: IV often deviates from HV due to behavioral biases such as risk aversion and herding, creating opportunities for arbitrage (Baker & Wurgler, 2007).
Practical Considerations
Input Flexibility: Users can modify the length of the HV calculation and the annualization factor to suit specific markets or instruments.
Market Selection: The default ticker for implied volatility is the VIX (CBOE:VIX), but other volatility indices can be substituted for assets outside the S&P 500.
Data Frequency: This indicator is most effective on daily charts, as VIX data typically updates at a daily frequency.
Limitations
Implied volatility reflects the market's consensus but does not guarantee future accuracy, as it is subject to rapid adjustments based on news or events.
Historical volatility assumes a stationary distribution of returns, which might not hold during structural breaks or crises (Engle, 1982).
References
Black, F., & Scholes, M. (1973). "The Pricing of Options and Corporate Liabilities." Journal of Political Economy, 81(3), 637-654.
Whaley, R. E. (2000). "The Investor Fear Gauge." The Journal of Portfolio Management, 26(3), 12-17.
Hull, J. C. (2018). Options, Futures, and Other Derivatives. Pearson Education.
Natenberg, S. (1994). Option Volatility and Pricing: Advanced Trading Strategies and Techniques. McGraw-Hill.
Campbell, J. Y., Lo, A. W., & MacKinlay, A. C. (2001). The Econometrics of Financial Markets. Princeton University Press.
Jorion, P. (2007). Value at Risk: The New Benchmark for Managing Financial Risk. McGraw-Hill.
Baker, M., & Wurgler, J. (2007). "Investor Sentiment in the Stock Market." Journal of Economic Perspectives, 21(2), 129-151.
BTC vs Mag7 Combined IndexThis Mag7 Combined Index script is a custom TradingView indicator that calculates and visualizes the collective performance of the Magnificent 7 (Mag7) stocks—Apple, Microsoft, Alphabet, Amazon, NVIDIA, Tesla, and Meta (red line) compared to Bitcoin (blue line). It normalizes the daily closing prices of each stock to their initial value on the chart, scales them into percentages, and then computes their simple average to form a combined index. The result is plotted as a single red line, offering a clear view of the aggregated performance of these influential stocks over time compared to Bitcoin.
This indicator is ideal for analyzing the overall market impact of Bitcoin compared to the Mag7 stocks.
Bitcoin vs Mag7 Combined IndexThis Mag7 Combined Index script is a custom TradingView indicator that calculates and visualizes the collective performance of the Magnificent 7 (Mag7) stocks—Apple, Microsoft, Alphabet, Amazon, NVIDIA, Tesla, and Meta (red line) compared to Bitcoin (blue line). It normalizes the daily closing prices of each stock to their initial value on the chart, scales them into percentages, and then computes their simple average to form a combined index. The result is plotted as a single line, offering a clear view of the aggregated performance of these influential stocks over time compared to Bitcoin.
This indicator is ideal for analyzing the overall market impact of the Mag7 compared to Bitcoin.
Kamal 5 Tick Trading SetupKamal 5 Tick Trading Setup
The "Kamal 5 Tick Trading Setup" is a custom indicator designed by Kamal Preet Singh Trader for TradingView to identify potential Buy and Sell signals on daily forex charts. This indicator helps traders make informed decisions based on the price action of the previous five daily candles.
Indicator Logic:
Buy Signal: A Buy signal is generated when the closing price of the current candle exceeds the highest high of the previous five daily candles.
Sell Signal: A Sell signal is generated when the closing price of the current candle falls below the lowest low of the previous five daily candles.
Features:
Lookback Period: The indicator uses a lookback period of five candles to determine the highest high and lowest low.
Visual Signals: Buy signals are plotted as green "BUY" labels below the candles, while Sell signals are plotted as red "SELL" labels above the candles.
Debugging Plots: The highest high and lowest low of the previous five candles are plotted as blue and orange lines, respectively, to help verify the conditions for Buy and Sell signals.
Non-Repetitive Signals: The indicator ensures that once a Buy signal is given, no further Buy signals are generated until a Sell signal is given, and vice versa.
Usage:
Apply the indicator to your daily forex chart in TradingView.
Observe the plotted Buy and Sell signals to identify potential entry and exit points.
Use the debugging plots to ensure the conditions for the signals are being met correctly.
This indicator provides a straightforward approach to trading based on recent price action, helping traders capitalize on potential breakout and breakdown opportunities.
Beardy Squeeze Pro (With high compression squeeze alert)Added high compression squeeze alert to the Beardy Squeeze Pro
Dr. Elder Overbought Zone v2Only a test, work in progress. Trying to figure out when to a stock has had a too large move, and it's bound to return back to the mean.
Simple Average Price & Target ProfitThis script is designed to help users calculate and visualize the weighted average price of an asset based on multiple entry points, along with the target price and the potential profit. The user can input specific prices for three different entries, along with the percentage of total investment allocated to each price point. The script then calculates the weighted average price based on these entries and displays it on the chart. Additionally, it calculates the potential profit at a given target price, which is plotted on the chart.
mr.crypto731Description:
📊 Enhanced MACD with Strong Buy/Sell Signals 🚀
This script is designed to enhance the standard MACD indicator by adding clear, strong buy and sell signals. It includes:
MACD Line: A fast-moving average that reacts quickly to price changes.
Signal Line: A slower-moving average that smooths out price fluctuations.
MACD Histogram: The difference between the MACD Line and Signal Line, helping to identify trend strength and direction.
Key Features:
Strong Buy/Sell Signals: Uses crossovers of the MACD Line and Signal Line to generate strong buy/sell signals.
Color-Coded Background: Provides visual cues with background colors to highlight strong signals.
User-Friendly Interface: Customizable settings for MACD Fast Length, Slow Length, and Signal Smoothing.
Ichimoku with Shifted and Unshifted Senkou BIchimoku Kinko Hyo Indicator Explanation
The Ichimoku Kinko Hyo is a comprehensive technical indicator designed to provide insights into the market's trend, support/resistance levels, and momentum, all in one glance. It consists of five main components:
Tenkan-sen (Conversion Line): A fast-moving average.
Kijun-sen (Base Line): A slower-moving average.
Senkou Span A (Leading Span A): The average of Tenkan-sen and Kijun-sen, shifted forward in time.
Senkou Span B (Leading Span B): A slower moving average of the high and low price over a period of 52 periods, shifted forward in time.
Chikou Span (Lagging Line): The closing price shifted back in time by 26 periods.
The Ichimoku indicator is typically used to identify the trend direction, momentum, and support/resistance levels. The cloud formed between Senkou Span A and Senkou Span B is key in identifying the market's overall trend.
Dynamic Volatility Differential Model (DVDM)The Dynamic Volatility Differential Model (DVDM) is a quantitative trading strategy designed to exploit the spread between implied volatility (IV) and historical (realized) volatility (HV). This strategy identifies trading opportunities by dynamically adjusting thresholds based on the standard deviation of the volatility spread. The DVDM is versatile and applicable across various markets, including equity indices, commodities, and derivatives such as the FDAX (DAX Futures).
Key Components of the DVDM:
1. Implied Volatility (IV):
The IV is derived from options markets and reflects the market’s expectation of future price volatility. For instance, the strategy uses volatility indices such as the VIX (S&P 500), VXN (Nasdaq 100), or RVX (Russell 2000), depending on the target market. These indices serve as proxies for market sentiment and risk perception (Whaley, 2000).
2. Historical Volatility (HV):
The HV is computed from the log returns of the underlying asset’s price. It represents the actual volatility observed in the market over a defined lookback period, adjusted to annualized levels using a multiplier of \sqrt{252} for daily data (Hull, 2012).
3. Volatility Spread:
The difference between IV and HV forms the volatility spread, which is a measure of divergence between market expectations and actual market behavior.
4. Dynamic Thresholds:
Unlike static thresholds, the DVDM employs dynamic thresholds derived from the standard deviation of the volatility spread. The thresholds are scaled by a user-defined multiplier, ensuring adaptability to market conditions and volatility regimes (Christoffersen & Jacobs, 2004).
Trading Logic:
1. Long Entry:
A long position is initiated when the volatility spread exceeds the upper dynamic threshold, signaling that implied volatility is significantly higher than realized volatility. This condition suggests potential mean reversion, as markets may correct inflated risk premiums.
2. Short Entry:
A short position is initiated when the volatility spread falls below the lower dynamic threshold, indicating that implied volatility is significantly undervalued relative to realized volatility. This signals the possibility of increased market uncertainty.
3. Exit Conditions:
Positions are closed when the volatility spread crosses the zero line, signifying a normalization of the divergence.
Advantages of the DVDM:
1. Adaptability:
Dynamic thresholds allow the strategy to adjust to changing market conditions, making it suitable for both low-volatility and high-volatility environments.
2. Quantitative Precision:
The use of standard deviation-based thresholds enhances statistical reliability and reduces subjectivity in decision-making.
3. Market Versatility:
The strategy’s reliance on volatility metrics makes it universally applicable across asset classes and markets, ensuring robust performance.
Scientific Relevance:
The strategy builds on empirical research into the predictive power of implied volatility over realized volatility (Poon & Granger, 2003). By leveraging the divergence between these measures, the DVDM aligns with findings that IV often overestimates future volatility, creating opportunities for mean-reversion trades. Furthermore, the inclusion of dynamic thresholds aligns with risk management best practices by adapting to volatility clustering, a well-documented phenomenon in financial markets (Engle, 1982).
References:
1. Christoffersen, P., & Jacobs, K. (2004). The importance of the volatility risk premium for volatility forecasting. Journal of Financial and Quantitative Analysis, 39(2), 375-397.
2. Engle, R. F. (1982). Autoregressive conditional heteroskedasticity with estimates of the variance of United Kingdom inflation. Econometrica, 50(4), 987-1007.
3. Hull, J. C. (2012). Options, Futures, and Other Derivatives. Pearson Education.
4. Poon, S. H., & Granger, C. W. J. (2003). Forecasting volatility in financial markets: A review. Journal of Economic Literature, 41(2), 478-539.
5. Whaley, R. E. (2000). The investor fear gauge. Journal of Portfolio Management, 26(3), 12-17.
This strategy leverages quantitative techniques and statistical rigor to provide a systematic approach to volatility trading, making it a valuable tool for professional traders and quantitative analysts.
Market Regime DetectorMarket Regime Detector
The Market Regime Detector is a tool designed to help traders identify and adapt to the prevailing market environment by analyzing price action in relation to key macro timeframe levels. This indicator categorizes the market into distinct regimes—Bullish, Bearish, or Reverting—providing actionable insights to set trading expectations, manage volatility, and align strategies with broader market conditions.
What is a Market Regime?
A market regime refers to the overarching state or condition of the market at a given time. Understanding the market regime is critical for traders as it determines the most effective trading approach. The three main regimes are:
Bullish Regime:
Characterized by upward momentum where prices are consistently trending higher.
Trading strategies often focus on buying opportunities and trend-following setups.
Bearish Regime:
Defined by downward price pressure and declining trends.
Traders typically look for selling opportunities or adopt risk-off strategies.
Reverting Regime:
Represents a consolidation phase where prices move within a defined range.
Ideal for mean-reversion strategies or range-bound trading setups.
Key Features of the Market Regime Detector:
Dynamic Market Regime Detection:
Identifies the market regime based on macro timeframe high and low levels (e.g., weekly or monthly).
Provides clear and actionable insights for each regime to align trading strategies.
Visual Context for Price Levels:
Plots the macro high and low levels on the chart, allowing traders to visualize critical support and resistance zones.
Enhances understanding of volatility and trend boundaries.
Regime Transition Alerts:
Sends alerts only when the market transitions into a new regime, ensuring traders are notified of meaningful changes without redundant signals.
Alert messages include clear regime descriptions, such as "Market entered a Bullish Regime: Price is above the macro high."
Customizable Visualization:
Background colors dynamically adjust to the current regime:
Blue for Reverting.
Aqua for Bullish.
Fuchsia for Bearish.
Option to toggle high/low line plotting and background highlights for a tailored experience.
Volatility and Expectation Management:
Offers insights into market volatility by showing when price action approaches, exceeds, or reverts within macro timeframe levels.
Helps traders set realistic expectations and adjust their strategies accordingly.
Use Cases:
Trend Traders: Identify bullish or bearish regimes to capture sustained price movements.
Range Traders: Leverage reverting regimes to trade between defined support and resistance zones.
Risk Managers: Use macro high and low levels as dynamic stop-loss or take-profit zones to optimize trade management.
The Market Regime Detector equips traders with a deeper understanding of the market environment, making it an essential tool for informed decision-making and strategic planning. Whether you're trading trends, ranges, or managing risk, this indicator provides the clarity and insights needed to navigate any market condition.
Renko Chart EmulationRenko charts are a popular tool in technical analysis, known for their ability to filter out market noise and focus purely on price movements. Unlike traditional candlestick or bar charts, Renko charts are not time-based but are constructed using bricks that represent a fixed price movement. This makes them particularly useful for identifying trends and key levels of support and resistance. While Renko charts are commonly found on platforms with specialized charting capabilities, they can also be emulated in Pine Script as a line indicator.
The Renko emulation indicator in Pine Script calculates the movement of price based on a user-defined brick size. Whenever the price moves up or down by an amount equal to or greater than the brick size, a new level is plotted, indicating a shift in price direction. This approach helps traders visualize significant price moves without the distractions of smaller fluctuations. By plotting the Renko levels as a continuous line and coloring it based on direction, this indicator provides a clean and straightforward representation of market trends.
Traders can use this Renko emulation line to identify potential entry and exit points, as well as to confirm ongoing trends. The simplicity of Renko charts makes them a favorite among those who prefer a minimalist approach to technical analysis. However, it is essential to choose an appropriate brick size that aligns with the volatility of the trading instrument. A smaller brick size may result in frequent signals, while a larger one can smooth out the chart, focusing only on the most substantial price movements. This script offers a flexible solution for incorporating Renko-style analysis into any trading strategy.
Adaptive Sentiment-Volume MomentumThis is a simple breakout approach using ATR bands and an EMA filter. Test this strategy and let me know how it performs!
Correlation Coefficient Master TableThe Correlation Coefficient Master Table is a comprehensive tool designed to calculate and visualize the correlation coefficient between a selected base asset and multiple other assets over various time periods. It provides traders and analysts with a clear understanding of the relationships between assets, enabling them to analyze trends, diversification opportunities, and market dynamics. You can define key parameters such as the base asset’s data source (e.g., close price), the assets to compare against (up to six symbols), and multiple lookback periods for granular analysis.
The indicator calculates the covariance and normalizes it by the product of the standard deviations. The correlation coefficient ranges from -1 to +1, with +1 indicating a perfect positive relationship, -1 a perfect negative relationship, and 0 no relationship.
You can specify the lookback periods (e.g., 15, 30, 90, or 120 bars) to tailor the calculation to their analysis needs. The results are visualized as both a line plot and a table. The line plot shows the correlation over the primary lookback period (the Chart Length), which can be used to inspect a certain length close up, or could be used in conjunction with the table to provide you with five lookback periods at once for the same base asset. The dynamically created table provides a detailed breakdown of correlation values for up to six target assets across the four user-defined lengths. The table’s cells are formatted with rounded values and color-coded for easy interpretation.
This indicator is ideal for traders, portfolio managers, and market researchers who need an in-depth understanding of asset interdependencies. By providing both the numerical correlation coefficients and their visual representation, users can easily identify patterns, assess diversification strategies, and monitor correlations across multiple timeframes, making it a valuable tool for decision-making.
AVP 259 alertsits a mixture of indicators that merges the famous indicators in one single form to easily get explained with their study and mastery
Fibonacci Trend - Aynet1. Inputs
lookbackPeriod: Defines the number of bars to consider for calculating swing highs and lows. Default is 20.
fibLevel1 to fibLevel5: Fibonacci retracement levels to calculate price levels (23.6%, 38.2%, 50%, 61.8%, 78.6%).
useTime: Enables or disables time-based Fibonacci projections.
riskPercent: Defines the percentage of risk for trading purposes (currently not used in calculations).
2. Functions
isSwingHigh(index): Identifies a swing high at the given index, where the high of that candle is higher than both its previous and subsequent candles.
isSwingLow(index): Identifies a swing low at the given index, where the low of that candle is lower than both its previous and subsequent candles.
3. Variables
swingHigh and swingLow: Store the most recent swing high and swing low prices.
swingHighTime and swingLowTime: Store the timestamps of the swing high and swing low.
fib1 to fib5: Fibonacci levels based on the difference between swingHigh and swingLow.
4. Swing Point Detection
The script checks if the last bar is a swing high or swing low using the isSwingHigh() and isSwingLow() functions.
If a swing high is detected:
The high price is stored in swingHigh.
The timestamp of the swing high is stored in swingHighTime.
If a swing low is detected:
The low price is stored in swingLow.
The timestamp of the swing low is stored in swingLowTime.
5. Fibonacci Levels Calculation
If both swingHigh and swingLow are defined, the script calculates the Fibonacci retracement levels (fib1 to fib5) based on the price difference (priceDiff = swingHigh - swingLow).
6. Plotting Fibonacci Levels
Fibonacci levels (fib1 to fib5) are plotted as horizontal lines using the line.new() function.
Labels (e.g., "23.6%") are added near the lines to indicate the level.
Lines and labels are color-coded:
23.6% → Blue
38.2% → Green
50.0% → Yellow
61.8% → Orange
78.6% → Red
7. Filling Between Fibonacci Levels
The plot() function creates lines for each Fibonacci level.
The fill() function is used to fill the space between two levels with semi-transparent colors:
Blue → Between fib1 and fib2
Green → Between fib2 and fib3
Yellow → Between fib3 and fib4
Orange → Between fib4 and fib5
8. Time-Based Fibonacci Projections
If useTime is enabled:
The time difference (timeDiff) between the swing high and swing low is calculated.
Fibonacci time projections are added based on multiples of 23.6%.
If the current time reaches a projected time, a label (e.g., "T1", "T2") is displayed near the high price.
9. Trading Logic
Two placeholder variables are defined for trading logic:
longCondition: Tracks whether a condition for a long trade is met (currently not implemented).
shortCondition: Tracks whether a condition for a short trade is met (currently not implemented).
These variables can be extended to define entry/exit signals based on Fibonacci levels.
How It Works
Detect Swing Points: It identifies recent swing high and swing low points on the chart.
Calculate Fibonacci Levels: Based on the swing points, it computes retracement levels.
Visualize Levels: Plots the levels on the chart with labels and fills between them.
Time Projections: Optionally calculates time-based projections for future price movements.
Trading Opportunities: The framework provides tools for detecting potential reversal or breakout zones using Fibonacci levels.