Weekly and daily separatorsThis script plots vertical line between each trading week (thick, solid) and smaller lines (dotted) between each trading day. This helps kepping a better overview on the aspect of time on the higher timeframes below 1D. The distance of the lines to the top and bottom of the chart is controlled by your chart settings menu under Appearance -> Margins.
Forecasting
ICT SessionsThis script plots the timewindows of the ICT killzones (for forex) and trading session + makros below the chart. Individual components can be switched of to your liking
ICT MakrosThis script highlights the ICT trading makros and silverbullet timewindows with different background colors on your chart. The drawings are only visible on the timeframe 1min - 5min because they become useless above and i didnt code the logic for below 1min
Simple Moving Average Extrapolation via Monte Carlo (SMAE)In this post, I will dive into my Moving Average Extrapolator, a tool that I created to help traders predict future price movements based on past data. I will discuss the underlying logic, its limitations, and the importance of accounting for delays in the moving average. The following code, my Moving Average Extrapolator, will serve as the basis for our discussion.
The Moving Average Extrapolator uses a simple moving average (SMA) to analyze past price movements and make predictions about future price movements. It uses a Monte Carlo simulation to generate possible future price movements based on historical probabilities.
Let's start by understanding the different components of the code:
The movement_probability function calculates the probability of green and red price movements, where green movements indicate an increase in price, and red movements indicate a decrease in price.
The monte function generates an array of potential price movements using a Monte Carlo simulation.
The sim function uses the generated Monte Carlo array to simulate potential future price movements based on the probabilities calculated earlier.
The draw_lines function draws lines connecting the current price to the extrapolated future price movements.
The extrapolate function calculates the extrapolated future price movements based on the provided source, length, and accuracy.
Limitations of My Moving Average Extrapolator:
Reliance on historical data: My Moving Average Extrapolator relies heavily on historical data to make future price predictions. This can be a limitation, as past performance does not guarantee future results. Market conditions can change, making the extrapolator less reliable in predicting future price movements.
Inherent randomness: The Monte Carlo simulation introduces an element of randomness in the extrapolator's predictions. While this can help in exploring various scenarios, it may not always accurately predict future price movements.
Delay in the moving average: Moving averages inherently have a delay, as they are based on past data. This delay can cause my Moving Average Extrapolator to be less accurate in predicting immediate price movements.
Accounting for Delays in the Moving Average:
It is essential to account for the delay in the moving average to improve the accuracy of my Moving Average Extrapolator. I have taken this into account by introducing a delay variable (delay) in the draw_lines function. The delay variable calculates the delay as half the moving average's length and adjusts the time axis accordingly.
This adjustment helps in reducing the lag in the extrapolator's predictions, making it more accurate and useful for traders. However, it is important to note that even with this adjustment, my Moving Average Extrapolator is still subject to the limitations discussed earlier.
Adding Custom Lookback Period to My Moving Average Extrapolator:
To enhance the functionality and adaptability of my Moving Average Extrapolator, I have implemented an option to set a custom lookback period. The lookback period determines how far back in the historical data the Moving Average Extrapolator should start its analysis.
To achieve this, I have included a method to obtain the current bar index and then calculate the starting bar index by subtracting the desired lookback period.
Here's how to implement the custom lookback period in the Moving Average Extrapolator:
Get the current bar index: I use the bar_index built-in variable to get the current bar index, which represents the current position in the historical data.
Set the start index: To set the start index, you can subtract the desired lookback period from the current bar index. In the code, I have defined a user-input number variable, which can be set to the desired lookback period. By default, it is set to 20800. The starting index for the Moving Average Extrapolator's analysis is calculated as bar_index - number.
Here's the relevant code snippet:
number = input.int(20800, "Bar Start")
And to conditionally run the calculations:
if bar_index > number
draw_lines(avg, extrapolate(close, length, 10), length, extrapolate)
By implementing this custom lookback period, users can easily adjust the starting point of the Moving Average Extrapolator based on their preferences and trading strategies. This allows for more flexibility and adaptability to different market scenarios and ensures that the Moving Average Extrapolator remains a valuable tool for traders.
Conclusion:
My Moving Average Extrapolator can be a valuable tool for traders looking to predict future price movements based on historical data. However, it is essential to understand its limitations and the need to account for the delay in the moving average. By considering these factors, traders can make better-informed decisions and use my Moving Average Extrapolator to complement their trading strategies effectively.
BankNifty targets using VIX Version 2Original Idea Credit: Verified Market Waves
Hi,
After watching different videos online on how to get targets of BankNifty & Nifty decided to write this small script using VIX.
Nothing great but I really like the concept of getting high and low targets for the day or weekly or monthly or yearly.
What does the script do
1. We get closing of India Vix & BankNifty and Nifty
2. We get square root of Daily (365 days) | Weekly (52) | Monthly (12) & Yearly (1)
3. We divide India Vix closing with different square root to get a decimal value.
4. We use the derived value from step 3 which is used as % to calculate high and low values on BankNifty close price.
Small explanation via below screen shot to understand how to use it.
As always it comes with source code so you can modify as per your requirement.
Hope it helps 👍
Price Extrapolator with Std DeviationPrice Extrapolator with Deviation Cones - A Powerful Tool for Predicting Future Prices
Subtitle: Discover how this custom indicator can help you forecast potential price movements with greater accuracy, using historical data.
Introduction
Predicting future price movements is always a challenge for traders and investors. However, by using historical data and statistical analysis, it is possible to make educated guesses about the likelihood of certain outcomes. One such tool for predicting future prices is the Price Extrapolator with Standard Deviation Cones. This custom indicator, can help you visualize potential price movements and their associated risks.
In this post, we will explain how the Price Extrapolator with Deviation Cones works, how to adjust its settings to suit your needs, and how to interpret its output. By the end of this article, you should have a better understanding of how this powerful tool can help you make more informed decisions when trading or investing in financial markets.
Understanding the Price Extrapolator with Deviation Cones
The Price Extrapolator with Deviation Cones is a custom indicator that uses historical price data to calculate the average log return and standard deviation of log returns over a specified period. It then uses this information to extrapolate a series of future price points, as well as upper and lower standard deviation bands that form the "deviation cones."
The average log return represents the expected price change, while the standard deviation of log returns provides a measure of the uncertainty or risk associated with the prediction. The deviation cones can help you visualize the range of potential price movements and assess the likelihood of different outcomes.
Configuring the Indicator
To use the Price Extrapolator with Deviation Cones, you will need to configure several input settings:
1. Length: This setting determines the number of historical data points used to calculate the average log return and standard deviation of log returns. A higher value will produce a smoother, less sensitive indicator, while a lower value will make the indicator more responsive to recent price changes.
2. Number of Future Price Points: This setting controls the number of future price points to extrapolate. Increasing this value will extend the deviation cones further into the future.
3. Multiplier: This setting adjusts the tightness of the deviation cones by controlling the standard deviation multiplier. A higher value will result in wider cones, indicating greater uncertainty, while a lower value will produce narrower cones, suggesting more confidence in the prediction.
Interpreting the Output
After configuring the indicator, you will see the following output on your chart:
1. Green Line: This line represents the extrapolated future price points based on the average log return. It provides a central estimate of potential price movements.
2. Red Lines: These lines form the upper and lower bounds of the deviation cones. They represent the range of potential price movements, taking into account the uncertainty associated with the prediction.
When using the Price Extrapolator with Deviation Cones, it is essential to remember that the output is only a prediction based on historical data and should not be taken as a guarantee of future price movements. However, by providing a visual representation of potential price movements and their associated risks, this indicator can help you make more informed decisions when trading or investing in financial markets.
The Extreme Limitations of the Price Extrapolator with Deviation Cones
While the Price Extrapolator with Deviation Cones can be a valuable addition to your trading toolbox, it is essential to recognize its limitations. As with any forecasting tool, it is not infallible and should be used in conjunction with other forms of analysis. In this section, we will discuss the extreme limitations of this indicator and provide insight into how to use it effectively despite these constraints.
1. Reliance on Historical Data
The Price Extrapolator with Deviation Cones relies heavily on historical price data to make its predictions. While this can provide valuable insights into past trends and patterns, it may not accurately predict future price movements in a constantly changing market.
Market conditions can change rapidly, and historical data may not be a reliable indicator of future performance. Economic events, geopolitical tensions, and changes in market sentiment can all influence price movements in ways that may not be captured by historical data alone.
2. Assumption of Lognormal Distribution
The indicator assumes that price returns follow a lognormal distribution, which may not always be the case. Financial markets can exhibit skewness and kurtosis, resulting in distributions that are not symmetrical or normally distributed. This can lead to inaccurate predictions and a false sense of security when relying on the deviation cones.
3. No Consideration of Fundamental Factors
The Price Extrapolator with Deviation Cones is a purely technical analysis tool, meaning it does not take into account fundamental factors that can influence price movements. Changes in company earnings, interest rates, or economic data can significantly impact asset prices and may not be factored into the indicator's predictions.
4. Limited Time Horizon
The indicator only provides predictions for a limited number of future price points, which may not be sufficient for long-term investors or traders with longer holding periods. Additionally, the accuracy of the predictions may decrease as the time horizon extends, due to the compounding effects of uncertainty and the limitations of historical data.
5. Potential for Overfitting
When adjusting the settings of the Price Extrapolator with Deviation Cones, there is a risk of overfitting the model to the historical data. This can result in an indicator that appears to have excellent predictive power on past data but performs poorly on unseen, future data. It is crucial to be cautious when optimizing the settings and use out-of-sample testing to validate the indicator's performance.
Using the Price Extrapolator with Deviation Cones Effectively
Despite these limitations, the Price Extrapolator with Deviation Cones can still be a valuable tool when used correctly. To use this indicator effectively, consider the following tips:
1. Supplement with Other Forms of Analysis: Use the Price Extrapolator with Deviation Cones alongside other technical and fundamental analysis methods to gain a more comprehensive understanding of potential price movements.
2. Diversify your Trading Strategies: Do not rely solely on the Price Extrapolator with Deviation Cones for your trading decisions. Instead, diversify your strategies and consider multiple indicators and methods to reduce the risk of overreliance on a single tool.
3. Be Cautious with Optimized Settings: When adjusting the indicator's settings, be mindful of the risk of overfitting and validate the performance with out-of-sample testing.
4. Keep an Eye on Market Conditions: Stay informed about current market conditions, economic events, and news that may impact your trading decisions. This will help you make more informed decisions when using the Price Extrapolator with Deviation Cones.
In conclusion, the Price Extrapolator with Deviation Cones is a powerful and versatile tool that can aid traders and investors in predicting potential future price movements. However, it is crucial to remember that this indicator has its limitations, which stem from its reliance on historical data, the assumption of lognormal distribution, its disregard for fundamental factors, limited time horizons, and the potential for overfitting. Despite these constraints, when used correctly and in conjunction with other forms of analysis, the Price Extrapolator with Deviation Cones can provide valuable insights and assist in making more informed trading and investing decisions.
By understanding the underlying mechanics of the indicator, adjusting its settings according to your needs, and being aware of its limitations, you can incorporate the Price Extrapolator with Deviation Cones into your trading arsenal effectively. Always remember that no single tool or indicator is infallible, and it is essential to use a diverse range of analysis methods and strategies to navigate the ever-changing financial markets successfully. Happy trading!
Potential Gain/Loss IndicatorThis indicator calculates the gains and losses in percentage based on the highest high (ATH) and lowest low (ATL) of a given period. It takes the period as an input parameter and calculates the ATH and ATL within that period.
The indicator then calculates the potential gains in percentage if the price goes back to the ATH, as well as the potential losses in percentage if the price goes back to the ATL.
A filled area chart is plotted to show the difference between gains and losses (gains - losses) using a stepline, with green color when positive and red color when negative. The coefficient parameter allows for adjusting the scale of the gains and losses.
# Parameters
1. `period` (integer): The period used for calculating the highest high (ATH) and lowest low (ATL) within the given range. The default value is 50, and the user can select any value greater than or equal to 1.
2. `coef` (float): A coefficient to adjust the scale of the gains and losses. The default value is 0.5, and the user can select any value greater than or equal to 0.1.
Fibonacci Retracements & Trend Following Strategy Hello! This code creates a Fibonacci retracement indicator and a trend-following strategy indicator. Trading signals and price reversal targets are also calculated. The overall structure of the code is quite clear and readable. The purpose of the code is to calculate Fibonacci retracement levels and a trend-following indicator, display price levels on a chart, calculate trading signals, and calculate price reversal targets.
In the first section, Fibonacci levels are determined. Four different Fibonacci levels are defined: 0.236, 0.382, 0.618, and 0.786. These levels will be used as retracement levels.
Next, a trend-following indicator is calculated. This indicator calculates the averages of high and low prices over a certain period. This indicator can be used to determine the direction of the trend.
Then, price levels are calculated. These levels are determined by calculating the difference between the highest and lowest prices of the trend-following indicator. These levels are used in the calculation of Fibonacci retracement levels.
Next, Fibonacci levels are calculated. These levels are calculated by multiplying price levels with Fibonacci retracement levels. These levels are displayed on the chart.
Trading signals and price reversal targets are calculated. This can be used to trade using a Fibonacci retracement strategy.
Finally, price reversal targets are displayed as circles on the chart.
Usage Guide: Fibonacci Retracement Indicator and Trend Following Strategy
This indicator is used for calculating Fibonacci retracement levels and a trend following indicator, displaying price levels on the chart, calculating trading signals, and determining price targets for reversals. It is important to understand how the indicator works and what type of trading signals it generates before trading with it.
1.)Fibonacci Retracement Levels
Fibonacci retracement levels are used to measure the retracement levels of a trend on the chart. These levels can be used where traders are looking for a reversal signal in the market.
This indicator uses four different Fibonacci levels, which are 0.236, 0.382, 0.618, and 0.786. These levels will be used as retracement levels.
2.)Trend Following Indicator
The trend following indicator calculates the averages of high and low prices over a specific period. This indicator can be used to determine the direction of the trend. While showing a rising trend, it helps the prices stay high, and when showing a falling trend, it can help the prices stay low.
3.)Price Levels
Price levels are determined by calculating the difference between the highest and lowest prices of the trend following indicator. These levels are used to calculate Fibonacci retracement levels.
4.)Trading Signals and Price Reversal Targets
Trading signals and price reversal targets can be used to trade using a Fibonacci retracement strategy. The indicator can buy at Fibonacci levels where prices are retreating in an uptrend, and sell at Fibonacci levels where prices are retreating in a downtrend.
Price reversal targets are shown on the chart in circles.
5.)Fibonacci Retracement Targets
The Fibonacci retracement targets are shown in circles on the chart. These target price levels are calculated by applying Fibonacci retracement levels to the high and low price ranges. These levels can help determine buy or sell signals.
6.)Buy and Sell Signals
The most important feature of the indicator is to determine buy and sell signals. A buy signal is given when the trend-following indicator falls below one of the Fibonacci retracement levels and the price drops below it. A sell signal is given when the trend-following indicator rises and the price goes above one of the Fibonacci retracement levels.
7.)Target Price Levels
Using the retracement levels can be used to determine potential target price levels. Target price levels are determined based on Fibonacci retracement levels and positions can be closed when these levels are reached.
8.)Examples of Using the Indicator:
a) Buy Signal
If the trend-following indicator drops below the 0.618 Fibonacci retracement level and the price falls below it, a buy signal can be given. The target price level can be between the 0.382 and 0.236 Fibonacci retracement levels.
b) Sell Signal
If the trend-following indicator rises and the price goes above the 0.236 Fibonacci retracement level, a sell signal can be given. The target price level can be between the 0.382 and 0.618 Fibonacci retracement levels.
c) Target Price Levels
When a position is opened, target price levels can be determined based on Fibonacci retracement levels. For example, when opening a buy position, the target price level can be between the 0.382 and 0.236 Fibonacci retracement levels.
The use of the indicator can be made more effective by using it together with other technical analysis tools. In addition, practical experimentation with the use of the indicator in different scenarios can help understand how the indicator works.
Goertzel Browser [Loxx]As the financial markets become increasingly complex and data-driven, traders and analysts must leverage powerful tools to gain insights and make informed decisions. One such tool is the Goertzel Browser indicator, a sophisticated technical analysis indicator that helps identify cyclical patterns in financial data. This powerful tool is capable of detecting cyclical patterns in financial data, helping traders to make better predictions and optimize their trading strategies. With its unique combination of mathematical algorithms and advanced charting capabilities, this indicator has the potential to revolutionize the way we approach financial modeling and trading.
█ Brief Overview of the Goertzel Browser
The Goertzel Browser is a sophisticated technical analysis tool that utilizes the Goertzel algorithm to analyze and visualize cyclical components within a financial time series. By identifying these cycles and their characteristics, the indicator aims to provide valuable insights into the market's underlying price movements, which could potentially be used for making informed trading decisions.
The primary purpose of this indicator is to:
1. Detect and analyze the dominant cycles present in the price data.
2. Reconstruct and visualize the composite wave based on the detected cycles.
3. Project the composite wave into the future, providing a potential roadmap for upcoming price movements.
To achieve this, the indicator performs several tasks:
1. Detrending the price data: The indicator preprocesses the price data using various detrending techniques, such as Hodrick-Prescott filters, zero-lag moving averages, and linear regression, to remove the underlying trend and focus on the cyclical components.
2. Applying the Goertzel algorithm: The indicator applies the Goertzel algorithm to the detrended price data, identifying the dominant cycles and their characteristics, such as amplitude, phase, and cycle strength.
3. Constructing the composite wave: The indicator reconstructs the composite wave by combining the detected cycles, either by using a user-defined list of cycles or by selecting the top N cycles based on their amplitude or cycle strength.
4. Visualizing the composite wave: The indicator plots the composite wave, using solid lines for the past and dotted lines for the future projections. The color of the lines indicates whether the wave is increasing or decreasing.
5. Displaying cycle information: The indicator provides a table that displays detailed information about the detected cycles, including their rank, period, Bartel's test results, amplitude, and phase.
This indicator is a powerful tool that employs the Goertzel algorithm to analyze and visualize the cyclical components within a financial time series. By providing insights into the underlying price movements and their potential future trajectory, the indicator aims to assist traders in making more informed decisions.
█ What is the Goertzel Algorithm?
The Goertzel algorithm, named after Gerald Goertzel, is a digital signal processing technique that is used to efficiently compute individual terms of the Discrete Fourier Transform (DFT). It was first introduced in 1958, and since then, it has found various applications in the fields of engineering, mathematics, and physics.
The Goertzel algorithm is primarily used to detect specific frequency components within a digital signal, making it particularly useful in applications where only a few frequency components are of interest. The algorithm is computationally efficient, as it requires fewer calculations than the Fast Fourier Transform (FFT) when detecting a small number of frequency components. This efficiency makes the Goertzel algorithm a popular choice in applications such as:
1. Telecommunications: The Goertzel algorithm is used for decoding Dual-Tone Multi-Frequency (DTMF) signals, which are the tones generated when pressing buttons on a telephone keypad. By identifying specific frequency components, the algorithm can accurately determine which button has been pressed.
2. Audio processing: The algorithm can be used to detect specific pitches or harmonics in an audio signal, making it useful in applications like pitch detection and tuning musical instruments.
3. Vibration analysis: In the field of mechanical engineering, the Goertzel algorithm can be applied to analyze vibrations in rotating machinery, helping to identify faulty components or signs of wear.
4. Power system analysis: The algorithm can be used to measure harmonic content in power systems, allowing engineers to assess power quality and detect potential issues.
The Goertzel algorithm is used in these applications because it offers several advantages over other methods, such as the FFT:
1. Computational efficiency: The Goertzel algorithm requires fewer calculations when detecting a small number of frequency components, making it more computationally efficient than the FFT in these cases.
2. Real-time analysis: The algorithm can be implemented in a streaming fashion, allowing for real-time analysis of signals, which is crucial in applications like telecommunications and audio processing.
3. Memory efficiency: The Goertzel algorithm requires less memory than the FFT, as it only computes the frequency components of interest.
4. Precision: The algorithm is less susceptible to numerical errors compared to the FFT, ensuring more accurate results in applications where precision is essential.
The Goertzel algorithm is an efficient digital signal processing technique that is primarily used to detect specific frequency components within a signal. Its computational efficiency, real-time capabilities, and precision make it an attractive choice for various applications, including telecommunications, audio processing, vibration analysis, and power system analysis. The algorithm has been widely adopted since its introduction in 1958 and continues to be an essential tool in the fields of engineering, mathematics, and physics.
█ Goertzel Algorithm in Quantitative Finance: In-Depth Analysis and Applications
The Goertzel algorithm, initially designed for signal processing in telecommunications, has gained significant traction in the financial industry due to its efficient frequency detection capabilities. In quantitative finance, the Goertzel algorithm has been utilized for uncovering hidden market cycles, developing data-driven trading strategies, and optimizing risk management. This section delves deeper into the applications of the Goertzel algorithm in finance, particularly within the context of quantitative trading and analysis.
Unveiling Hidden Market Cycles:
Market cycles are prevalent in financial markets and arise from various factors, such as economic conditions, investor psychology, and market participant behavior. The Goertzel algorithm's ability to detect and isolate specific frequencies in price data helps trader analysts identify hidden market cycles that may otherwise go unnoticed. By examining the amplitude, phase, and periodicity of each cycle, traders can better understand the underlying market structure and dynamics, enabling them to develop more informed and effective trading strategies.
Developing Quantitative Trading Strategies:
The Goertzel algorithm's versatility allows traders to incorporate its insights into a wide range of trading strategies. By identifying the dominant market cycles in a financial instrument's price data, traders can create data-driven strategies that capitalize on the cyclical nature of markets.
For instance, a trader may develop a mean-reversion strategy that takes advantage of the identified cycles. By establishing positions when the price deviates from the predicted cycle, the trader can profit from the subsequent reversion to the cycle's mean. Similarly, a momentum-based strategy could be designed to exploit the persistence of a dominant cycle by entering positions that align with the cycle's direction.
Enhancing Risk Management:
The Goertzel algorithm plays a vital role in risk management for quantitative strategies. By analyzing the cyclical components of a financial instrument's price data, traders can gain insights into the potential risks associated with their trading strategies.
By monitoring the amplitude and phase of dominant cycles, a trader can detect changes in market dynamics that may pose risks to their positions. For example, a sudden increase in amplitude may indicate heightened volatility, prompting the trader to adjust position sizing or employ hedging techniques to protect their portfolio. Additionally, changes in phase alignment could signal a potential shift in market sentiment, necessitating adjustments to the trading strategy.
Expanding Quantitative Toolkits:
Traders can augment the Goertzel algorithm's insights by combining it with other quantitative techniques, creating a more comprehensive and sophisticated analysis framework. For example, machine learning algorithms, such as neural networks or support vector machines, could be trained on features extracted from the Goertzel algorithm to predict future price movements more accurately.
Furthermore, the Goertzel algorithm can be integrated with other technical analysis tools, such as moving averages or oscillators, to enhance their effectiveness. By applying these tools to the identified cycles, traders can generate more robust and reliable trading signals.
The Goertzel algorithm offers invaluable benefits to quantitative finance practitioners by uncovering hidden market cycles, aiding in the development of data-driven trading strategies, and improving risk management. By leveraging the insights provided by the Goertzel algorithm and integrating it with other quantitative techniques, traders can gain a deeper understanding of market dynamics and devise more effective trading strategies.
█ Indicator Inputs
src: This is the source data for the analysis, typically the closing price of the financial instrument.
detrendornot: This input determines the method used for detrending the source data. Detrending is the process of removing the underlying trend from the data to focus on the cyclical components.
The available options are:
hpsmthdt: Detrend using Hodrick-Prescott filter centered moving average.
zlagsmthdt: Detrend using zero-lag moving average centered moving average.
logZlagRegression: Detrend using logarithmic zero-lag linear regression.
hpsmth: Detrend using Hodrick-Prescott filter.
zlagsmth: Detrend using zero-lag moving average.
DT_HPper1 and DT_HPper2: These inputs define the period range for the Hodrick-Prescott filter centered moving average when detrendornot is set to hpsmthdt.
DT_ZLper1 and DT_ZLper2: These inputs define the period range for the zero-lag moving average centered moving average when detrendornot is set to zlagsmthdt.
DT_RegZLsmoothPer: This input defines the period for the zero-lag moving average used in logarithmic zero-lag linear regression when detrendornot is set to logZlagRegression.
HPsmoothPer: This input defines the period for the Hodrick-Prescott filter when detrendornot is set to hpsmth.
ZLMAsmoothPer: This input defines the period for the zero-lag moving average when detrendornot is set to zlagsmth.
MaxPer: This input sets the maximum period for the Goertzel algorithm to search for cycles.
squaredAmp: This boolean input determines whether the amplitude should be squared in the Goertzel algorithm.
useAddition: This boolean input determines whether the Goertzel algorithm should use addition for combining the cycles.
useCosine: This boolean input determines whether the Goertzel algorithm should use cosine waves instead of sine waves.
UseCycleStrength: This boolean input determines whether the Goertzel algorithm should compute the cycle strength, which is a normalized measure of the cycle's amplitude.
WindowSizePast and WindowSizeFuture: These inputs define the window size for past and future projections of the composite wave.
FilterBartels: This boolean input determines whether Bartel's test should be applied to filter out non-significant cycles.
BartNoCycles: This input sets the number of cycles to be used in Bartel's test.
BartSmoothPer: This input sets the period for the moving average used in Bartel's test.
BartSigLimit: This input sets the significance limit for Bartel's test, below which cycles are considered insignificant.
SortBartels: This boolean input determines whether the cycles should be sorted by their Bartel's test results.
UseCycleList: This boolean input determines whether a user-defined list of cycles should be used for constructing the composite wave. If set to false, the top N cycles will be used.
Cycle1, Cycle2, Cycle3, Cycle4, and Cycle5: These inputs define the user-defined list of cycles when 'UseCycleList' is set to true. If using a user-defined list, each of these inputs represents the period of a specific cycle to include in the composite wave.
StartAtCycle: This input determines the starting index for selecting the top N cycles when UseCycleList is set to false. This allows you to skip a certain number of cycles from the top before selecting the desired number of cycles.
UseTopCycles: This input sets the number of top cycles to use for constructing the composite wave when UseCycleList is set to false. The cycles are ranked based on their amplitudes or cycle strengths, depending on the UseCycleStrength input.
SubtractNoise: This boolean input determines whether to subtract the noise (remaining cycles) from the composite wave. If set to true, the composite wave will only include the top N cycles specified by UseTopCycles.
█ Exploring Auxiliary Functions
The following functions demonstrate advanced techniques for analyzing financial markets, including zero-lag moving averages, Bartels probability, detrending, and Hodrick-Prescott filtering. This section examines each function in detail, explaining their purpose, methodology, and applications in finance. We will examine how each function contributes to the overall performance and effectiveness of the indicator and how they work together to create a powerful analytical tool.
Zero-Lag Moving Average:
The zero-lag moving average function is designed to minimize the lag typically associated with moving averages. This is achieved through a two-step weighted linear regression process that emphasizes more recent data points. The function calculates a linearly weighted moving average (LWMA) on the input data and then applies another LWMA on the result. By doing this, the function creates a moving average that closely follows the price action, reducing the lag and improving the responsiveness of the indicator.
The zero-lag moving average function is used in the indicator to provide a responsive, low-lag smoothing of the input data. This function helps reduce the noise and fluctuations in the data, making it easier to identify and analyze underlying trends and patterns. By minimizing the lag associated with traditional moving averages, this function allows the indicator to react more quickly to changes in market conditions, providing timely signals and improving the overall effectiveness of the indicator.
Bartels Probability:
The Bartels probability function calculates the probability of a given cycle being significant in a time series. It uses a mathematical test called the Bartels test to assess the significance of cycles detected in the data. The function calculates coefficients for each detected cycle and computes an average amplitude and an expected amplitude. By comparing these values, the Bartels probability is derived, indicating the likelihood of a cycle's significance. This information can help in identifying and analyzing dominant cycles in financial markets.
The Bartels probability function is incorporated into the indicator to assess the significance of detected cycles in the input data. By calculating the Bartels probability for each cycle, the indicator can prioritize the most significant cycles and focus on the market dynamics that are most relevant to the current trading environment. This function enhances the indicator's ability to identify dominant market cycles, improving its predictive power and aiding in the development of effective trading strategies.
Detrend Logarithmic Zero-Lag Regression:
The detrend logarithmic zero-lag regression function is used for detrending data while minimizing lag. It combines a zero-lag moving average with a linear regression detrending method. The function first calculates the zero-lag moving average of the logarithm of input data and then applies a linear regression to remove the trend. By detrending the data, the function isolates the cyclical components, making it easier to analyze and interpret the underlying market dynamics.
The detrend logarithmic zero-lag regression function is used in the indicator to isolate the cyclical components of the input data. By detrending the data, the function enables the indicator to focus on the cyclical movements in the market, making it easier to analyze and interpret market dynamics. This function is essential for identifying cyclical patterns and understanding the interactions between different market cycles, which can inform trading decisions and enhance overall market understanding.
Bartels Cycle Significance Test:
The Bartels cycle significance test is a function that combines the Bartels probability function and the detrend logarithmic zero-lag regression function to assess the significance of detected cycles. The function calculates the Bartels probability for each cycle and stores the results in an array. By analyzing the probability values, traders and analysts can identify the most significant cycles in the data, which can be used to develop trading strategies and improve market understanding.
The Bartels cycle significance test function is integrated into the indicator to provide a comprehensive analysis of the significance of detected cycles. By combining the Bartels probability function and the detrend logarithmic zero-lag regression function, this test evaluates the significance of each cycle and stores the results in an array. The indicator can then use this information to prioritize the most significant cycles and focus on the most relevant market dynamics. This function enhances the indicator's ability to identify and analyze dominant market cycles, providing valuable insights for trading and market analysis.
Hodrick-Prescott Filter:
The Hodrick-Prescott filter is a popular technique used to separate the trend and cyclical components of a time series. The function applies a smoothing parameter to the input data and calculates a smoothed series using a two-sided filter. This smoothed series represents the trend component, which can be subtracted from the original data to obtain the cyclical component. The Hodrick-Prescott filter is commonly used in economics and finance to analyze economic data and financial market trends.
The Hodrick-Prescott filter is incorporated into the indicator to separate the trend and cyclical components of the input data. By applying the filter to the data, the indicator can isolate the trend component, which can be used to analyze long-term market trends and inform trading decisions. Additionally, the cyclical component can be used to identify shorter-term market dynamics and provide insights into potential trading opportunities. The inclusion of the Hodrick-Prescott filter adds another layer of analysis to the indicator, making it more versatile and comprehensive.
Detrending Options: Detrend Centered Moving Average:
The detrend centered moving average function provides different detrending methods, including the Hodrick-Prescott filter and the zero-lag moving average, based on the selected detrending method. The function calculates two sets of smoothed values using the chosen method and subtracts one set from the other to obtain a detrended series. By offering multiple detrending options, this function allows traders and analysts to select the most appropriate method for their specific needs and preferences.
The detrend centered moving average function is integrated into the indicator to provide users with multiple detrending options, including the Hodrick-Prescott filter and the zero-lag moving average. By offering multiple detrending methods, the indicator allows users to customize the analysis to their specific needs and preferences, enhancing the indicator's overall utility and adaptability. This function ensures that the indicator can cater to a wide range of trading styles and objectives, making it a valuable tool for a diverse group of market participants.
The auxiliary functions functions discussed in this section demonstrate the power and versatility of mathematical techniques in analyzing financial markets. By understanding and implementing these functions, traders and analysts can gain valuable insights into market dynamics, improve their trading strategies, and make more informed decisions. The combination of zero-lag moving averages, Bartels probability, detrending methods, and the Hodrick-Prescott filter provides a comprehensive toolkit for analyzing and interpreting financial data. The integration of advanced functions in a financial indicator creates a powerful and versatile analytical tool that can provide valuable insights into financial markets. By combining the zero-lag moving average,
█ In-Depth Analysis of the Goertzel Browser Code
The Goertzel Browser code is an implementation of the Goertzel Algorithm, an efficient technique to perform spectral analysis on a signal. The code is designed to detect and analyze dominant cycles within a given financial market data set. This section will provide an extremely detailed explanation of the code, its structure, functions, and intended purpose.
Function signature and input parameters:
The Goertzel Browser function accepts numerous input parameters for customization, including source data (src), the current bar (forBar), sample size (samplesize), period (per), squared amplitude flag (squaredAmp), addition flag (useAddition), cosine flag (useCosine), cycle strength flag (UseCycleStrength), past and future window sizes (WindowSizePast, WindowSizeFuture), Bartels filter flag (FilterBartels), Bartels-related parameters (BartNoCycles, BartSmoothPer, BartSigLimit), sorting flag (SortBartels), and output buffers (goeWorkPast, goeWorkFuture, cyclebuffer, amplitudebuffer, phasebuffer, cycleBartelsBuffer).
Initializing variables and arrays:
The code initializes several float arrays (goeWork1, goeWork2, goeWork3, goeWork4) with the same length as twice the period (2 * per). These arrays store intermediate results during the execution of the algorithm.
Preprocessing input data:
The input data (src) undergoes preprocessing to remove linear trends. This step enhances the algorithm's ability to focus on cyclical components in the data. The linear trend is calculated by finding the slope between the first and last values of the input data within the sample.
Iterative calculation of Goertzel coefficients:
The core of the Goertzel Browser algorithm lies in the iterative calculation of Goertzel coefficients for each frequency bin. These coefficients represent the spectral content of the input data at different frequencies. The code iterates through the range of frequencies, calculating the Goertzel coefficients using a nested loop structure.
Cycle strength computation:
The code calculates the cycle strength based on the Goertzel coefficients. This is an optional step, controlled by the UseCycleStrength flag. The cycle strength provides information on the relative influence of each cycle on the data per bar, considering both amplitude and cycle length. The algorithm computes the cycle strength either by squaring the amplitude (controlled by squaredAmp flag) or using the actual amplitude values.
Phase calculation:
The Goertzel Browser code computes the phase of each cycle, which represents the position of the cycle within the input data. The phase is calculated using the arctangent function (math.atan) based on the ratio of the imaginary and real components of the Goertzel coefficients.
Peak detection and cycle extraction:
The algorithm performs peak detection on the computed amplitudes or cycle strengths to identify dominant cycles. It stores the detected cycles in the cyclebuffer array, along with their corresponding amplitudes and phases in the amplitudebuffer and phasebuffer arrays, respectively.
Sorting cycles by amplitude or cycle strength:
The code sorts the detected cycles based on their amplitude or cycle strength in descending order. This allows the algorithm to prioritize cycles with the most significant impact on the input data.
Bartels cycle significance test:
If the FilterBartels flag is set, the code performs a Bartels cycle significance test on the detected cycles. This test determines the statistical significance of each cycle and filters out the insignificant cycles. The significant cycles are stored in the cycleBartelsBuffer array. If the SortBartels flag is set, the code sorts the significant cycles based on their Bartels significance values.
Waveform calculation:
The Goertzel Browser code calculates the waveform of the significant cycles for both past and future time windows. The past and future windows are defined by the WindowSizePast and WindowSizeFuture parameters, respectively. The algorithm uses either cosine or sine functions (controlled by the useCosine flag) to calculate the waveforms for each cycle. The useAddition flag determines whether the waveforms should be added or subtracted.
Storing waveforms in matrices:
The calculated waveforms for each cycle are stored in two matrices - goeWorkPast and goeWorkFuture. These matrices hold the waveforms for the past and future time windows, respectively. Each row in the matrices represents a time window position, and each column corresponds to a cycle.
Returning the number of cycles:
The Goertzel Browser function returns the total number of detected cycles (number_of_cycles) after processing the input data. This information can be used to further analyze the results or to visualize the detected cycles.
The Goertzel Browser code is a comprehensive implementation of the Goertzel Algorithm, specifically designed for detecting and analyzing dominant cycles within financial market data. The code offers a high level of customization, allowing users to fine-tune the algorithm based on their specific needs. The Goertzel Browser's combination of preprocessing, iterative calculations, cycle extraction, sorting, significance testing, and waveform calculation makes it a powerful tool for understanding cyclical components in financial data.
█ Generating and Visualizing Composite Waveform
The indicator calculates and visualizes the composite waveform for both past and future time windows based on the detected cycles. Here's a detailed explanation of this process:
Updating WindowSizePast and WindowSizeFuture:
The WindowSizePast and WindowSizeFuture are updated to ensure they are at least twice the MaxPer (maximum period).
Initializing matrices and arrays:
Two matrices, goeWorkPast and goeWorkFuture, are initialized to store the Goertzel results for past and future time windows. Multiple arrays are also initialized to store cycle, amplitude, phase, and Bartels information.
Preparing the source data (srcVal) array:
The source data is copied into an array, srcVal, and detrended using one of the selected methods (hpsmthdt, zlagsmthdt, logZlagRegression, hpsmth, or zlagsmth).
Goertzel function call:
The Goertzel function is called to analyze the detrended source data and extract cycle information. The output, number_of_cycles, contains the number of detected cycles.
Initializing arrays for past and future waveforms:
Three arrays, epgoertzel, goertzel, and goertzelFuture, are initialized to store the endpoint Goertzel, non-endpoint Goertzel, and future Goertzel projections, respectively.
Calculating composite waveform for past bars (goertzel array):
The past composite waveform is calculated by summing the selected cycles (either from the user-defined cycle list or the top cycles) and optionally subtracting the noise component.
Calculating composite waveform for future bars (goertzelFuture array):
The future composite waveform is calculated in a similar way as the past composite waveform.
Drawing past composite waveform (pvlines):
The past composite waveform is drawn on the chart using solid lines. The color of the lines is determined by the direction of the waveform (green for upward, red for downward).
Drawing future composite waveform (fvlines):
The future composite waveform is drawn on the chart using dotted lines. The color of the lines is determined by the direction of the waveform (fuchsia for upward, yellow for downward).
Displaying cycle information in a table (table3):
A table is created to display the cycle information, including the rank, period, Bartel value, amplitude (or cycle strength), and phase of each detected cycle.
Filling the table with cycle information:
The indicator iterates through the detected cycles and retrieves the relevant information (period, amplitude, phase, and Bartel value) from the corresponding arrays. It then fills the table with this information, displaying the values up to six decimal places.
To summarize, this indicator generates a composite waveform based on the detected cycles in the financial data. It calculates the composite waveforms for both past and future time windows and visualizes them on the chart using colored lines. Additionally, it displays detailed cycle information in a table, including the rank, period, Bartel value, amplitude (or cycle strength), and phase of each detected cycle.
█ Enhancing the Goertzel Algorithm-Based Script for Financial Modeling and Trading
The Goertzel algorithm-based script for detecting dominant cycles in financial data is a powerful tool for financial modeling and trading. It provides valuable insights into the past behavior of these cycles and potential future impact. However, as with any algorithm, there is always room for improvement. This section discusses potential enhancements to the existing script to make it even more robust and versatile for financial modeling, general trading, advanced trading, and high-frequency finance trading.
Enhancements for Financial Modeling
Data preprocessing: One way to improve the script's performance for financial modeling is to introduce more advanced data preprocessing techniques. This could include removing outliers, handling missing data, and normalizing the data to ensure consistent and accurate results.
Additional detrending and smoothing methods: Incorporating more sophisticated detrending and smoothing techniques, such as wavelet transform or empirical mode decomposition, can help improve the script's ability to accurately identify cycles and trends in the data.
Machine learning integration: Integrating machine learning techniques, such as artificial neural networks or support vector machines, can help enhance the script's predictive capabilities, leading to more accurate financial models.
Enhancements for General and Advanced Trading
Customizable indicator integration: Allowing users to integrate their own technical indicators can help improve the script's effectiveness for both general and advanced trading. By enabling the combination of the dominant cycle information with other technical analysis tools, traders can develop more comprehensive trading strategies.
Risk management and position sizing: Incorporating risk management and position sizing functionality into the script can help traders better manage their trades and control potential losses. This can be achieved by calculating the optimal position size based on the user's risk tolerance and account size.
Multi-timeframe analysis: Enhancing the script to perform multi-timeframe analysis can provide traders with a more holistic view of market trends and cycles. By identifying dominant cycles on different timeframes, traders can gain insights into the potential confluence of cycles and make better-informed trading decisions.
Enhancements for High-Frequency Finance Trading
Algorithm optimization: To ensure the script's suitability for high-frequency finance trading, optimizing the algorithm for faster execution is crucial. This can be achieved by employing efficient data structures and refining the calculation methods to minimize computational complexity.
Real-time data streaming: Integrating real-time data streaming capabilities into the script can help high-frequency traders react to market changes more quickly. By continuously updating the cycle information based on real-time market data, traders can adapt their strategies accordingly and capitalize on short-term market fluctuations.
Order execution and trade management: To fully leverage the script's capabilities for high-frequency trading, implementing functionality for automated order execution and trade management is essential. This can include features such as stop-loss and take-profit orders, trailing stops, and automated trade exit strategies.
While the existing Goertzel algorithm-based script is a valuable tool for detecting dominant cycles in financial data, there are several potential enhancements that can make it even more powerful for financial modeling, general trading, advanced trading, and high-frequency finance trading. By incorporating these improvements, the script can become a more versatile and effective tool for traders and financial analysts alike.
█ Understanding the Limitations of the Goertzel Algorithm
While the Goertzel algorithm-based script for detecting dominant cycles in financial data provides valuable insights, it is important to be aware of its limitations and drawbacks. Some of the key drawbacks of this indicator are:
Lagging nature:
As with many other technical indicators, the Goertzel algorithm-based script can suffer from lagging effects, meaning that it may not immediately react to real-time market changes. This lag can lead to late entries and exits, potentially resulting in reduced profitability or increased losses.
Parameter sensitivity:
The performance of the script can be sensitive to the chosen parameters, such as the detrending methods, smoothing techniques, and cycle detection settings. Improper parameter selection may lead to inaccurate cycle detection or increased false signals, which can negatively impact trading performance.
Complexity:
The Goertzel algorithm itself is relatively complex, making it difficult for novice traders or those unfamiliar with the concept of cycle analysis to fully understand and effectively utilize the script. This complexity can also make it challenging to optimize the script for specific trading styles or market conditions.
Overfitting risk:
As with any data-driven approach, there is a risk of overfitting when using the Goertzel algorithm-based script. Overfitting occurs when a model becomes too specific to the historical data it was trained on, leading to poor performance on new, unseen data. This can result in misleading signals and reduced trading performance.
No guarantee of future performance: While the script can provide insights into past cycles and potential future trends, it is important to remember that past performance does not guarantee future results. Market conditions can change, and relying solely on the script's predictions without considering other factors may lead to poor trading decisions.
Limited applicability: The Goertzel algorithm-based script may not be suitable for all markets, trading styles, or timeframes. Its effectiveness in detecting cycles may be limited in certain market conditions, such as during periods of extreme volatility or low liquidity.
While the Goertzel algorithm-based script offers valuable insights into dominant cycles in financial data, it is essential to consider its drawbacks and limitations when incorporating it into a trading strategy. Traders should always use the script in conjunction with other technical and fundamental analysis tools, as well as proper risk management, to make well-informed trading decisions.
█ Interpreting Results
The Goertzel Browser indicator can be interpreted by analyzing the plotted lines and the table presented alongside them. The indicator plots two lines: past and future composite waves. The past composite wave represents the composite wave of the past price data, and the future composite wave represents the projected composite wave for the next period.
The past composite wave line displays a solid line, with green indicating a bullish trend and red indicating a bearish trend. On the other hand, the future composite wave line is a dotted line with fuchsia indicating a bullish trend and yellow indicating a bearish trend.
The table presented alongside the indicator shows the top cycles with their corresponding rank, period, Bartels, amplitude or cycle strength, and phase. The amplitude is a measure of the strength of the cycle, while the phase is the position of the cycle within the data series.
Interpreting the Goertzel Browser indicator involves identifying the trend of the past and future composite wave lines and matching them with the corresponding bullish or bearish color. Additionally, traders can identify the top cycles with the highest amplitude or cycle strength and utilize them in conjunction with other technical indicators and fundamental analysis for trading decisions.
This indicator is considered a repainting indicator because the value of the indicator is calculated based on the past price data. As new price data becomes available, the indicator's value is recalculated, potentially causing the indicator's past values to change. This can create a false impression of the indicator's performance, as it may appear to have provided a profitable trading signal in the past when, in fact, that signal did not exist at the time.
The Goertzel indicator is also non-endpointed, meaning that it is not calculated up to the current bar or candle. Instead, it uses a fixed amount of historical data to calculate its values, which can make it difficult to use for real-time trading decisions. For example, if the indicator uses 100 bars of historical data to make its calculations, it cannot provide a signal until the current bar has closed and become part of the historical data. This can result in missed trading opportunities or delayed signals.
█ Conclusion
The Goertzel Browser indicator is a powerful tool for identifying and analyzing cyclical patterns in financial markets. Its ability to detect multiple cycles of varying frequencies and strengths make it a valuable addition to any trader's technical analysis toolkit. However, it is important to keep in mind that the Goertzel Browser indicator should be used in conjunction with other technical analysis tools and fundamental analysis to achieve the best results. With continued refinement and development, the Goertzel Browser indicator has the potential to become a highly effective tool for financial modeling, general trading, advanced trading, and high-frequency finance trading. Its accuracy and versatility make it a promising candidate for further research and development.
█ Footnotes
What is the Bartels Test for Cycle Significance?
The Bartels Cycle Significance Test is a statistical method that determines whether the peaks and troughs of a time series are statistically significant. The test is named after its inventor, George Bartels, who developed it in the mid-20th century.
The Bartels test is designed to analyze the cyclical components of a time series, which can help traders and analysts identify trends and cycles in financial markets. The test calculates a Bartels statistic, which measures the degree of non-randomness or autocorrelation in the time series.
The Bartels statistic is calculated by first splitting the time series into two halves and calculating the range of the peaks and troughs in each half. The test then compares these ranges using a t-test, which measures the significance of the difference between the two ranges.
If the Bartels statistic is greater than a critical value, it indicates that the peaks and troughs in the time series are non-random and that there is a significant cyclical component to the data. Conversely, if the Bartels statistic is less than the critical value, it suggests that the peaks and troughs are random and that there is no significant cyclical component.
The Bartels Cycle Significance Test is particularly useful in financial analysis because it can help traders and analysts identify significant cycles in asset prices, which can in turn inform investment decisions. However, it is important to note that the test is not perfect and can produce false signals in certain situations, particularly in noisy or volatile markets. Therefore, it is always recommended to use the test in conjunction with other technical and fundamental indicators to confirm trends and cycles.
Deep-dive into the Hodrick-Prescott Fitler
The Hodrick-Prescott (HP) filter is a statistical tool used in economics and finance to separate a time series into two components: a trend component and a cyclical component. It is a powerful tool for identifying long-term trends in economic and financial data and is widely used by economists, central banks, and financial institutions around the world.
The HP filter was first introduced in the 1990s by economists Robert Hodrick and Edward Prescott. It is a simple, two-parameter filter that separates a time series into a trend component and a cyclical component. The trend component represents the long-term behavior of the data, while the cyclical component captures the shorter-term fluctuations around the trend.
The HP filter works by minimizing the following objective function:
Minimize: (Sum of Squared Deviations) + λ (Sum of Squared Second Differences)
Where:
The first term represents the deviation of the data from the trend.
The second term represents the smoothness of the trend.
λ is a smoothing parameter that determines the degree of smoothness of the trend.
The smoothing parameter λ is typically set to a value between 100 and 1600, depending on the frequency of the data. Higher values of λ lead to a smoother trend, while lower values lead to a more volatile trend.
The HP filter has several advantages over other smoothing techniques. It is a non-parametric method, meaning that it does not make any assumptions about the underlying distribution of the data. It also allows for easy comparison of trends across different time series and can be used with data of any frequency.
However, the HP filter also has some limitations. It assumes that the trend is a smooth function, which may not be the case in some situations. It can also be sensitive to changes in the smoothing parameter λ, which may result in different trends for the same data. Additionally, the filter may produce unrealistic trends for very short time series.
Despite these limitations, the HP filter remains a valuable tool for analyzing economic and financial data. It is widely used by central banks and financial institutions to monitor long-term trends in the economy, and it can be used to identify turning points in the business cycle. The filter can also be used to analyze asset prices, exchange rates, and other financial variables.
The Hodrick-Prescott filter is a powerful tool for analyzing economic and financial data. It separates a time series into a trend component and a cyclical component, allowing for easy identification of long-term trends and turning points in the business cycle. While it has some limitations, it remains a valuable tool for economists, central banks, and financial institutions around the world.
Volume Divergence IndicatorThe Volume Divergence Indicator is a powerful tool that can help traders identify potential price reversals in the market by analyzing volume data. The indicator has several features, including divergences signals, volume spikes, volume contractions, and volume trend signals.
Unlike most divergence indicators, this one is focused on providing non-repainting alerts. That is why I chose not to use pivot points.
The Volume Divergence Indicator can be used as an overlay or a non-overlay. The overlay mode displays the indicator on top of the price chart, while the non-overlay mode displays the indicator below the price chart.
The indicator has five alerts that can be used to generate alerts:
Bullish Divergence : This alert is generated when prices are making lower lows, but volume is making higher lows. This suggests that the selling pressure is weakening, and a bullish reversal may be imminent.
Bearish Divergence : This alert is generated when prices are making higher highs, but volume is making lower highs. This suggests that the buying pressure is weakening, and a bearish reversal may be imminent.
Volume Spike : This alert is generated when volume spikes above a certain threshold, such as two standard deviations above the moving average. This suggests that there is unusual buying or selling activity in the market, and traders may want to pay attention to the price movements that follow.
Volume Contraction : This alert is generated when volume contracts to a certain level, such as two standard deviations below the moving average. This suggests that there is little buying or selling activity in the market, and traders may want to be cautious until volume picks up again.
Volume Trend : This alert is generated when volume trends above or below the moving average for a certain number of periods, such as five or ten. This suggests that there is a sustained increase or decrease in buying or selling pressure, and traders may want to adjust their trading strategy accordingly.
To customize the indicator settings, users can adjust the following inputs:
Choose overlay mode: select either Overlay or Non-Overlay
Price and volume lookback: set the number of bars to look back for price and volume data
Bull and bear sensitivity: adjust the sensitivity of the bullish and bearish divergences
Volume MA length: set the length of the moving average used to calculate volume spikes and contractions
Sensitivity of spikes: adjust the sensitivity of the volume spikes
Sensitivity of contractions: adjust the sensitivity of the volume contractions
Trend sensitivity: set the number of periods to identify the volume trend
The Volume Divergence Indicator can be a valuable addition to any trader's toolkit. It can help traders identify potential price reversals in the market, as well as unusual buying or selling activity.
I am open to suggestions for further updates or additions.
Scenario Close Price [Skiploss]You have opened multiple positions in your account ? This is what will help you calculate. It will definitely calculate the total lots size that you have opened. Furthermore, it will also calculate the results of how much profit or loss you have made. All you have to do is slide the line to the scenario line.
The system will calculate the data for each order that you have entered and display the results in the table in the top right of the screen.
Maximum is 7 positions.
DOTS [CHE]This indicator is a must-have for every trader as it provides a practical tool to quickly evaluate the current price of a security. Designed specifically for manual trading, this indicator is based on "The Forbidden RSI " indicator and provides an easy way to identify overbought and oversold conditions in the market. By using this indicator, traders can make informed decisions about when to enter or exit a trade, maximizing their potential profits and minimizing their risks. Its simple yet effective design makes it an ideal choice for traders of all experience levels. Whether you are a seasoned professional or just starting out, this indicator can help you take your trading to the next level.
Description:
This is a Pine Script code designed to create an indicator that identifies overbought and oversold conditions in a security. The code first defines a function named "func" that takes three arguments - "close", "length", and "tr". It then calculates a value "k" based on the "close" and "length" arguments using this function.
The code then checks if "k" is greater than a variable named "OverBought" and assigns the resulting Boolean value to "OverboughtCond". It also checks if "k" is less than a variable named "OverSold" and assigns the resulting Boolean value to "OversoldCond".
The code then plots a small circle above the bar if "OverboughtCond" is true and below the bar if "OversoldCond" is true. The circles are colored green for "Overbought" and red for "Oversold". The code also creates a label with the name "Overbought" above the bar and a label with the name "Oversold" below the bar if the respective conditions are met.
Finally, the code sets up alert conditions for both the "Overbought" and "Oversold" cases, with a custom message that includes the name of the security, the current price, and the indicator's name.
I've tested the script for weeks and I hope it brings you as much success as it did me
best regards
Chervolino
Trend forecasting by c00l75----------- ITALIANO -----------
Questo codice è uno script di previsione del trend creato solo a scopo didattico. Utilizza una media mobile esponenziale (EMA) e una media mobile di Hull (HMA) per calcolare il trend attuale e prevedere il trend futuro. Il codice utilizza anche una regressione lineare per calcolare il trend attuale e un fattore di smorzamento per regolare l’effetto della regressione lineare sulla previsione del trend. Infine il codice disegna due linee tratteggiate per mostrare la previsione del trend per i periodi futuri specificati dall’utente. Se ti piace l'idea mettimi un boost e lascia un commento!
----------- ENGLISH -----------
This code is a trend forecasting script created for educational purposes only. It uses an exponential moving average (EMA) and a Hull moving average (HMA) to calculate the current trend and forecast the future trend. The code also uses a linear regression to calculate the current trend and a damping factor to adjust the effect of the linear regression on the trend prediction. Finally, the code draws two dashed lines to show the trend prediction for future periods specified by the user. If you like the idea please put a boost and leave a comment!
Volume Forecasting [LuxAlgo]The Volume Forecasting indicator provides a forecast of volume by capturing and extrapolating periodic fluctuations. Historical forecasts are also provided to compare the method against volume at time t .
This script will not work on tickers that do not have volume data.
🔶 SETTINGS
Median Memory: Number of days used to compute the median and first/third quartiles.
Forecast Window: Number of bars forecasted in the future.
Auto Forecast Window: Set the forecast window so that the forecast length completes an interval.
🔶 USAGE
The periodic nature of volume on certain securities allows users to more easily forecast using historical volume. The forecast can highlight intervals where volume tends to be more important, that is where most trading activity takes place.
More pronounced periodicity will tend to return more accurate forecasts.
The historical forecast can also highlight intervals where high/low volume is not expected.
The interquartile range is also highlighted, giving an area where we can expect the volume to lie.
🔶 DETAILS
This forecasting method is similar to the time series decomposition method used to obtain the seasonal component.
We first segment the chart over equidistant intervals. Each interval is delimited by a change in the daily timeframe.
To forecast volume at time t+1 we see where the current bar lies in the interval, if the bar is the 78th in interval then the forecast on the next bar is made by taking the median of the 79th bar over N intervals, where N is the median memory.
This method ensures capturing the periodic fluctuation of volume.
Stock Comparison to S&P 500This indicator, "Stock Comparison to S&P 500," is designed to help traders compare the financial health and valuation of a chosen stock to the S&P 500 index. It compares several key financial metrics of the stock to the corresponding metrics of the S&P 500, including earnings growth, price-to-earnings ratio, price-to-book ratio, and price-to-sales ratio.
The indicator calculates the differences between each metric of the selected stock and the S&P 500, and then weights them using a formula that takes into account the importance of each metric. The resulting value represents the overall comparison between the stock and the S&P 500.
The indicator also displays the differences between the individual metrics in separate plots, allowing traders to see how each metric contributes to the overall comparison. Additionally, it colors the plots green if the selected stock is performing better than the S&P 500 in a particular metric and red if it's performing worse.
Traders can use this indicator to gain insight into the relative financial health and valuation of a selected stock compared to the S&P 500 index, which can help inform their trading decisions.
BTCUSD Price prediction based on central bank liquidityIn recent months the idea that Bitcoin prices are increasingly linked to liquidity provided by central banks has gained strength. Multiple opinion leaders in the bitcoin space have shared their thoughts to explain why this is happening and why it makes sense. Some of these people I'm talking about are Preston Pysh, Dr. Jeff Ross, Steven McClurg, Lynn Alden among others.
The reality is that the correlation between market liquidity, measured as Assets held by the Federal Reserve, Bank of Japan and European Central bank, and Bitcoin prices is high. This made me wonder whether a regression between "market liquidity" and BTCUSD prices made sense in order to understand where Bitcoin prices are in relation to the liquidity in the market. After several trials I ended up fitting a polynomial regression of degree 5 between Market Liquidity and BTCUSD prices since 2013. This regression resulted in r-squared value of 90.93%. I initially visualized the results in python notebooks but then I thought it would be cool to be able to see them in real-time in tradingview.
That's where this script comes handy...
This script takes the coefficients and intercept from the polynomial regression I built and applies them to the "market_liquidity" index. In addition, it adds upper and lower bound lines to the prediction based on a 95% confidence interval. As you will see, particularly since 2020, the price of bitcoin has rarely been above or below the lines representing the 95% confidence interval. When price has actually crossed these lines it's been in moments where Bitcoin was highly overbought or oversold. Therefore this indicator could be used to understand when it's a good moment to enter or exit the market based on central bank fundamentals.
Here's the detailed step-by-step description of what the script does
1) It defines the coefficients obtained from running the regression betweeen "market liquidity" and BTCUSD. Market liquidity is defined as:
Market liquidity = FRED:WALCL + FX_IDX:JPYUSD*FRED:JPNASSETS + FX:EURUSD*FRED:ECBASSETSW - FRED:RRPONTSYD - FRED:WTREGEN
2) It defines a scale factor. The reason for this is that coefficients from the regression are very small numbers, given the huge numbers of the value of assets held by central banks. Pinescript doesn't support numbers with many decimals and rounds them to 0, so the coefficients had to be scaled up in order to be able to calculate the regression results.
3) It calculates market liquity with the formula defined above. Market liquidity is calculated in US Dollars.
4) It calculates the predicted BTCUSD price based on the coefficients and the market liquidity values.
5) It scales down the values by the same factor used to scale the coefficients up
6) It defines the standard deviation of the "potential_btcusd_price_scaled" and the actual BTCUSD prices.
7) It defines upper and lower bounds to the BTCUSD price prediction using a z-score of 1.96, which is equivalent to 95% confidence interval.
8) Lastly it plots the BTCUSD price prediction (orange) and the upper (red) and lower(green) confidence intervals.
The script can be updated as the correlation of BTCUSD to central bank assets changes (the slope values can be updated).
How to use it:
When actual BTCUSD price (blue line in the chart) crosses over the red line (upper bound) or crosses under the green line (lower bound) it should be taken as a sign that the price of BTCUSD may be overvalued or undervalued based on the value of assets held by major central banks.
YoY or MoM ReturnsThis script is a technical indicator that calculates the year-over-year (YoY) or month-over-month (MoM) returns of a security.
The returns are then plotted on a chart, with positive returns colored in green and negative returns colored in red.
Momentum Covariance Oscillator by TenozenWell, guess what? A new indicator is here! Again it's a coincidence, as I experiment with my formula. So far it's less noisy than Autoregressive Covariance Oscillator, so possibly this one is better. The formula is much simpler, care me to explain.
___________________________________________________________________________________________________
Yt = close - previous average
Val = Yt/close
___________________________________________________________________________________________________
Welp that's the formula lol. Funny thing is that it's so simple, but it's good! What matters is the use of it haha.
So how to use this Oscillator? If the value is above 0, we expect a bullish response, if the value is below 0 we expect a bearish response. That simple. Ciao.
(Any questions and suggestions? feel free to comment!)
X48 - Indicator | Midnight Hunter | V.1Thanks For Ogirinal Source Script From mladen for Engulfing Script and @KP_House, @JusInNovel, @jdehorty for Dashboard
and Indicator Original From X4815162342 MA TYPE Cross Edit For Forex Engulfing and HH LL Trading Style
Let's Me Explain About This Indicator
LightGreen Diamond "3Engulfing" is Bullish Confrim Engulfing 3 Candle
LightRed Diamond "3Engulfing" is Bearish Confrim Engulfing 3 Candle
Yellow ArrowUp is Normal Bullish Engulfing Candle
White ArrowDown is Normal Bearish Engulfing Candle
UpperBandLine, MiddleBandLine, LowerBandLine is Range Of Swing Price
Little Green Triangle is Signal To Buy
Little Red Triangle is Signal To Sell
How To Use Indicator For Trading
1. Confrim Signal Step
1.1) Bullish Trend
1.1.1) If Close Price < LowerBandLine
1.1.2) Must Have LightGreen Diamond "3Engulfing"
1.1.3) Direction Of BandLine are Up like this (↗)
1.1.4) Have a Cluster of Green Triangle
1.1.5) Sto Background Color is Green
**1.1.6) It's Good If Have a Yellow Direction Arrow Up (↗) but If Not Have a Yellow Direction Arrow Up (↗) No Problem
1.2) Bearish Trend
1.2.1) If Close Price > UpperBandLine
1.2.2) Must Have LightRed Diamond "3Engulfing"
1.2.3) Direction Of BandLine are Down like this (↘)
1.2.4) Have a Cluster of Red Triangle
1.1.5) Sto Background Color is Red
**1.2.6) It's Good If Have a White Direction Arrow Down (↘) but If Not Have a White Direction Arrow Down (↘) No Problem
2. Trend Following for Short-Term/Mid-Term
2.1) Bullish Follow
2.1.1) Have a Cluster of Green Triangle
2.1.2) Have a Yellow Direction Arrow Up (↗) >>(or)<< LightGreen Diamond "3Engulfing"
2.2) Bearish Follow
2.2.1) Have a Cluster of Red Triangle
2.2.2) Have a White Direction Arrow Down (↘) >>(or)<< LightRed Diamond "3Engulfing"
3. TP and SL - If You Following Trend or Confirm Signal
3.1) Bullish TP/SL
3.1.1) TakeProfit (TP)
3.1.1.1) Can TP IF Close > MiddleBandLine or CrossingUp (Sometime Not Large But More Time for TP From Intraday)
3.1.1.2) Can TP If Price Candle Breake UpperBandLine and Have a LightGreen Diamond "3Engulfing" or Have a Invert Arrow Direction
3.1.2) StopLoss (SL)
3.1.2.1) Can SL After Your Open Long/Buy Position by SwingLowLine
3.2) Bearish TP/SL
3.2.1) TakeProfit (TP)
3.2.1.1) Can TP If Close < MiddleBandLine or CrossingDown (Sometime Not Large But More Time for TP From Intraday)
3.2.1.2) Can TP If Price Candle Breake LowerBandLine and Have a LightRed Diamond "3Engulfing" or Have a Invert Arrow Direction
3.1.2) StopLoss (SL)
3.1.2.1) Can SL After Your Open Short/Sell Position by SwingHighLine
Acceleration-Based MA Slope PredictionHello traders,
I developed this indicator while working on a trading strategy using moving average slope and acceleration, and I found the concept interesting enough to share it.
Let me briefly explain this indicator.
----About White Plot----
1. Calculate the first derivative approximation at the current point of the Moving Average, and then calculate the second derivative approximation to obtain the 'Acceleration'.
2. Where the acceleration is 0, it signifies a change in the force of the moving average.
3. Therefore, by drawing a parabola based on the acceleration at that time, can depict the parabolic shape of the moving average.
This is represented as a white circle on the indicator.
4. These circles are reset at the next point where the acceleration is 0, indicating a change in the parabolic force.
If the moving average rises more sharply than the predicted value of the rising parabola, a more drastic increase is expected.
5. In this case, you can start risk management around the time the drawn parabola breaks.
(The actual MA is represented by green/red lines)
6. Before the trend changes, i.e., before the direction of the moving average changes, there is a section where the acceleration is 0, and this is represented on the chart as follows.
(The lower indicator shows the acceleration of the corresponding parabola)
----About Red Plot----
1. Calculate the first derivative approximation of the moving average value, the 'slope'.
2. Where the slope is 0, it represents the extreme point of the parabola.
3. Therefore, by using the acceleration at that point as the coefficient of the quadratic function and setting the extreme point as a vertex, we can draw a quadratic function. This is represented as a red circle on the indicator.
(Keep in mind that the actual moving average is not a quadratic function; this is a "forced" quadratic function assuming the parabola is maintained)
4. These circles are reset at the next extreme point where the slope is 0, and a new quadratic function is created.
Based on the formula obtained in the above process, you can predict the future moving average through 'offset'.
5. That is, if the x value at the current point is 'k', you can predict the moving average one candle ahead by substituting (k+1) into the quadratic function.
The predicted value at the past position is shown as a red circle.
6. The smoother the chosen moving average, the fewer extreme points will appear, and the higher the likelihood of the parabola fitting.
For the T3 set as the default value, it shows very high accuracy even when predicting about 20 candles ahead.
On the other hand, rough moving averages like SMA have limited prediction value.
(SMA 60, offset = 10)
--------
The moving average with a very high level of accuracy is JMA (Jurik Moving Average). However, since the code for this moving average is not public, I recommend those interested to check it through my code.
Additionally, I believe the code of this indicator I've uploaded has significant utility.
As an example, you can use the breaking point of the parabola predicted by the acceleration to determine when the force changes again for entries/losses. There are many other possible applications as well.
I look forward to seeing more excellent results from this indicator.
--------
안녕하세요 트레이더여러분.
이 지표는, 제가 이동평균선의 기울기와 가속도를 이용하여 매매를 하기 위한 지표를 개발하다가, 흥미로운 내용이라고 판단하여 만들게 되었습니다.
이 지표에 대해 간단히 설명드리겠습니다.
----하얀색 플롯에 대해----
1. 이동평균선이 진행되는 현재 시점에서 미분의 근사값을 구하고, 다시 한 번 미분의 근사값을 구해서 '가속도'를 얻습니다.
2. 가속도가 0이 되는 곳은, 곧 해당 이동평균선의 힘이 바뀌는 곳을 의미합니다.
3. 따라서, 그 당시 시점 기준으로 포물선을 그려낸다면, 가속도를 이용하여 해당 이동평균선의 포물선을 그려낼 수 있습니다. 이것은 지표의 하얀색점로서 표기됩니다.
4. 이 때, 이러한 점들은 다음의 가속도가 0이 되는 지점, 즉 포물선의 힘이 바뀌는 곳에서 다시 초기화됩니다.
5. 올라가고 있던 포물선에서의 예측치보다 이동평균선이 더 급하게 올라간다면, 더욱 급격한 상승이 예상됩니다. 이 경우, 그려지고있는 포물선이 깨질 때쯤부터 리스크 관리를 시작할 수 있습니다.
(녹색/빨간색의 선으로 실제 MA를 표현했습니다. 거슬리시면 '모습'가셔서 끄셔도 좋습니다. )
6. 추세가 변경되기 전, 즉 이동평균선의 방향이 바뀌기 전에는 가속도가 0이 되는 구간이 존재하고, 그것이 차트 위에 다음과같이 표현됩니다.
(하단의 지표는, 해당 포물선의 가속도을 나타냅니다)
----붉은색 플롯에 대해----
1. 이동평균선 값을 미분 근사값 즉, '기울기'를 구합니다.
2. 기울기가 0이 되는 곳은, 포물선이 극점이 되는 곳을 뜻합니다.
3. 따라서, 해당 시점의 가속도를 2차함수의 계수로 하여, 또한 해당 극점을 하나의 꼭지점으로 설정하여,이차함수를 그려낼 수 있습니다. 이것은 지표의 빨간색점으로서 표현됩니다.
(실제 이동평균선은 2차함수가 아니기에, 포물선이 유지된다는 가정 하에 "억지로"만들어낸 이차함수입니다)
4. 이 때, 이러한 점은 다음 극점이 0이 되는 곳에서 초기화되고 이차함수가 만들어집니다.
5. 위의 과정에서 얻은 식을 바탕으로 'offset'을 통해 미래의 이동평균선을 예측할 수 있습니다.
즉, 현재시점의 x값을 'k'라고 한다면, (k+1)을 이차함수에 대입하여 1캔들 앞의 이동평균선을 예측할 수 있습니다.
해당 예측치가 지나간 자리는, 빨간색점을 통해 보여집니다.
6. 선택한 이동평균선이 스무스할수록 극점은 덜 등장하게되고, 포물선의 위치가 맞아들어갈 가능성이 높습니다.
현재 디폴트값으로 설정된 T3의 경우, 약 20캔들 앞을 예측해도 매우 높은 정확도를 보여줍니다.
반면에, SMA와 같이 울퉁불퉁한 이동평균선은 가능한 예측치가 크지 않습니다.
(SMA 60, offset=10)
--------
매우 높은 수준의 정확도를 보여준 이동평균선은 JMA(Jurik Moving Average)입니다. 다만 이 이동평균선은 코드가 공개되지 않았기때문에, 관심있으신 분은 저의 코드를 통해 한번 확인해보시길 권장드립니다.
추가로, 제가 올린 이 지표의 코드는 이용가치가 높다고 생각합니다.
하나의 예시로서, 가속도로 예측한 포물선이 깨지는 곳을 기준으로, 힘이 다시 한 번 바뀌는 것을 이용해 진입/로스를 할 수 있습니다. 그 외에도 매우 다양한 활용이 가능합니다.
이 지표를 통해 더욱 좋은 새로운 결과물이 나오길 기대해봅니다.
Market Structure & Liquidity: CHoCHs+Nested Pivots+FVGs+Sweeps//Purpose:
This indicator combines several tools to help traders track and interpret price action/market structure; It can be divided into 4 parts;
1. CHoCHs, 2. Nested Pivot highs & lows, 3. Grade sweeps, 4. FVGs.
This gives the trader a toolkit for determining market structure and shifts in market structure to help determine a bull or bear bias, whether it be short-term, med-term or long-term.
This indicator also helps traders in determining liquidity targets: wether they be voids/gaps (FVGS) or old highs/lows+ typical sweep distances.
Finally, the incorporation of HTF CHoCH levels printing on your LTF chart helps keep the bigger picture in mind and tells traders at a glance if they're above of below Custom HTF CHoCH up or CHoCH down (these HTF CHoCHs can be anything from Hourly up to Monthly).
//Nomenclature:
CHoCH = Change of Character
STH/STL = short-term high or low
MTH/MTL = medium-term high or low
LTH/LTL = long-term high or low
FVG = Fair value gap
CE = consequent encroachement (the midline of a FVG)
~~~ The Four components of this indicator ~~~
1. CHoCHs:
•Best demonstrated in the below charts. This was a method taught to me by @Icecold_crypto. Once a 3 bar fractal pivot gets broken, we count backwards the consecutive higher lows or lower highs, then identify the CHoCH as the opposite end of the candle which ended the consecutive backwards count. This CHoCH (UP or DOWN) then becomes a level to watch, if price passes through it in earnest a trader would consider shifting their bias as market structure is deemed to have shifted.
•HTF CHoCHs: Option to print Higher time frame chochs (default on) of user input HTF. This prints only the last UP choch and only the last DOWN choch from the input HTF. Solid line by default so as to distinguish from local/chart-time CHoCHs. Can be any Higher timeframe you like.
•Show on table: toggle on show table(above/below) option to show in table cells (top right): is price above the latest HTF UP choch, or is price below HTF DOWN choch (or is it sat between the two, in a state of 'uncertainty').
•Most recent CHoCHs which have not been met by price will extend 10 bars into the future.
• USER INPUTS: overall setting: SHOW CHOCHS | Set bars lookback number to limit historical Chochs. Set Live CHoCHs number to control the number of active recent chochs unmet by price. Toggle shrink chochs once hit to declutter chart and minimize old chochs to their origin bars. Set Multi-timeframe color override : to make Color choices auto-set to your preference color for each of 1m, 5m, 15m, H, 4H, D, W, M (where up and down are same color, but 'up' icon for up chochs and down icon for down chochs remain printing as normal)
2. Nested Pivot Highs & Lows; aka 'Pivot Highs & Lows (ST/MT/LT)'
•Based on a seperate, longer lookback/lookforward pivot calculation. Identifies Pivot highs and lows with a 'spikeyness' filter (filtering out weak/rounded/unimpressive Pivot highs/lows)
•by 'nested' I mean that the pivot highs are graded based on whether a pivot high sits between two lower pivot highs or vice versa.
--for example: STH = normal pivot. MTH is pivot high with a lower STH on either side. LTH is a pivot high with a lower MTH on either side. Same applies to pivot lows (STL/MTL/LTL)
•This is a useful way to measure the significance of a high or low. Both in terms of how much it might be typically swept by (see later) and what it would imply for HTF bias were we to break through it in earnest (more than just a sweep).
• USER INPUTS: overall setting: show pivot highs & lows | Bars lookback (historical pivots to show) | Pivots: lookback/lookforward length (determines the scale of your pivot highs/lows) | toggle on/off Apply 'Spikeyness' filter (filters out smooth/unimpressive pivot highs/lows). Set Spikeyness index (determines the strength of this filter if turned on) | Individually toggle on each of STH, MTH, LTH, STL, MTL, LTL along with their label text type , and size . Toggle on/off line for each of these Pivot highs/lows. | Set label spacer (atr multiples above / below) | set line style and line width
3. Grade Sweeps:
•These are directly related to the nested pivots described above. Most assets will have a typical sweep distance. I've added some of my expected sweeps for various assets in the indicator tooltips.
--i.e. Eur/Usd 10-20-30 pips is a typical 'grade' sweep. S&P HKEX:5 - HKEX:10 is a typical grade sweep.
•Each of the ST/MT/LT pivot highs and lows have optional user defined grade sweep boxes which paint above until filled (or user option for historical filled boxes to remain).
•Numbers entered into sweep input boxes are auto converted into appropriate units (i.e. pips for FX, $ or 'handles' for indices, $ for Crypto. Very low $ units can be input for low unit value crypto altcoins.
• USER INPUTS: overall setting: Show sweep boxes | individually select colors of each of STH, MTH, LTH, STL, MTL, LTL sweep boxes. | Set Grade sweep ($/pips) number for each of ST, MT, LT. This auto converts between pips and $ (i.e. FX vs Indices/Crypto). Can be a float as small or large as you like ($0.000001 to HKEX:1000 ). | Set box text position (horizontal & vertical) and size , and color . | Set Box width (bars) (for non extended/ non-auto-terminating at price boxes). | toggle on/off Extend boxes/lines right . | Toggle on/off Shrink Grade sweeps on fill (they will disappear in realtime when filled/passed through)
4. FVGs:
•Fair Value gaps. Represent 'naked' candle bodies where the wicks to either side do not meet, forming a 'gap' of sorts which has a tendency to fill, or at least to fill to midline (CE).
•These are ICT concepts. 'UP' FVGS are known as BISIs (Buyside imbalance, sellside inefficiency); 'DOWN' FVGs are known as SIBIs (Sellside imbalance, buyside inefficiency).
• USER INPUTS: overall setting: show FVGs | Bars lookback (history). | Choose to display: 'UP' FVGs (BISI) and/or 'DOWN FVGs (SIBI) . Choose to display the midline: CE , the color and the line style . Choose threshold: use CE (as opposed to Full Fill) |toggle on/off Shrink FVG on fill (CE hit or Full fill) (declutter chart/see backtesting history)
////••Alerts (general notes & cautionary notes)::
•Alerts are optional for most of the levels printed by this indicator. Set them via the three dots on indicator status line.
•Due to dynamic repainting of levels, alerts should be used with caution. Best use these alerts either for Higher time frame levels, or when closely monitoring price.
--E.g. You may set an alert for down-fill of the latest FVG below; but price will keep marching up; form a newer/higher FVG, and the alert will trigger on THAT FVG being down-filled (not the original)
•Available Alerts:
-FVG(BISI) cross above threshold(CE or full-fill; user choice). Same with FVG(SIBI).
-HTF last CHoCH down, cross below | HTF last CHoCH up, cross above.
-last CHoCH down, cross below | last CHoCH up, cross above.
-LTH cross above, MTH cross above, STH cross above | LTL cross below, MTL cross below, STL cross below.
////••Formatting (general)::
•all table text color is set from the 'Pivot highs & Lows (ST, MT, LT)' section (for those of you who prefer black backgrounds).
•User choice of Line-style, line color, line width. Same with Boxes. Icon choice for chochs. Char or label text choices for ST/MT/LT pivot highs & lows.
////••User Inputs (general):
•Each of the 4 components of this indicator can be easily toggled on/off independently.
•Quite a lot of options and toggle boxes, as described in full above. Please take your time and read through all the tooltips (hover over '!' icon) to get an idea of formatting options.
•Several Lookback periods defined in bars to control how much history is shown for each of the 4 components of this indicator.
•'Shrink on fill' settings on FVGs and CHoCHs: Basically a way to declutter chart; toggle on/off depending on if you're backtesting or reading live price action.
•Table Display: applies to ST/MT/LT pivot highs and to HTF CHoCHs; Toggle table on or off (in part or in full)
////••Credits:
•Credit to ICT (Inner Circle Trader) for some of the concepts used in this indicator (FVGS & CEs; Grade sweeps).
•Credit to @Icecold_crypto for the specific and novel concept of identifying CHoCHs in a simple, objective and effective manner (as demonstrated in the 1st chart below).
CHoCH demo page 1: shifting tweak; arrow diagrams to demonstrate how CHoCHs are defined:
CHoCH demo page 2: Simplified view; short lookback history; few CHoCHs, demo of 'latest' choch being extended into the future by 10 bars:
USAGE: Bitcoin Hourly using HTF daily CHoCHs:
USAGE-2: Cotton Futures (CT1!) 2hr. Painting a rather bullish picture. Above HTF UP CHoCH, Local CHoCHs show bullish order flow, Nice targets above (MTH/LTH + grade sweeps):
Full Demo; 5min chart; CHoCHs, Short term pivot highs/lows, grade sweeps, FVGs:
Full Demo, Eur/Usd 15m: STH, MTH, LTH grade sweeps, CHoCHs, Usage for finding bias (part A):
Full Demo, Eur/Usd 15m: STH, MTH, LTH grade sweeps, CHoCHs, Usage for finding bias, 3hrs later (part B):
Realtime Vs Backtesting(A): btc/usd 15m; FVGs and CHoCHs: shrink on fill, once filled they repaint discreetly on their origin bar only. Realtime (Shrink on fill, declutter chart):
Realtime Vs Backtesting(B): btc/usd 15m; FVGs and CHoCHs: DON'T shrink on fill; they extend to the point where price crosses them, and fix/paint there. Backtesting (seeing historical behaviour):
Autoregressive Covariance Oscillator by TenozenWell to be honest I don't know what to name this indicator lol. But anyway, here is my another original work! Gonna give some background of why I create this indicator, it's all pretty much a coincidence when I'm learning about time series analysis.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Well, the formula of Auto-covariance is:
E{(X(t)-(t) * (X(t-s)-(t-s))}= Y_s
But I don't multiply both values but rather subtract them:
E{(X(t)-(t) - (X(t-s)-(t-s))}= Y_s?
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
For arm_vald, the equation is as follows:
arm_vald = val_mu + mu_plus_lsm + et
val_mu --> mean of time series
mu_plus_lsm --> val_mu + LSM
et --> error term
As you can see, val_mu^2. I did this so the oscillator is much smoother.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
After I get the value, I normalize them:
aco = Y_s? / arm_vald
So by this calculation, I get something like an oscillator!
(more details in the code)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
So how to use this indicator? It's so easy! If the value is above 0, we gonna expect a bullish response, if the value is below 0, we gonna expect a bearish response; that simple. Be aware that you should wait for the price to be closed before executing a trade.
Well, try it out! So far this is the most powerful indicator that I've created, hope it's useful. Ciao.
(more updates for the indicator if needed)
Fed Projected Interest RatesThis script shows you the current interest rates by the FED (see ZQ symbol nearest expiration)
and the next expirations (see ZQ further expiration dates).
It is important to keep your expiration and descriptions up to date, to do that to the indicator inputs and change as you please.