Itakura-Saito Autoregressive Extrapolation of Price [Loxx]The Itakura–Saito distance is a Bregman divergence generated by minus the logarithmic function, but is not a true metric since it is not symmetric and it does not fulfil triangle inequality.
In Non-negative matrix factorization, the Itakura-Saito divergence can be used as a measure of the quality of the factorization: this implies a meaningful statistical model of the components and can be solved through an iterative method.
The Itakura-Saito distance is the Bregman divergence associated with the Gamma exponential family where the information divergence of one distribution in the family from another element in the family is given by the Itakura-Saito divergence of the mean value of the first distribution from the mean value of the second distribution.
Forecasting
Fed LiquidityFed liquidity model based on #MaxJAnderson's work. Incorporates the Treasury General Account, Reverse Repo and Fed balance sheet to determine how much "net liquidity" is available to markets. Very much a beta version.
EmirindicatorLook at the data while at the level you entered. The line below where you entered should be your Stop Loss level. The first line above it represents that you need to bring your Stop Loss level to your entry level and take some profit if you want. The top line is the sales level recommended by the program.
HPK Crash IndicatorFrom Hari P. Krishnan's book, The Second Leg Down: Strategies for Profiting after a Market Sell-Off :
"We start by specifying the year on year (YoY) change in the index. Next, we calculate the 5 year trailing Z score of the YoY returns. We also calculate the 5 year trailing Z score of 1 month historical volatility for the index, using daily returns. Our crisis warning indicator flashes if both Z scores are above 2. In other words, recent price increases and current volatility need to be at least 2 standard deviations above normal.
It can be seen that this basic implementation is reasonably effective, accepting that the effective sample set is small. A false signal is given in mid-2006, but the signal is quickly washed away. The remaining signals occur fairly close to the point of collapse. The idea that elevated volatility is predictive of danger is not new and underpins many asset allocation schemes. However, Sornette deserves credit for moving away from a largely valuation-based approach to predicting crises to one that relies upon price action itself."
Faytterro EstimatorWhat is Faytterro Estimator?
This indicator is an advanced moving average.
What it does?
This indicator is both a moving average and at the same time, it predicts the future values that the price may take based on the values it has taken before.
How it does it?
takes the weighted average of data of the selected length (reducing the weight from the middle to the ends). then draws a parabola through the last three values, creating a predicted line.
How to use it?
it is simple to use. You can use it both as a regression to review past prices, and to predict the future value of a price. uptrends are in green and downtrends are in red. color change indicates a possible trend change.
HTC_Bollinger_Band_Strategy_By_CorbachoEste indicador te da la visión del mercado y sus posibles rebotes con unas bandas de bollinger a 3 dispersiones tipicas. Añadiendo al grafico la SMA200 podemos ver si operamos a favor o en contra de la tendencia
Chervolinos-Wave-PM-ForecastThe Wave PM (Whistler Active Volatility Energy – Price Mass) indicator is an oscillator described in Mark Whistler's book, Volatility Illuminated.
The Wave PM is specifically designed to help read volatility cycles. When we visualize volatility cycles as a chart, we can get a clear view of the market volatility phases in multiple time frames. This indicator forms an arithmetic mean over 30 observed periods. Traders can thus get a better insight into "potential" volatility from up to pent-up energy, the different zones give strong help to predict future price developments.
Possible interpretation patterns:
You are at the end of a long uptrend and you want to know if the price is going to go down, if the indicator shows red and the value is above 25, it is likely to do so.
You're in a downtrend and there's a bit of a recovery phase, so you might be wondering if it's going to continue when the indicator shows green. It would go further with yellow, but with green it can be assumed that it is going down rapidly.
Special thanks to sourcey who programmed the 3D Wave-PM.
This variant of sourcey looks very nice, but was too confusing for me. In order to get a strong overview, forming an arithmetic mean is very useful.
I hope you and the Mods like my version
Best regards, Chervolino
Pivot Parallel Channel by [livetrend]This script draws parallel channels using pivot points for trend analysis.
Script draws maximum 4 parallel channels if suitable up or down trend already exists on the chart according to chosen Pivot Length and Multiplier.
You can change Multiplier to draw Higher Time Frame Channels.
Good luck!
Blockchain Fundamentals: 200 Week MA Heatmap [CR]Blockchain Fundamentals: 200 Week MA Heatmap
This is released as a thank you to all my followers who pushed me over the 600 follower mark on twitter. Thanks to all you Kingz and Queenz out there who made it happen. <3
Indicator Overview
In each of its major market cycles, Bitcoin's price historically bottoms out around the 200 week moving average.
This indicator uses a color heatmap based on the % increases of that 200 week moving average. Depending on the rolling cumulative 4 week percent delta of the 200 week moving average, a color is assigned to the price chart. This method clearly highlights the market cycles of bitcoin and can be extremely helpful to use in your forecasts.
How It Can Be Used
The long term Bitcoin investor can monitor the monthly color changes. Historically, when we see orange and red dots assigned to the price chart, this has been a good time to sell Bitcoin as the market overheats. Periods where the price dots are purple and close to the 200 week MA have historically been good times to buy.
Bitcoin Price Prediction Using This Tool
If you are looking to predict the price of Bitcoin or forecast where it may go in the future, the 200WMA heatmap can be a useful tool as it shows on a historical basis whether the current price is overextending (red dots) and may need to cool down. It can also show when Bitcoin price may be good value on a historical basis. This can be when the dots on the chart are purple or blue.
Over more than ten years, $BTC has spent very little time below the 200 week moving average which is also worth noting when thinking about price predictions for Bitcoin or a Bitcoin price forecast.
Notes
1.) If you do not want to view the legend do the following: Indicator options > Style tab > Uncheck "Tables"
2.) I use my custom function to get around the limited historical data for bitcoin. You can check out the explanation of it here:
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.
Fed Funds Rate ProjectionsThis script makes projections via drawing boxes based upon changes in the fed funds rate (FRED:EFFR).
It works by turning the change in the fed funds rate into a user defined percentage (using a multiplier, by default a 1% rate of change implies a 10% change in the chart) and then drawing a box that distance away depending on the direction of the rate of change.
The size of the multiplier should depend on the duration of the asset which this is being applied to, for example, a long duration asset such as a high beta growth stock should use a larger multiplier.
SKYtrend Bruteforce Open Source✨SKYtrend Bruteforce Now Open Source✨
📌This indicator analyzes the trend and calls Long/Short which is fully custom to fit your style of trading.
📌Custom Take Profit Levels currently have 3 TP levels for Long and Short you can decide which % each TP will be in settings.
📌2 Custom Stoploss levels. For Long or Short. Can Enable or Disable either.
📌Can set alert For Long, Short , TP Long 1-3, TP Short 1-3, SL 1-2
📌Has built in ichimoku cloud
If you like it, like it. :)
VIX - SKEW DivergenceThe CBOE VIX is a well-known index representing market expectations for volatility over the next 30 days.
The CBOE SKEW is an index reflecting the perceived tail risk over the next 30 days.
When the SKEW rises over a certain level (~140/150), that means investors are hedging their exposure with options, because they are worried about an incoming market crash or a "black swan". If that happens when the VIX is very low and apparently there is no uncertainty, this can warn of a sudden change in direction of the market. You will see for yourself that an increasing divergence often anticipates a sharp fall of leading stock indexes, usually within two to four months.
This is probably not very relevant for the short-term trader but mid/long-term traders and market analysts may find it useful to clearly visualize the extent of the distance between the VIX and the SKEW. For that reason, I wrote this highly customizable script with which you can plot the two indexes and fill the space within them with a color gradient to highlight the maximum and minimum divergence. Additionally, you can fill the beneath VIX area with four different colors. It is also possible to plot the divergence value itself, so if you want you can draw trendlines and support/resistance levels on it.
Please note that the divergence per se doesn't predict anything and it's meant to be used synergistically with other technical analysis tools.
More informations here:
www.cboe.com
www.cboe.com
Rollover LTEThis indicator shows where price needs to be and when in order to cause the 20-sma and 50-sma moving averages to change directions. A change in direction requires the slope of a moving average to change from negative to positive or from positive to negative. When a moving average changes direction, it can be said that it has “rolled over” or “rolled up,” with the latter only applying if slope went from negative to positive.
Theory:
In order to solve for the price of the current bar that will cause the moving average to roll up, the slope from the previous bar’s average to the current bar’s average must be set equal to zero which is to say that the averages must be the same.
For the 20-sma, the equation simply stated in words is as follows:
Current MA as a function of current price and previous 19 values = previous MA which is fixed based on previous 20 values
The denominators which are both 20 cancel and the previous 19 values cancel. What’s left is current price on the left side and the value from 20 bars ago on the right.
Current price = value from 20 bars ago
and since the equation was set up for solving for the price of the current bar that will cause the MA to roll over
Rollover price = value from 20 bars ago
This makes plotting rollover price, both current and forecasted, fairly simple, as it’s merely the closing price plotted with an offset to the right the same distance as the moving average length.
Application:
The 20-sma and 50-sma rollover prices are plotted because they are considered to be the two most important moving averages for rollover analysis. Moving average lengths can be modified in the indicator settings. The 20-sma and 20-sma rollover price are both plotted in white and the 50-sma and 50-sma rollover price are both plotted in blue. There are two rollover prices because the 20-sma rollover price is the price that will cause the 20-sma to roll over and the 50-sma rollover price is the price that will cause the 50-sma to roll over. The one that's vertically furthest away from the current price is the one that will cause both to rollover, as should become clearer upon reading the explanation below.
The distance between the current price and the 20-sma rollover price is referred to as the “rollover strength” of the price relative to the 20-sma. A large disparity between the current price and the rollover price suggests bearishness (negative rollover strength) if the rollover price is overhead because price would need to travel all that distance in order to cause the moving average to roll up. If the rollover price and price are converging, as is often the case, a change in moving average and price direction becomes more plausible. The rollover strengths of the 20-sma and 50-sma are added together to calculate the Rollover Strength and if a negative number is the result then the background color of the plot cloud turns red. If the result is positive, it turns green. Rollover Strength is plotted below price as a separate indicator in this publication for reference only and it's not part of this indicator. It does not look much different from momentum indicators. The code is below if anybody wants to try to use it. The important thing is that the distances between the rollover prices and the price action are kept in mind as having shrinking, growing, or neutral bearish and bullish effects on current and forecasted price direction. Trades should not be entered based on cloud colorization changes alone.
If you are about to crash into a wall of the 20-sma rollover price, as is indicated on the chart by the green arrow, you might consider going long so long as the rollover strength, both current and forecasted, of the 50-sma isn’t questionably bearish. This is subject to analysis and interpretation. There was a 20-sma rollover wall as indicated with yellow arrow, but the bearish rollover strength of the 50-sma was growing and forecasted to remain strong for a while at that time so a long entry would have not been suggested by both rollover prices. If you are about to crash into both the 20-sma and 50-sma rollover prices at the same time (not shown on this chart), that’s a good time to place a trade in anticipation of both slopes changing direction. You may, in the case of this chart, see that a 20-sma rollover wall precedes a 50-sma rollover convergence with price and anticipate a cascade which turned out to be the case with this recent NQ rally.
Price exiting the cloud entirely to either the upside or downside has strong implications. When exiting to the downside, the 20-sma and 50-sma have both rolled over and price is below both of them. The same is true for upside exits. Re-entering the cloud after a rally may indicate a reversal is near, especially if the forecasted rollover prices, particularly the 50-sma, agree.
This indicator should be used in conjunction with other technical analysis tools.
Additional Notes:
The original version of this script which will not be published was much heavier, cluttered, and is not as useful. This is the light version, hence the “LTE” suffix.
LTE stands for “long-term evolution” in telecommunications, not “light.”
Bar colorization (red, yellow, and green bars) was added using the MACD Hybrid BSH script which is another script I’ve published.
If you’re not sure what a bar is, it’s the same thing as a candle or a data point on a line chart. Every vertical line showing price action on the chart above is a bar and it is a bar chart.
sma = simple moving average
Rollover Strength Script:
// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// © Skipper86
//@version=5
indicator(title="Rollover Strength", shorttitle="Rollover Strength", overlay=false)
source = input.source(close)
length1 = input.int(20, "Length 1", minval=1)
length2 = input.int(50, "Length 2", minval=1)
RolloverPrice1 = source
RolloverPrice2 = source
RolloverStrength1 = source-RolloverPrice1
RolloverStrength2 = source-RolloverPrice2
RolloverStrength = RolloverStrength1 + RolloverStrength2
Color1 = color.rgb(155, 155, 155, 0)
Color2 = color.rgb(0, 0, 200, 0)
Color3 = color.rgb(0, 200, 0, 0)
plot(RolloverStrength, title="Rollover Strength", color=Color3)
hline(0, "Middle Band", color=Color1)
//End of Rollover Strength Script
Sushman Ticcy Toppy Percent Change MonitorSP 500 Trend Identifier, looks at top 5 SP500 stocks and shows performance of these 5 combined stocks for the day. Are they going up or down, TSLA< AAPL< MSFT<GOOGL<AMZN
Polynomial Regression Bands w/ Extrapolation of Price [Loxx]Polynomial Regression Bands w/ Extrapolation of Price is a moving average built on Polynomial Regression. This indicator paints both a non-repainting moving average and also a projection forecast based on the Polynomial Regression. I've included 33 source types and 38 moving average types to smooth the price input before it's run through the Polynomial Regression algorithm. This indicator only paints X many bars back so as to increase on screen calculation speed. Make sure to read the tooltips to answer any questions you have.
What is Polynomial Regression?
In statistics, polynomial regression is a form of regression analysis in which the relationship between the independent variable x and the dependent variable y is modeled as an nth degree polynomial in x. Polynomial regression fits a nonlinear relationship between the value of x and the corresponding conditional mean of y, denoted E(y |x). Although polynomial regression fits a nonlinear model to the data, as a statistical estimation problem it is linear, in the sense that the regression function E(y | x) is linear in the unknown parameters that are estimated from the data. For this reason, polynomial regression is considered to be a special case of multiple linear regression .
Related indicators
Polynomial-Regression-Fitted Oscillator
Polynomial-Regression-Fitted RSI
PA-Adaptive Polynomial Regression Fitted Moving Average
Poly Cycle
Fourier Extrapolator of Price w/ Projection Forecast
Nearest Neighbor Extrapolation of Price [Loxx]I wasn't going to post this because I don't like how this calculates by puling in the Open price, but I'm posting it anyway. This does work in it's current form but there is a. better way to do this. I'll revisit this in the future.
Anyway...
The k-Nearest Neighbor algorithm (k-NN) searches for k past patterns (neighbors) that are most similar to the current pattern and computes the future prices based on weighted voting of those neighbors. This indicator finds only one nearest neighbor. So, in essence, it is a 1-NN algorithm. It uses the Pearson correlation coefficient between the current pattern and all past patterns as the measure of distance between them. Also, this version of the nearest neighbor indicator gives larger weights to most recent prices while searching for the closest pattern in the past. It uses a weighted correlation coefficient, whose weight decays linearly from newer to older prices within a price pattern.
This indicator also includes an error window that shows whether the calculation is valid. If it's green and says "Passed", then the calculation is valid, otherwise it'll show a red background and and error message.
Inputs
Npast - number of past bars in a pattern;
Nfut -number of future bars in a pattern (must be < Npast).
lastbar - How many bars back to start forecast? Useful to show past prediction accuracy
barsbark - This prevents Pine from trying to calculate on all past bars
Related indicators
Hodrick-Prescott Extrapolation of Price
Itakura-Saito Autoregressive Extrapolation of Price
Helme-Nikias Weighted Burg AR-SE Extra. of Price
Weighted Burg AR Spectral Estimate Extrapolation of Price
Levinson-Durbin Autocorrelation Extrapolation of Price
Fourier Extrapolator of Price w/ Projection Forecast
Hodrick-Prescott Extrapolation of Price [Loxx]Hodrick-Prescott Extrapolation of Price is a Hodrick-Prescott filter used to extrapolate price.
The distinctive feature of the Hodrick-Prescott filter is that it does not delay. It is calculated by minimizing the objective function.
F = Sum((y(i) - x(i))^2,i=0..n-1) + lambda*Sum((y(i+1)+y(i-1)-2*y(i))^2,i=1..n-2)
where x() - prices, y() - filter values.
If the Hodrick-Prescott filter sees the future, then what future values does it suggest? To answer this question, we should find the digital low-frequency filter with the frequency parameter similar to the Hodrick-Prescott filter's one but with the values calculated directly using the past values of the "twin filter" itself, i.e.
y(i) = Sum(a(k)*x(i-k),k=0..nx-1) - FIR filter
or
y(i) = Sum(a(k)*x(i-k),k=0..nx-1) + Sum(b(k)*y(i-k),k=1..ny) - IIR filter
It is better to select the "twin filter" having the frequency-independent delay Тdel (constant group delay). IIR filters are not suitable. For FIR filters, the condition for a frequency-independent delay is as follows:
a(i) = +/-a(nx-1-i), i = 0..nx-1
The simplest FIR filter with constant delay is Simple Moving Average (SMA):
y(i) = Sum(x(i-k),k=0..nx-1)/nx
In case nx is an odd number, Тdel = (nx-1)/2. If we shift the values of SMA filter to the past by the amount of bars equal to Тdel, SMA values coincide with the Hodrick-Prescott filter ones. The exact math cannot be achieved due to the significant differences in the frequency parameters of the two filters.
To achieve the closest match between the filter values, I recommend their channel widths to be similar (for example, -6dB). The Hodrick-Prescott filter's channel width of -6dB is calculated as follows:
wc = 2*arcsin(0.5/lambda^0.25).
The channel width of -6dB for the SMA filter is calculated by numerical computing via the following equation:
|H(w)| = sin(nx*wc/2)/sin(wc/2)/nx = 0.5
Prediction algorithms:
The indicator features the two prediction methods:
Metod 1:
1. Set SMA length to 3 and shift it to the past by 1 bar. With such a length, the shifted SMA does not exist only for the last bar (Bar = 0), since it needs the value of the next future price Close(-1).
2. Calculate SMA filer's channel width. Equal it to the Hodrick-Prescott filter's one. Find lambda.
3. Calculate Hodrick-Prescott filter value at the last bar HP(0) and assume that SMA(0) with unknown Close(-1) gives the same value.
4. Find Close(-1) = 3*HP(0) - Close(0) - Close(1)
5. Increase the length of SMA to 5. Repeat all calculations and find Close(-2) = 5*HP(0) - Close(-1) - Close(0) - Close(1) - Close(2). Continue till the specified amount of future FutBars prices is calculated.
Method 2:
1. Set SMA length equal to 2*FutBars+1 and shift SMA to the past by FutBars
2. Calculate SMA filer's channel width. Equal it to the Hodrick-Prescott filter's one. Find lambda.
3. Calculate Hodrick-Prescott filter values at the last FutBars and assume that SMA behaves similarly when new prices appear.
4. Find Close(-1) = (2*FutBars+1)*HP(FutBars-1) - Sum(Close(i),i=0..2*FutBars-1), Close(-2) = (2*FutBars+1)*HP(FutBars-2) - Sum(Close(i),i=-1..2*FutBars-2), etc.
The indicator features the following inputs:
Method - prediction method
Last Bar - number of the last bar to check predictions on the existing prices (LastBar >= 0)
Past Bars - amount of previous bars the Hodrick-Prescott filter is calculated for (the more, the better, or at least PastBars>2*FutBars)
Future Bars - amount of predicted future values
The second method is more accurate but often has large spikes of the first predicted price. For our purposes here, this price has been filtered from being displayed in the chart. This is why method two starts its prediction 2 bars later than method 1. The described prediction method can be improved by searching for the FIR filter with the frequency parameter closer to the Hodrick-Prescott filter. For example, you may try Hanning, Blackman, Kaiser, and other filters with constant delay instead of SMA.
Related indicators
Itakura-Saito Autoregressive Extrapolation of Price
Helme-Nikias Weighted Burg AR-SE Extra. of Price
Weighted Burg AR Spectral Estimate Extrapolation of Price
Levinson-Durbin Autocorrelation Extrapolation of Price
Fourier Extrapolator of Price w/ Projection Forecast
Modified Covariance Autoregressive Estimator of Price [Loxx]What is the Modified Covariance AR Estimator?
The Modified Covariance AR Estimator uses the modified covariance method to fit an autoregressive (AR) model to the input data. This method minimizes the forward and backward prediction errors in the least squares sense. The input is a frame of consecutive time samples, which is assumed to be the output of an AR system driven by white noise. The block computes the normalized estimate of the AR system parameters, A(z), independently for each successive input.
Characteristics of Modified Covariance AR Estimator
Minimizes the forward prediction error in the least squares sense
Minimizes the forward and backward prediction errors in the least squares sense
High resolution for short data records
Able to extract frequencies from data consisting of p or more pure sinusoids
Does not suffer spectral line-splitting
May produce unstable models
Peak locations slightly dependent on initial phase
Minor frequency bias for estimates of sinusoids in noise
Order must be less than or equal to 2/3 the input frame size
Purpose
This indicator calculates a prediction of price. This will NOT work on all tickers. To see whether this works on a ticker for the settings you have chosen, you must check the label message on the lower right of the chart. The label will show either a pass or fail. If it passes, then it's green, if it fails, it's red. The reason for this is because the Modified Covariance method produce unstable models
H(z)= G / A(z) = G / (1+. a(2)z −1 +…+a(p+1)z)
You specify the order, "ip", of the all-pole model in the Estimation order parameter. To guarantee a valid output, you must set the Estimation order parameter to be less than or equal to two thirds the input vector length.
The output port labeled "a" outputs the normalized estimate of the AR model coefficients in descending powers of z.
The implementation of the Modified Covariance AR Estimator in this indicator is the fast algorithm for the solution of the modified covariance least squares normal equations.
Inputs
x - Array of complex data samples X(1) through X(N)
ip - Order of linear prediction model (integer)
Notable local variables
v - Real linear prediction variance at order IP
Outputs
a - Array of complex linear prediction coefficients
stop - value at time of exit, with error message
false - for normal exit (no numerical ill-conditioning)
true - if v is not a positive value
true - if delta and gamma do not lie in the range 0 to 1
true - if v is not a positive value
true - if delta and gamma do not lie in the range 0 to 1
errormessage - an error message based on "stop" parameter; this message will be displayed in the lower righthand corner of the chart. If you see a green "passed" then the analysis is valid, otherwise the test failed.
Indicator inputs
LastBar = bars backward from current bar to test estimate reliability
PastBars = how many bars are we going to analyze
LPOrder = Order of Linear Prediction, and for Modified Covariance AR method, this must be less than or equal to 2/3 the input frame size, so this number has a max value of 0.67
FutBars = how many bars you'd like to show in the future. This algorithm will either accept or reject your value input here and then project forward
Further reading
Spectrum Analysis-A Modern Perspective 1380 PROCEEDINGS OF THE IEEE, VOL. 69, NO. 11, NOVEMBER 1981
Related indicators
Levinson-Durbin Autocorrelation Extrapolation of Price
Weighted Burg AR Spectral Estimate Extrapolation of Price
Helme-Nikias Weighted Burg AR-SE Extra. of Price
Itakura-Saito Autoregressive Extrapolation of Price
Modified Covariance Autoregressive Estimator of Price
Multi Yield CurveAn inversion between the 2 year and 10 year US treasury yield generally means a recession within 2 years. But the yield curve has more to it than that. This script helps analysis of the current and past yield curve (not limited to US treasury) and is very configurable.
"A yield curve is a line that plots yields (interest rates) of bonds having equal credit quality but differing maturity dates. The slope of the yield curve gives an idea of future interest rate changes and economic activity." (Investopedia)
When the slope is upward (longer maturity bonds have a higher interest rate than shorter maturity bonds), it generally means the economy is doing well and is expanding. When the slope is downward it generally means that there is more downside risk in the future.
The more inverted the curve is, and the more the inversion moves to the front, the more market participants are hedging against downside risk in the future.
The script draws up to 4 moments of a yield curve, which makes it easy to compare the current yield curve with past yield curves. It also draws lines in red when that part of the curve is inverted.
The script draws the lines with proper length between maturity (which most scripts do not) in order to make it more representative of the real maturity duration. The width cannot be scaled because TradingView does not allow drawing based on pixels.
This script is the only free script at time of writing with proper lengths, showing multiple yield curves, and being able to show yield curves other than the US treasury.
█ CONFIGURATION
(The following can be configured by clicking "Settings" when the script is added to a chart)
By default the script is configured to show the US treasury (government bond) yields of all maturities, but it can be configured for any yield curve.
A ticker represents yield data for a specific maturity of a bond.
To configure different tickers, go to the "TICKERS" section. Tickers in this section must be ordered from low maturity to high maturity.
• Enable: draw the ticker on the chart.
• Ticker: ticker symbol on TradingView to fetch data for.
• Months: amount of months of bond maturity the ticker represents.
To configure general settings, go to the "GENERAL" section.
• Period: used for calculating how far back to look for data for past yield curve lines. See "Times back" further in this description for more info.
• Min spacing: minimum amount of spacing between labels. Depending on the size of the screen, value labels can overlap. This setting sets how much empty space there must be between labels.
• Value format: how the value at that part of the line should be written on the label. For example, 0.000 means the value will have 3 digits precision.
To configure line settings per yield curve, each has its own "LINE" section with the line number after it.
• Enable: whether to enable drawing of this line.
• Times back: how many times period to go back in time. When period is D, and times value is 2, the line will be of data from 2 days ago.
• Color: color of the line when not inverted.
• Style: style of the line. Possible values: sol, dsh, dot
• Inversion color: color of the line when the curve inverses between the two maturities at that part of the curve.
• Thickness: thickness of the line in pixels.
• Labels: whether to draw value labels above the line. By default, this is only enabled for the first line.
• Label text color: text color of value label.
• Label background color: background color of value label.
To configure the durations axis at the bottom of the chart, go to the "DURATIONS" section.
• Durations: whether to show maturity term duration labels below the chart.
• Offset: amount to offset durations label to be below chart.
█ MISC
Script originally inspired by the US Treasury Yield Curve script by @longfiat but has been completely rewritten and changed.
Moon Phases/Apogee & Perigee/Eclipses/North Node by BTThis script helps us to display date of different lunar properties on price chart. Simply following items could be used to see dates.
New moon
Full moon
Apogee
Perigee
North node
I've used following web site (fourmilab.ch) for obtaining exact dates, according to web site "All dates and times are Universal time (UTC); to convert to local time add or subtract the difference between your time zone and UTC"
Itakura-Saito Autoregressive Extrapolation of Price [Loxx]Itakura-Saito Autoregressive Extrapolation of Price is an indicator that uses an autoregressive analysis to predict future prices. This is a linear technique that was originally derived or speech analysis algorithms.
What is Itakura-Saito Autoregressive Analysis?
The technique of linear prediction has been available for speech analysis since the late 1960s (Itakura & Saito, 1973a, 1970; Atal & Hanauer, 1971), although the basic principles were established long before this by Wiener (1947). Linear predictive coding, which is also known as autoregressive analysis, is a time-series algorithm that has applications in many fields other than speech analysis (see, e.g., Chatfield, 1989).
Itakura and Saito developed a formulation for linear prediction analysis using a lattice form for the inverse filter. The Itakura–Saito distance (or Itakura–Saito divergence) is a measure of the difference between an original spectrum and an approximation of that spectrum. Although it is not a perceptual measure it is intended to reflect perceptual (dis)similarity. It was proposed by Fumitada Itakura and Shuzo Saito in the 1960s while they were with NTT. The distance is defined as: The Itakura–Saito distance is a Bregman divergence, but is not a true metric since it is not symmetric and it does not fulfil triangle inequality.
read more: Selected Methods for Improving Synthesis Speech Quality Using Linear Predictive Coding: System Description, Coefficient Smoothing and Streak
Data inputs
Source Settings: -Loxx's Expanded Source Types. You typically use "open" since open has already closed on the current active bar
LastBar - bar where to start the prediction
PastBars - how many bars back to model
LPOrder - order of linear prediction model; 0 to 1
FutBars - how many bars you want to forward predict
Things to know
Normally, a simple moving average is calculated on source data. I've expanded this to 38 different averaging methods using Loxx's Moving Avreages.
This indicator repaints
Related Indicators (linear extrapolation of price)
Levinson-Durbin Autocorrelation Extrapolation of Price
Weighted Burg AR Spectral Estimate Extrapolation of Price
Helme-Nikias Weighted Burg AR-SE Extra. of Price
Helme-Nikias Weighted Burg AR-SE Extra. of Price [Loxx]Helme-Nikias Weighted Burg AR-SE Extra. of Price is an indicator that uses an autoregressive spectral estimation called the Weighted Burg Algorithm, but unlike the usual WB algo, this one uses Helme-Nikias weighting. This method is commonly used in speech modeling and speech prediction engines. This is a linear method of forecasting data. You'll notice that this method uses a different weighting calculation vs Weighted Burg method. This new weighting is the following:
w = math.pow(array.get(x, i - 1), 2), the squared lag of the source parameter
and
w += math.pow(array.get(x, i), 2), the sum of the squared source parameter
This take place of the rectangular, hamming and parabolic weighting used in the Weighted Burg method
Also, this method includes Levinson–Durbin algorithm. as was already discussed previously in the following indicator:
Levinson-Durbin Autocorrelation Extrapolation of Price
What is Helme-Nikias Weighted Burg Autoregressive Spectral Estimate Extrapolation of price?
In this paper a new stable modification of the weighted Burg technique for autoregressive (AR) spectral estimation is introduced based on data-adaptive weights that are proportional to the common power of the forward and backward AR process realizations. It is shown that AR spectra of short length sinusoidal signals generated by the new approach do not exhibit phase dependence or line-splitting. Further, it is demonstrated that improvements in resolution may be so obtained relative to other weighted Burg algorithms. The method suggested here is shown to resolve two closely-spaced peaks of dynamic range 24 dB whereas the modified Burg schemes employing rectangular, Hamming or "optimum" parabolic windows fail.
Data inputs
Source Settings: -Loxx's Expanded Source Types. You typically use "open" since open has already closed on the current active bar
LastBar - bar where to start the prediction
PastBars - how many bars back to model
LPOrder - order of linear prediction model; 0 to 1
FutBars - how many bars you want to forward predict
Things to know
Normally, a simple moving average is calculated on source data. I've expanded this to 38 different averaging methods using Loxx's Moving Avreages.
This indicator repaints
Further reading
A high-resolution modified Burg algorithm for spectral estimation
Related Indicators
Levinson-Durbin Autocorrelation Extrapolation of Price
Weighted Burg AR Spectral Estimate Extrapolation of Price