Trend Forecasting - The Quant Science🌏 Trend Forecasting | ENG 🌏
This plug-in acts as a statistical filter, adding new information to your chart that will allow you to quickly verify the direction of a trend and the probability with which the price will be above or below the average in the future, helping you to uncover probable market inefficiencies.
🧠 Model calculation
The model calculates the arithmetic mean in relation to positive and negative events within the available sample for the selected time series. Where a positive event is defined as a closing price greater than the average, and a negative event as a closing price less than the average. Once all events have been calculated, the probabilities are extrapolated by relating each event.
Example
Positive event A: 70
Negative event B: 30
Total events: 100
Probabilities A: (100 / 70) x 100 = 70%
Probabilities B: (100 / 30) x 100 = 30%
Event A has a 70% probability of occurring compared to Event B which has a 30% probability.
🔍 Information Filter
The data on the graph show the future probabilities of prices being above average (default in green) and the probabilities of prices being below average (default in red).
The information that can be quickly retrieved from this indicator is:
1. Trend: Above-average prices together with a constant of data in green greater than 50% + 1 indicate that the observed historical series shows a bullish trend. The probability is correlated proportionally to the value of the data; the higher and increasing the expected value, the greater the observed bullish trend. On the other hand, a below-average price together with a red-coloured data constant show quantitative data regarding the presence of a bearish trend.
2. Future Probability: By analysing the data, it is possible to find the probability with which the price will be above or below the average in the future. In green are classified the probabilities that the price will be higher than the average, in red are classified the probabilities that the price will be lower than the average.
🔫 Operational Filter .
The indicator can be used operationally in the search for investment or trading opportunities given its ability to identify an inefficiency within the observed data sample.
⬆ Bullish forecast
For bullish trades, the inefficiency will appear as a historical series with a bullish trend, with high probability of a bullish trend in the future that is currently below the average.
⬇ Bearish forecast
For short trades, the inefficiency will appear as a historical series with a bearish trend, with a high probability of a bearish trend in the future that is currently above the average.
📚 Settings
Input: via the Input user interface, it is possible to adjust the periods (1 to 500) with which the average is to be calculated. By default the periods are set to 200, which means that the average is calculated by taking the last 200 periods.
Style: via the Style user interface it is possible to adjust the colour and switch a specific output on or off.
🇮🇹Previsione Della Tendenza Futura | ITA 🇮🇹
Questo plug-in funge da filtro statistico, aggiungendo nuove informazioni al tuo grafico che ti permetteranno di verificare rapidamente tendenza di un trend, probabilità con la quale il prezzo si troverà sopra o sotto la media in futuro aiutandoti a scovare probabili inefficienze di mercato.
🧠 Calcolo del modello
Il modello calcola la media aritmetica in relazione con gli eventi positivi e negativi all'intero del campione disponibile per la serie storica selezionata. Dove per evento positivo si intende un prezzo alla chiusura maggiore della media, mentre per evento negativo si intende un prezzo alla chiusura minore della media. Calcolata la totalità degli eventi le probabilità vengono estrapolate rapportando ciascun evento.
Esempio
Evento positivo A: 70
Evento negativo B: 30
Totale eventi : 100
Formula A: (100 / 70) x 100 = 70%
Formula B: (100 / 30) x 100 = 30%
Evento A ha una probabilità del 70% di realizzarsi rispetto all' Evento B che ha una probabilità pari al 30%.
🔍 Filtro informativo
I dati sul grafico mostrano le probabilità future che i prezzi siano sopra la media (di default in verde) e le probabilità che i prezzi siano sotto la media (di default in rosso).
Le informazioni che si possono rapidamente reperire da questo indicatore sono:
1. Trend: I prezzi sopra la media insieme ad una costante di dati in verde maggiori al 50% + 1 indicano che la serie storica osservata presenta un trend rialzista. La probabilità è correlata proporzionalmente al valore del dato; tanto più sarà alto e crescente il valore atteso e maggiore sarà la tendenza rialzista osservata. Viceversa, un prezzo sotto la media insieme ad una costante di dati classificati in colore rosso mostrano dati quantitativi riguardo la presenza di una tendenza ribassista.
2. Probabilità future: analizzando i dati è possibile reperire la probabilità con cui il prezzo si troverà sopra o sotto la media in futuro. In verde vengono classificate le probabilità che il prezzo sarà maggiore alla media, in rosso vengono classificate le probabilità che il prezzo sarà minore della media.
🔫 Filtro operativo
L' indicatore può essere utilizzato a livello operativo nella ricerca di opportunità di investimento o di trading vista la capacità di identificare un inefficienza all'interno del campione di dati osservato.
⬆ Previsione rialzista
Per operatività di tipo rialzista l'inefficienza apparirà come una serie storica a tendenza rialzista, con alte probabilità di tendenza rialzista in futuro che attualmente si trova al di sotto della media.
⬇ Previsione ribassista
Per operatività di tipo short l'inefficienza apparirà come una serie storica a tendenza ribassista, con alte probabilità di tendenza ribassista in futuro che si trova attualmente sopra la media.
📚 Impostazioni
Input: tramite l'interfaccia utente Input è possibile regolare i periodi (da 1 a 500) con cui calcolare la media. Di default i periodi sono impostati sul valore di 200, questo significa che la media viene calcolata prendendo gli ultimi 200 periodi.
Style: tramite l'interfaccia utente Style è possibile regolare il colore e attivare o disattivare un specifico output.
Forecastingtechniques
Nasan Moving Average with ForecastThe "Nasan Moving Average with Forecast" indicator is a technical analysis forecasting tool that combines the principles of historical data analysis and random walk theory. It calculates a customized moving average (Nasan Moving Average) by integrating price data and statistical measures and projects future price points by generating forecast values within calculated volatility bounds, creating a dynamic and insightful visualization of potential market movements. This indicator to blend past market behavior with probabilistic future trends to enhance forecasting.
Input Parameters:
len: Differencing length (default 21, Use a minimum of 5 and for lower time frames less than 15 min use values between 300 -3000)
len1: Correction Factor Length 1 (default 21, this determines the length of the MA you want , eg. 10 MA, 50 MA, 100 MA, )
len2: Correction Factor Length 2 (default 9, this works best if it is ~ </=1/2 of len1 )
len3: Smoothing Length (default 5, I would not change this and only use if I want to introduce lag where you want to use it for cross over strategies).
forecast_points: Number of points to forecast (default 30).
m: Multiplier for standard deviation (default 2.5).
bl: Block length for calculating max/min values (default 100).
use_calculated_max_min: Boolean to decide whether to use calculated max/min values.
Nasan Moving Average Calculation:
Calculates the simple moving average (mean) and standard deviation (sd) of the typical price (hlc3).
Computes intermediate variables (a, b, c, etc.) based on log transformation and cumulative sum.
Applies weighted moving averages (wma) to these intermediate variables to smooth them and derive the final value c6.
Plots c6 as the Nasan Moving Average if the bar is confirmed. To learn more see Nasan Moving Average.
Forecast Points Calculation:
Calculates maximum (max_val) and minimum (min_val) values for the forecast, either using a fixed value or based on standard deviation and a multiplier.
Initializes an array to store forecast values and creates polyline objects for plotting.
If the current bar is one of the last three bars and confirmed:
Clears and reinitializes the polyline.
Initializes the first forecast value from the cumulative sum c.
Generates subsequent forecast values using a random value within the range .
Updates the forecast array and plots the forecast points as an orange curved polyline.
Plotting Max/Min Values:
Plots max_val and min_val as green and red lines, respectively, to indicate the bounds of the forecast range.
Components of the Forecasting Model
Historical Dependence:
Nasan Moving Average Calculation: The script calculates a custom moving average (c6) that incorporates historical price data (hlc3), standard deviations (sd), and weighted moving averages (wma). This part of the code processes historical data to create a smoothed representation of the price trend.
Max/Min Value Calculation: The maximum (max_val) and minimum (min_val) values for the forecast can be calculated based on the historical standard deviation of a transformed variable b over a block length (bl). This introduces historical volatility into the bounds for the forecast.
Random Walk Model:
Random Value Generation: Within the forecast points calculation, a random value (random_val) is generated for each forecast point within the range . This random value introduces stochasticity into the model, characteristic of a random walk process.
Cumulative Sum for Forecasting: The script uses a cumulative sum (prev_f + random_val) to generate the next forecast point (next_f). This is a typical approach in random walk models where each new point is based on the previous point plus some random noise.
Explanation of the Forecast Model
Random Walk Characteristics: Each new forecast point is generated by adding a random value to the previous point, making the model a random walk with drift, where the drift is influenced by historical correction factors (c1, c4).
Historical and Statistical Dependence: The bounds of the random values and the initial conditions are derived from historical data, ensuring that the forecast respects historical volatility and trends.
The forecasting model in the script is a hybrid approach: It uses a random walk to generate future points, characterized by adding random values to the previous forecasted value.
The historical and statistical dependence is incorporated through initial conditions, scaling factors, and bounds derived from historical price data and its statistical properties.
This combination ensures that the forecasts are not purely stochastic but are grounded in historical price behavior, making the model more robust and potentially more accurate in reflecting market conditions.
Price Scenarios - The Quant ScienceGENERAL OVERVIEW
Price Scenarios - The Quant Science is a quantitative statistical indicator that provides a forecast probability about future prices moving using the mathematical-statistical formula of statistical probability and expected value.
HOW TO USE
The indicator displays arrow-shaped signals that represent the probable future price movement calculated by the indicator, including the current percentage probability. Additionally, the candlesticks are colored based on the predicted direction to facilitate visual analysis. By default, green is used for bullish movements and red for bearish movements. The trader can set the analysis period (default value is 200) and the percentage threshold of probability to consider (default value is greater than 0.50 or 50%) through the user interface.
USER INTERFACE
Lenght analysis: with this features you can handle the length of the dataset to be used for estimating statistical probabilities.
Expected value: with this feature you can handle the threshold of the expected value to filter, only probabilities greater than this threshold will be considered by the model. By default, it is set to 0.50, which is equivalent to 50%.
Design Settings: modify the colors of your indicator with just a few clicks by managing this function.
We recommend disabling 'Wick' and 'Border' from the settings panel for a smoother and more efficient user experience.
Price Action Fractal Forecasts [AlgoAlpha]🔮 Price Action Fractal Forecasts - Unleash the Power of Historical Patterns! 🌌✨
Dive into the future with AlgoAlpha's Price Action Fractal Forecasts ! This innovative indicator utilizes the mesmerizing complexity of fractals to predict future price movements, offering traders a unique edge in the market. By analyzing historical price action and identifying repeating patterns, this tool forecasts future price trends, providing visually engaging and actionable insights.
Key Features:
🔄 Flexible Data Series Selection: Choose your preferred data series for precise analysis.
🕰 Flexible Training and Reference Data Windows: Customize the length of training data and reference periods to match your trading style.
📈 Custom Forecast Length: Adjust the forecast horizon to suit your strategic objectives.
🌈 Customizable Visual Elements: Tailor the colors of forecast deviation cones, data reference areas, and more for optimal chart readability.
🔄 Anticipatory and Repetitive Forecast Modes: Select between anticipating future trends or identifying repetitive patterns for forecasts.
🔎 Enhanced Similarity Search: Leverages correlation metrics to find the most similar historical data segments.
📊 Forecast Deviation Cone: Visualize potential price range deviations with adjustable multipliers.
🚀 Quick Guide to Maximizing Your Trading with Price Action Fractal Forecasts:
🛠 Add the Indicator: Search for "Price Action Fractal Forecasts" in TradingView's Indicators & Strategies. Customize settings according to your trading strategy.
📊 Strategic Forecasting: Monitor the forecast deviation cone and forecast directional changes for insights into potential future price movements.
🔔 Alerts for Swift Action: Set up notifications based on forecast changes to stay ahead of market movements without constant monitoring.
Behind the Magic: How It Works
The core of the Price Action Fractal Forecasts lies in its ability to compare current market behavior with historical data to unearth similar patterns. It first establishes a training data window to analyze historical prices. Within this window, it then defines a reference length to identify the most recent price action that will serve as the basis for comparison. The indicator searches through the historical data within the training window to find segments that closely match the recent price action in the reference period.
Depending on whether you choose the anticipatory or repetitive forecast mode, the indicator either looks ahead to predict future prices based on past outcomes following similar patterns or focuses on the repeating patterns within the reference period itself for forecasts. The forecast's direction can be configured to reflect the mean average of forecasted prices or the end-point relative to the start-point of the forecast, offering flexibility in how forecasts are interpreted.
To enhance the comprehensiveness and visualization, the indicator features a forecast deviation cone. This cone represents the potential range of price movements, providing a visual cue for volatility and uncertainty in the forecasted prices. The intensity of this cone can be adjusted to suit individual preferences, offering a visual guide to the level of risk and uncertainty associated with the forecasted price path.
Embrace the fractal magic of markets with AlgoAlpha's Price Action Fractal Forecasts and transform your trading today! 🌟🚀
MACD Based Price Forecasting [LuxAlgo]The MACD Based Price Forecasting tool is an innovative price forecasting method based on signals generated by the MACD indicator.
The forecast includes an area which can help traders determine the area where price can develop after a MACD signal.
🔶 USAGE
The forecast returned by the tool allows users to obtain a general picture of how price tends to progress after a specific MACD signal. The forecast is constructed based on percentiles of previous price progressions done after a specific MACD signal is generated.
Users can change which condition is used to generate MACD signals from the "Trend Determination" dropdown menu, with "MACD" determining trends based on whether the MACD is positive (uptrend) or negative (downtrend) and "MACD-Signal" determining trends based on the position of the MACD relative to its signal line, with an MACD above the signal line indicating an uptrend, else a downtrend.
Users can introduce bias to the forecast by changing the "Average Percentage" setting, with values above 50% introducing bullish bias, and below bearish bias.
It can be possible for the forecast to highlight potential reversals depending on the selected forecasting horizon as long as reversals can be observed on trends detected by the MACD.
🔹 Forecasting Area
The forecasting area can help visualize the area that will likely contain price after a specific signal. The area width is based on the "Top/Bottom Percentiles" settings, with a higher "Top Percentile" value returning a higher top bound and a lower "Bottom Percentile" value returning a lower bottom bound.
These areas can also serve as potential support/resistance areas.
🔶 SETTINGS
Fast Length: Fast length of the moving average used to compute the MACD
Slow Length: Slow length of the moving average used to compute the MACD
Signal Length: Length of the MACD moving average.
Trend Determination: Method used to determine a trend direction from the MACD.
🔹 Forecast
Maximum Memory: Determines the maximum amount of prices recorded at each steps succeeding a signal. Lower values will return forecasts with a higher degree of variability.
Forecasting Length: Forecasting horizon in bars, this value only serves as a limit of the forecasting horizon and might not be reached depending on user selected MACD settings.
Top Percentile: Percentile value used to determine the upper bound of the forecasting area.
Average Percentile: Percentile value used to determine the forecast.
Lower Percentile: Percentile value used to determine the lower bound of the forecasting area.
GARCH Volatility Estimation - The Quant ScienceThe GARCH (Generalized Autoregressive Conditional Heteroskedasticity) model is a statistical model used to forecast the volatility of a financial asset. This model takes into account the fluctuations in volatility over time, recognizing that volatility can vary in a heteroskedastic (i.e., non-constant variance) manner and can be influenced by past events.
The general formula of the GARCH model is:
σ²(t) = ω + α * ε²(t-1) + β * σ²(t-1)
where:
σ²(t) is the conditional variance at time t (i.e., squared volatility)
ω is the constant term (intercept) representing the baseline level of volatility
α is the coefficient representing the impact of the squared lagged error term on the conditional variance
ε²(t-1) is the squared lagged error term at the previous time period
β is the coefficient representing the impact of the lagged conditional variance on the current conditional variance
In the context of financial forecasting, the GARCH model is used to estimate the future volatility of the asset.
HOW TO USE
This quantitative indicator is capable of estimating the probable future movements of volatility. When the GARCH increases in value, it means that the volatility of the asset will likely increase as well, and vice versa. The indicator displays the relationship of the GARCH (bright red) with the trend of historical volatility (dark red).
USER INTERFACE
Alpha: select the starting value of Alpha (default value is 0.10).
Beta: select the starting value of Beta (default value is 0.80).
Lenght: select the period for calculating values within the model such as EMA (Exponential Moving Average) and Historical Volatility (default set to 20).
Forecasting: select the forecasting period, the number of bars you want to visualize data ahead (default set to 30).
Design: customize the indicator with your preferred color and choose from different types of charts, managing the design settings.
Limited Growth Stock-to-Flow (LGS2F) [AlgoAlpha]Description:
The "∂ Limited Growth Stock-to-Flow (LG-S2F)" indicator, developed by AlgoAlpha, is a technical analysis tool designed to analyze the price of Bitcoin (BTC) based on the Stock-to-Flow model. The indicator calculates the expected price range of BTC by incorporating variables such as BTC supply, block height, and model parameters. It also includes error bands to indicate potential overbought and oversold conditions.
How it Works:
The LG-S2F indicator utilizes the Stock-to-Flow model, which measures the scarcity of an asset by comparing its circulating supply (stock) to its newly produced supply (flow). In this script, the BTC supply and block height data are obtained to calculate the price using the model formula. The formula includes coefficients (a, b, c) and exponentiation functions to derive the expected price.
The script incorporates error bands based on uncertainty values derived from the standard errors of the model parameters. These error bands indicate the potential range of variation in the expected price, accounting for uncertainties in the model's parameters. The upper and lower error bands visualize potential overbought and oversold conditions, respectively.
Usage:
Traders can utilize the LG-S2F indicator to gain insights into the potential price movements of Bitcoin. The indicator's main line represents the expected price, while the error bands highlight the potential range of variation. Traders may consider taking long positions when the price is near or below the lower error band and short positions when the price is close to or above the upper error band.
It's important to note that the LG-S2F indicator is specifically designed for Bitcoin and relies on the Stock-to-Flow model. Users should exercise caution and consider additional analysis and factors before making trading decisions solely based on this indicator.
Originality:
The LG-S2F indicator, developed by QuantMario and AlgoAlpha, is an original implementation that combines the Stock-to-Flow model with error bands to provide a comprehensive view of BTC's potential price range. While the concept of Stock-to-Flow analysis exists, the specific calculations, incorporation of error bands, and customization options in this script are unique to QuantMario's methodology. The script is released under Mozilla Public License 2.0, allowing users to utilize and modify it while adhering to the license terms.
Machine Learning: Gaussian Process Regression [LuxAlgo]We provide an implementation of the Gaussian Process Regression (GPR), a popular machine-learning method capable of estimating underlying trends in prices as well as forecasting them.
While this implementation is adapted to real-time usage, do remember that forecasting trends in the market is challenging, do not use this tool as a standalone for your trading decisions.
🔶 USAGE
The main goal of our implementation of GPR is to forecast trends. The method is applied to a subset of the most recent prices, with the Training Window determining the size of this subset.
Two user settings controlling the trend estimate are available, Smooth and Sigma . Smooth determines the smoothness of our estimate, with higher values returning smoother results suitable for longer-term trend estimates.
Sigma controls the amplitude of the forecast, with values closer to 0 returning results with a higher amplitude. Do note that due to the calculation of the method, lower values of sigma can return errors with higher values of the training window.
🔹 Updating Mechanisms
The script includes three methods to update a forecast. By default a forecast will not update for new bars (Lock Forecast).
The forecast can be re-estimated once the price reaches the end of the forecasting window when using the "Update Once Reached" method.
Finally "Continuously Update" will update the whole forecast on any new bar.
🔹 Estimating Trends
Gaussian Process Regression can be used to estimate past underlying local trends in the price, allowing for a noise-free interpretation of trends.
This can be useful for performing descriptive analysis, such as highlighting patterns more easily.
🔶 SETTINGS
Training Window: Number of most recent price observations used to fit the model
Forecasting Length: Forecasting horizon, determines how many bars in the future are forecasted.
Smooth: Controls the degree of smoothness of the model fit.
Sigma: Noise variance. Controls the amplitude of the forecast, lower values will make it more sensitive to outliers.
Update: Determines when the forecast is updated, by default the forecast is not updated for new bars.
Pattern Forecast (Expo)█ Overview
The Pattern Forecast indicator is a technical analysis tool that scans historical price data to identify common chart patterns and then analyzes the price movements that followed these patterns. It takes this information and projects it into the future to provide traders with potential price actions that may occur if the same pattern is identified in real-time market data. This projection helps traders to understand the possible outcomes based on the previous occurrences of the pattern, thereby offering a clearer perspective of the market scenario. By analyzing the historical data and understanding the subsequent price movements following the appearance of a specific pattern, the indicator can provide valuable insights into potential future market behavior.
█ Calculations
The indicator works by scanning historical price data for various candlestick patterns. It includes all in-built TradingView patterns, credit to TradingView that has coded them.
Essentially, the indicator takes the historical price moves that followed the pattern to forecast what might happen next.
█ Example
In this example, the algorithm is set to search for the Inverted Hammer Bullish candlestick pattern. If the pattern is found, the historical outcome is then projected into the future. This helps traders to understand how the past pattern evolved over time.
█ How to use
Providing traders with a comprehensive understanding of historical patterns and their implications for future price action allows them to assess the likelihood of specific market scenarios objectively. For example, suppose the pattern forecast indicator suggests that a particular pattern is likely to lead to a bullish move in the market. A trader might consider going long if the same pattern is identified in the real-time market. Similarly, a trader might consider shorting the asset if the indicator suggests a bearish move is likely, if the same pattern is identified in the real-time market.
█ Settings
Pattern
Select the pattern that the indicator should scan for. All inbuilt TradingView patterns can be selected.
Forecast Candles
Number of candles to project into the future.
-----------------
Disclaimer
The information contained in my Scripts/Indicators/Ideas/Algos/Systems does not constitute financial advice or a solicitation to buy or sell any securities of any type. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
My Scripts/Indicators/Ideas/Algos/Systems are only for educational purposes!
Price Action Color Forecast (Expo)█ Overview
The Price Action Color Forecast Indicator , is an innovative trading tool that uses the power of historical price action and candlestick patterns to predict potential future market movements. By analyzing the colors of the candlesticks and identifying specific price action events, this indicator provides traders with valuable insights into future market behavior based on past performance.
█ Calculations
The Price Action Color Forecast Indicator systematically analyzes historical price action events based on the colors of the candlesticks. Upon identifying a current price action coloring event, the indicator searches through its past data to find similar patterns that have happened before. By examining these past events and their outcomes, the indicator projects potential future price movements, offering traders valuable insights into how the market might react to the current price action event.
The indicator prioritizes the analysis of the most recent candlesticks before methodically progressing toward earlier data. This approach ensures that the generated candle forecast is based on the latest market dynamics.
The core functionality of the Price Action Color Forecast Indicator:
Analyzing historical price action events based on the colors of the candlesticks.
Identifying similar events from the past that correspond to the current price action coloring event.
Projecting potential future price action based on the outcomes of past similar events.
█ Example
In this example, we can see that the current price action pattern matches with a similar historical price action pattern that shares the same characteristics regarding candle coloring. The historical outcome is then projected into the future. This helps traders to understand how the past pattern evolved over time.
█ How to use
The indicator provides traders with valuable insights into how the market might react to the current price action event by examining similar historical patterns and projecting potential future price movements.
█ Settings
Candle series
The candle lookback length refers to the number of bars, starting from the current one, that will be examined in order to find a similar event in the past.
Forecast Candles
Number of candles to project into the future.
-----------------
Disclaimer
The information contained in my Scripts/Indicators/Ideas/Algos/Systems does not constitute financial advice or a solicitation to buy or sell any securities of any type. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
My Scripts/Indicators/Ideas/Algos/Systems are only for educational purposes!
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.
Gann Square of 144This indicator will create lines on the chart based on W.D. Gann's Square of 144. All the inputs will be detailed below
Why create this indicator?
I didn't find it on Tradingview (at least with open source). But the main reason is to study the strategy and be able to draw it fast. Manually drawing the square is not hard, but moving all together to the right spots and scale was time-consuming.
It has a lot of inputs...
Yes, each square point divisible by 6 has information with some options, so the user can create any configuration he wants. Also, it has the advantage of having the square built in seconds and adjusting itself on each new calculation.
About the inputs
Starting Date
This input will be used when the "Set Upper/Lower Prices and Start Bar Automatically" checkbox is not selected. The indicator will calculate all the line locations on the chart using the selected start date. When selecting this input, change the Manual Max and Min Prices to the better calculation
Manual Max/Min Price
This input will be used when the "Set Upper/Lower Prices and Start Bar Automatically" checkbox is not selected. The indicator will calculate all the line's locations on the chart using these prices
Set Upper/Lower Prices and Start Bar Automatically
Selects if the starting date will be automatically selected by the system or based on the input data. When it's set, the indicator will use the most recent bar as the middle point of the square, using the higher price as the Upper Price and the lowest price as the Lower Price in the latest 72 bars (or more based on the Candles Per Division parameter)
Update at a new bar
When this option is market, the indicator will update all created lines to match the new bar position, together with all the possible new Upper/Lower prices. Let it unchecked to watch the progression of the price while the square remains fixed in the chart.
Top X-Axis
When checked, it will display the labels on the Top of the square
Bottom X-Axis
When checked, it will display the labels on the Bottom of the square
Left X-Axis
When checked, it will display the labels on the left of the square
Right X-Axis
When checked, it will display the labels on the right of the square
Show Prices on the Right Y-Axis
When checked, it will display the prices together with the labels on the right of the square
Show Vertical Divisions
Show the lines that will divide the square into 9 equal parts
Show Extra Lines
Show unique lines that will come from the Top and bottom middle of the square, connecting the center to the 36 and 108 levels
Show Grid
When selected, it will display a grid in the square
Line Patterns
A selector with some options of built-in lines configuration. When any option besides None is selected, it will override the lines inputs below
Numbers Color
Select the color of each number on the Axis
Vertical Lines Color
Select the color of the vertical lines
Grid Color
Select the grid line color
Connections from corners to N
Each corner is represented by 2 characters, so they all fit in a single line
It will indicate where the line starts and where it ends
┏ ↓ = Top Left to Bottom
┏ → = Top Left to Right
┗ ↑ = Bottom Left to Top
┗ → = Bottom Left to Right
┓ ← = Top Right to Left
┓ ↓ = Top Right to Bottom
┛ ← = Bottom Right to Left
┛ ↑ = Bottom Right to Top
Besides selecting what line will be created, it's possible to select the color, the style, and the extension
How to use this indicator
When you dig into Gann's books for more information about the square of 144, you find that it was part of his setup with multiple indicators (technical and fundamental, and astrological). It is not a "one indicator" setup, so it's hard to say that you will find entries, exits, stop loss, and take profit in this. Still, it will help see trendiness, support, and resistance levels.
Mixing this with other indicators is probably a good idea, but some may find this indicator the only one needed.
Some aspects of the square
The end of the square is important, so where it starts is crucial. The end is important because it is where the price and time expire. The other parts of the square are defined based on their start and end, so placing them right is essential.
So, where to set the start of the square?
The last major low is the most indicated. The minimum price will be the lowest, and the max price will be the last major Top. Note that the indicator uses 1 candle on each point.
After finding the start, the minimum, and the maximum prices for the square, it will draw all lines. Another essential part of the square is The Midpoint.
The midpoint is the most crucial part of the square and is the best way to see if you positioned the square correctly. When the price is inside the square, using the starting candle as the start, a second higher low or a lower high occurs in that spot. When using the Vertical lines in the indicator, it's the middle square inside Gann's square.
The other divisions will be opposing each other most of the time. So if the price is rising in the 1/3 of the square, it's common to see the price fall in the 3/3 of the square.
More information about these aspects here
Considerations
This indicator was meant for price targets and a time calculator for possible support/resistances in the chart. It was created by William Delbert Gann and was part of his setup for trading almost a century ago. The lines will form geometric figures, which Gann used with high accuracy to predict tops/bottoms and when they would occur.
The Echo Forecast [LuxAlgo]This indicator uses a simple time series forecasting method derived from the similarity between recent prices and similar/dissimilar historical prices. We named this method "ECHO".
This method originally assumes that future prices can be estimated from a historical series of observations that are most similar to the most recent price variations. This similarity is quantified using the correlation coefficient. Such an assumption can prove to be relatively effective with the forecasting of a periodic time series. We later introduced the ability to select dissimilar series of observations for further experimentation.
This forecasting technique is closely inspired by the analogue method introduced by Lorenz for the prediction of atmospheric data.
1. Settings
Evaluation Window: Window size used for finding historical observations similar/dissimilar to recent observations. The total evaluation window is equal to "Forecast Window" + "Evaluation Window"
Forecast Window: Determines the forecasting horizon.
Forecast Mode: Determines whether to choose historical series similar or dissimilar to the recent price observations.
Forecast Construction: Determines how the forecast is constructed. See "Usage" below.
Src: Source input of the forecast
Other style settings are self-explanatory.
2. Usage
This tool can be used to forecast future trends but also to indicate which historical variations have the highest degree of similarity/dissimilarity between the observations in the orange zone.
The forecasting window determines the prices segment (in orange) to be used as a reference for the search of the most similar/dissimilar historical price segment (in green) within the gray area.
Most forecasting techniques highly benefit from a detrended series. Due to the nature of this method, we highly recommend applying it to a detrended and periodic series.
You can see above the method is applied on a smooth periodic oscillator and a momentum oscillator.
The construction of the forecast is made from the price changes obtained in the green area, denoted as w(t) . Using the "Cumulative" options we construct the forecast from the cumulative sum of w(t) . Finally, we add the most recent price value to this cumulated series.
Using the "Mean" options will add the series w(t) with the mean of the prices within the orange segment.
Finally the "Linreg" will add the series w(t) to an extrapolated linear regression fit to the prices within the orange segment.
Pivot High/Low Analysis & Forecast [LuxAlgo]Returns pivot points high/low alongside the percentage change between one pivot and the previous one (Δ%) and the distance between the same type of pivots in bars (Δt). The trailing mean for each of these metrics is returned on a dashboard on the chart. The indicator also returns an estimate of the future time position of the pivot points.
This indicator by its very nature is not real-time and is meant for descriptive analysis alongside other components of the script. This is normal behavior for scripts detecting pivots as a part of a system and it is important you are aware the pivot labels are not designed to be traded in real-time themselves
🔶 USAGE
The indicator can provide information helping the user to infer the position of future pivot points. This information is directly used in the indicator to provide such forecasting. Note that each metric is calculated relative to the same type of pivot points.
It is also common for analysts to use pivot points for the construction of various figures, getting the percentage change and distance for each pivot point can allow them to eventually filter out points of non-interest.
🔹 Forecast
We use the trailing mean of the distance between respective pivots to estimate the time position of future pivot points, this can be useful to estimate the location of future tops/bottoms. The time position of the forecasted pivot is given by a vertical dashed line on the chart.
We can see a successful application of this method below:
Above we see the forecasted pivots for BTCUSD15. The forecast of interest being the pivot high. We highlight the forecast position with a blue dotted line for reference.
After some time we obtain a new pivot high with a new forecast. However, we can see that the time location of this new pivot high matches perfectly with the prior forecast.
The position in time for the forecast is given by:
x1_ph + E
x1_pl + E
where x1_ph denotes the position in time of the most recent pivot high. x1_pl denotes the position in time of the most recent pivot low and E the average distance between respective pivot points.
🔶 SETTINGS
Length: Window size for the detection of pivot points.
Show Forecasted Pivots: Display forecast of future pivot points.
🔹 Dashboard
Dashboard Location: Location of the dashboard on the chart
Dashboard Size: Size of the dashboard on the chart
Text/Frame Color: Determines the color of the frame grid as well as the text color
Forecasting - Drift MethodIntroduction
Nothing fancy in terms of code, take this post as an educational post where i provide information rather than an useful tool.
Time-Series Forecasting And The Drift Method
In time-series analysis one can use many many forecasting methods, some share similarities but they can all by classified in groups and sub-groups, the drift method is a forecasting method that unlike averages/naive methods does not have a constant (flat) forecast, instead the drift method can increase or decrease over time, this is why its a great method when it comes to forecasting linear trends.
Basically a drift forecast is like a linear extrapolation, first you take the first and last point of your data and draw a line between those points, extend this line into the future and you have a forecast, thats pretty much it.
One of the advantage of this method is first its simplicity, everyone could do it by hand without any mathematical calculations, then its ability to be non-conservative, conservative methods involve methods that fit the data very well such as linear/non-linear regression that best fit a curve to the data using the method of least-squares, those methods take into consideration all the data points, however the drift method only care about the first and last point.
Understanding Bias And Variance
In order to follow with the ability of methods to be non-conservative i want to introduce the concept of bias and variance, which are essentials in time-series analysis and machine learning.
First lets talk about training a model, when forecasting a time-series we can divide our data set in two, the first part being the training set and the second one the testing set. In the training set we fit a model to the training data, for example :
We use 200 data points, we split this set in two sets, the first one is for training which is in blue, and the other one for testing which is in green.
Basically the Bias is related to how well a forecasting model fit the training set, while the variance is related to how well the model fit the testing set. In our case we can see that the drift line does not fit the training set very well, it is then said to have high bias. If we check the testing set :
We can see that it does not fit the testing set very well, so the model is said to have high variance. It can be better to talk of bias and variance when using regression, but i think you get it. This is an important concept in machine learning, you'll often see the term "overfitting" which relate to a model fitting the training set really well, those models have a low to no bias, however when it comes to testing they don't fit well at all, they have high variance.
Conclusion On The Drift Method
The drift method is good at forecasting linear trends, and thats all...you see, when forecasting financial data you need models that are able to capture the complexity of the price structure as well as being robust to noise and outliers, the drift method isn't able to capture such complexity, its not a super smart method, same goes for linear regression. This is why more peoples are switching to more advanced models such a neural networks that can sometimes capture such complexity and return decent results.
So this method might not be the best but if you like lines then here you go.
Alpha-Sutte ModelThe Alpha-Sutte model is an ongoing project run by Ansari Saleh Ahmar, a lecturer and researcher at Universitas Negeri Makassar in Indonesia, that attempts to make forecasts for time series like how Arima and Holt-Winters models do. Currently Ahmar and his team have conducted research and published papers comparing the efficacy of the Alpha-Sutte and other models, such as Arima and Holt-Winters, on topics ranging from forecasting Turkey's CPI data, Bitcoin prices, Apple's stock prices, primary energy supply of Indonesia, to infant mortality rates in China.
The Alpha-Sutte model in comparison to the other two models listed above shows promise in providing a more accurate forecast, and the project has been able to receive some of its funding from organizations such as the US Agency for International Development, which is a part of the US Federal Government, so maybe the project has some actual merit.
How it works:
In this model there are four values presented at the top of the window.
1) The first value in blue is the value of the Alpha-Sutte model whose purpose is to forecast the price of the current bar.
2) The second value in yellow is an adaptive version of the Alpha-Sutte model that I made. The purpose of the adaptive Alpha-Sutte model is to expand upon the Alpha-Sutte by allowing new information to be introduced, causing the value to change during the current period, hence the adaptiveness of it.
3) The third value in aqua is the moving average of the low% Sutte line which is a predictive line that is based off of the close and low of the current and previous periods.
4) The fourth value in red is the moving average of the high% Sutte line which is a predictive line that is based off of the close and high of the current and previous periods.
Trend signals:
If low% Sutte (aqua value/line) is greater than high% Sutte (red value/line) then this is a buy signal.
If high% Sutte (red value/line) is greater than low% Sutte (aqua value/line) then this is a sell signal.
Caveat:
Even though this model's purpose is to forecast the future, will it be able to predict periods of large movements? No, of course not, but it will adjust quickly to try to make more accurate forecasts for the next period. This was also a reason why I made an adaptive version of this model to try to reduce some of the discrepancies between the Alpha Sutte and price when there is a large unexpected move.
*WARNING before using this I would highly recommend that you look up "Sutte Indicator" online and read some of the papers about this model before you use this , even though this model has shown merit when compared to Arima and Holt-Winter models this is still an ongoing project.*
Hopefully this project will actually come to something in the near future as the calculation for this time series predictive model is much easier to calculate and program in pine editor than something like an Arima model.
*Also, if you know how to use R language there is a package for the "Alpha-Sutte model".*
Linear ExtrapolationBasic extrapolator for forecast a time-series, all forecasts are mades length periods ahead.
This is not a estimation of the exact price
This should only be used for forecasting direction, dont expect the price to be at the same value of its forecast.
Bias, Mean absolute error, Mean percentage error...etc look useless here, its better to use correlation as a accuracy measurement.
Correlation(Forecast ,close,period)
Rescaling for a better forecast ?
Transforming a non-stationary signal to a stationary signal can increase the forecasting accuracy, this can be done by detrending. Here is a list of somes detrending methods:
Auto-Bias : price - price
Mean-Bias : price - price moving average
Log transform : log(price/price moving average)
Correlation : correlation(price,n,period)