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
Forecasting
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
Weighted Burg AR Spectral Estimate Extrapolation of Price [Loxx]Weighted Burg AR Spectral Estimate Extrapolation of Price is an indicator that uses an autoregressive spectral estimation called the Weighted Burg Algorithm. This method is commonly used in speech modeling and speech prediction engines. This method also includes Levinson–Durbin algorithm. As was already discussed previously in the following indicator:
Levinson-Durbin Autocorrelation Extrapolation of Price
What is Levinson recursion or Levinson–Durbin recursion?
In many applications, the duration of an uninterrupted measurement of a time series is limited. However, it is often possible to obtain several separate segments of data. The estimation of an autoregressive model from this type of data is discussed. A straightforward approach is to take the average of models estimated from each segment separately. In this way, the variance of the estimated parameters is reduced. However, averaging does not reduce the bias in the estimate. With the Burg algorithm for segments, both the variance and the bias in the estimated parameters are reduced by fitting a single model to all segments simultaneously. As a result, the model estimated with the Burg algorithm for segments is more accurate than models obtained with averaging. The new weighted Burg algorithm for segments allows combining segments of different amplitudes.
The Burg algorithm estimates the AR parameters by determining reflection coefficients that minimize the sum of for-ward and backward residuals. The extension of the algorithm to segments is that the reflection coefficients are estimated by minimizing the sum of forward and backward residuals of all segments taken together. This means a single model is fitted to all segments in one time. This concept is also used for prediction error methods in system identification, where the input to the system is known, like in ARX modeling
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
BurgWin - weighing function index, rectangular, hamming, or parabolic
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
Included
Bar color muting
Further reading
Performance of the weighted burg methods of ar spectral estimation for pitch-synchronous analysis of voiced speech
The Burg algorithm for segments
Techniques for the Enhancement of Linear Predictive Speech Coding in Adverse Conditions
Related Indicators
Levinson-Durbin Autocorrelation Extrapolation of Price [Loxx]Levinson-Durbin Autocorrelation Extrapolation of Price is an indicator that uses the Levinson recursion or Levinson–Durbin recursion algorithm to predict price moves. This method is commonly used in speech modeling and prediction engines.
What is Levinson recursion or Levinson–Durbin recursion?
Is a linear algebra prediction analysis that is performed once per bar using the autocorrelation method with a within a specified asymmetric window. The autocorrelation coefficients of the window are computed and converted to LP coefficients using the Levinson algorithm. The LP coefficients are then transformed to line spectrum pairs for quantization and interpolation. The interpolated quantized and unquantized filters are converted back to the LP filter coefficients to construct the synthesis and weighting filters for each bar.
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 caculated on source data. I've expanded this to 38 different averaging methods using Loxx's Moving Avreages.
This indicator repaints
Included
Bar color muting
Further reading
Implementing the Levinson-Durbin Algorithm on the StarCore™ SC140/SC1400 Cores
LevinsonDurbin_G729 Algorithm, Calculates LP coefficients from the autocorrelation coefficients. Intel® Integrated Performance Primitives for Intel® Architecture Reference Manual
Fourier Extrapolator of Variety RSI w/ Bollinger Bands [Loxx]Fourier Extrapolator of Variety RSI w/ Bollinger Bands is an RSI indicator that shows the original RSI, the Fourier Extrapolation of RSI in the past, and then the projection of the Fourier Extrapolated RSI for the future. This indicator has 8 different types of RSI including a new type of RSI called T3 RSI. The purpose of this indicator is to demonstrate the Fourier Extrapolation method used to model past data and to predict future price movements. This indicator will repaint. If you wish to use this for trading, then make sure to take a screenshot of the indicator when you enter the trade to save your analysis. This is the first of a series of forecasting indicators that can be used in trading. Due to how this indicator draws on the screen, you must choose values of npast and nfut that are equal to or less than 200. this is due to restrictions by TradingView and Pine Script in only allowing 500 lines on the screen at a time. Enjoy!
What is Fourier Extrapolation?
This indicator uses a multi-harmonic (or multi-tone) trigonometric model of a price series xi, i=1..n, is given by:
xi = m + Sum( a*Cos(w*i) + b*Sin(w*i), h=1..H )
Where:
xi - past price at i-th bar, total n past prices;
m - bias;
a and b - scaling coefficients of harmonics;
w - frequency of a harmonic ;
h - harmonic number;
H - total number of fitted harmonics.
Fitting this model means finding m, a, b, and w that make the modeled values to be close to real values. Finding the harmonic frequencies w is the most difficult part of fitting a trigonometric model. In the case of a Fourier series, these frequencies are set at 2*pi*h/n. But, the Fourier series extrapolation means simply repeating the n past prices into the future.
This indicator uses the Quinn-Fernandes algorithm to find the harmonic frequencies. It fits harmonics of the trigonometric series one by one until the specified total number of harmonics H is reached. After fitting a new harmonic , the coded algorithm computes the residue between the updated model and the real values and fits a new harmonic to the residue.
see here: A Fast Efficient Technique for the Estimation of Frequency , B. G. Quinn and J. M. Fernandes, Biometrika, Vol. 78, No. 3 (Sep., 1991), pp . 489-497 (9 pages) Published By: Oxford University Press
The indicator has the following input parameters:
src - input source
npast - number of past bars, to which trigonometric series is fitted;
Nfut - number of predicted future bars;
nharm - total number of harmonics in model;
frqtol - tolerance of frequency calculations.
Included:
Loxx's Expanded Source Types
Loxx's Variety RSI
Other indicators using this same method
Fourier Extrapolator of Price w/ Projection Forecast
Fourier Extrapolator of Price
Fourier Extrapolator of Price w/ Projection Forecast [Loxx]Due to popular demand, I'm pusblishing Fourier Extrapolator of Price w/ Projection Forecast.. As stated in it's twin indicator, this one is also multi-harmonic (or multi-tone) trigonometric model of a price series xi, i=1..n, is given by:
xi = m + Sum( a*Cos(w*i) + b*Sin(w*i), h=1..H )
Where:
xi - past price at i-th bar, total n past prices;
m - bias;
a and b - scaling coefficients of harmonics;
w - frequency of a harmonic ;
h - harmonic number;
H - total number of fitted harmonics.
Fitting this model means finding m, a, b, and w that make the modeled values to be close to real values. Finding the harmonic frequencies w is the most difficult part of fitting a trigonometric model. In the case of a Fourier series, these frequencies are set at 2*pi*h/n. But, the Fourier series extrapolation means simply repeating the n past prices into the future.
This indicator uses the Quinn-Fernandes algorithm to find the harmonic frequencies. It fits harmonics of the trigonometric series one by one until the specified total number of harmonics H is reached. After fitting a new harmonic , the coded algorithm computes the residue between the updated model and the real values and fits a new harmonic to the residue.
see here: A Fast Efficient Technique for the Estimation of Frequency , B. G. Quinn and J. M. Fernandes, Biometrika, Vol. 78, No. 3 (Sep., 1991), pp . 489-497 (9 pages) Published By: Oxford University Press
The indicator has the following input parameters:
src - input source
npast - number of past bars, to which trigonometric series is fitted;
Nfut - number of predicted future bars;
nharm - total number of harmonics in model;
frqtol - tolerance of frequency calculations.
The indicator plots two curves: the green/red curve indicates modeled past values and the yellow/fuchsia curve indicates the modeled future values.
The purpose of this indicator is to showcase the Fourier Extrapolator method to be used in future indicators.
Fourier Extrapolator of Price [Loxx]Fourier Extrapolator of Price is a multi-harmonic (or multi-tone) trigonometric model of a price series xi, i=1..n, is given by:
xi = m + Sum( a *Cos(w *i) + b *Sin(w *i), h=1..H )
Where:
xi - past price at i-th bar, total n past prices;
m - bias;
a and b - scaling coefficients of harmonics;
w - frequency of a harmonic;
h - harmonic number;
H - total number of fitted harmonics.
Fitting this model means finding m, a , b , and w that make the modeled values to be close to real values. Finding the harmonic frequencies w is the most difficult part of fitting a trigonometric model. In the case of a Fourier series, these frequencies are set at 2*pi*h/n. But, the Fourier series extrapolation means simply repeating the n past prices into the future.
This indicator uses the Quinn-Fernandes algorithm to find the harmonic frequencies. It fits harmonics of the trigonometric series one by one until the specified total number of harmonics H is reached. After fitting a new harmonic, the coded algorithm computes the residue between the updated model and the real values and fits a new harmonic to the residue.
see here: A Fast Efficient Technique for the Estimation of Frequency , B. G. Quinn and J. M. Fernandes, Biometrika, Vol. 78, No. 3 (Sep., 1991), pp. 489-497 (9 pages) Published By: Oxford University Press
The indicator has the following input parameters:
src - input source
npast - number of past bars, to which trigonometric series is fitted;
nharm - total number of harmonics in model;
frqtol - tolerance of frequency calculations.
The indicator plots the modeled past values
The purpose of this indicator is to showcase the Fourier Extrapolator method to be used in future indicators. While this method can also prediction future price movements, for our purpose here we will avoid doing.
R19 STRATEGYHello again.
Let me introduce you R19 Strategy I wrote for mostly BTC long/short signals
This is an upgrated version of STRATEGY R18 F BTC strategy.
I checked this strategy on different timeframes and different assest and found it very usefull for BTC 1 Hour and 5 minutes chart.
Strategy is basically takes BTC/USDT as a main indicator, so you can apply this strategy to all cryptocurrencies as they mostly acts accordingly with BTC itself (Of course you can change main indicator to different assets if you think that there is a positive corelation with. i.e. for BTC signals you can sellect DXY index for main indicator to act for BTC long/short signals)
Default variables of the inticator is calibrated to BTC/USDT 5 minute chart. I gained above %77 success.
Strategy simply uses, ADX, MACD, SMA, Fibo, RSI combination and opens positions accordingly. Timeframe variable is very important that, strategy decides according the timeframe you've sellected but acts within the timeframe in the chart. For example, if you're on the 5 minutes chart, but you've selected 1 hour for the time frame variable, strategy looks for 1 hour MACD crossover for opening a position, but this happens in 5 minutes candle, It acts quickly and opens the position.
Strategy also uses a trailing stop loss feature. You can determine max stoploss, at which point trailing starts and at which distance trailing follows. The green and red lines will show your stoploss levels according to the position strategy enters (green for long, red for short stop loss levels). When price exceeds to the certaing levels of success, stop loss goes with the profitable price (this means, when strategy opens a position, you can put your stop loss to the green/red line in actual trading)
You can fine tune strategy to all assets.
Please write down your comments if you get more successfull about different time zones and different assets. And please tell me your fine tuning levels of this strategy as well.
See you all.
Breakout Probability (Expo)█ Overview
Breakout Probability is a valuable indicator that calculates the probability of a new high or low and displays it as a level with its percentage. The probability of a new high and low is backtested, and the results are shown in a table— a simple way to understand the next candle's likelihood of a new high or low. In addition, the indicator displays an additional four levels above and under the candle with the probability of hitting these levels.
The indicator helps traders to understand the likelihood of the next candle's direction, which can be used to set your trading bias.
█ Calculations
The algorithm calculates all the green and red candles separately depending on whether the previous candle was red or green and assigns scores if one or more lines were reached. The algorithm then calculates how many candles reached those levels in history and displays it as a percentage value on each line.
█ Example
In this example, the previous candlestick was green; we can see that a new high has been hit 72.82% of the time and the low only 28.29%. In this case, a new high was made.
█ Settings
Percentage Step
The space between the levels can be adjusted with a percentage step. 1% means that each level is located 1% above/under the previous one.
Disable 0.00% values
If a level got a 0% likelihood of being hit, the level is not displayed as default. Enable the option if you want to see all levels regardless of their values.
Number of Lines
Set the number of levels you want to display.
Show Statistic Panel
Enable this option if you want to display the backtest statistics for that a new high or low is made. (Only if the first levels have been reached or not)
█ Any Alert function call
An alert is sent on candle open, and you can select what should be included in the alert. You can enable the following options:
Ticker ID
Bias
Probability percentage
The first level high and low price
█ How to use
This indicator is a perfect tool for anyone that wants to understand the probability of a breakout and the likelihood that set levels are hit.
The indicator can be used for setting a stop loss based on where the price is most likely not to reach.
The indicator can help traders to set their bias based on probability. For example, look at the daily or a higher timeframe to get your trading bias, then go to a lower timeframe and look for setups in that direction.
-----------------
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!
Chervolinos_Rob Hoffman_Inventory Retracement Bar_and_OverlayHere is something like a combo from the well known Rob Hoffman (Overlay) Indicator and the Inventory Retracement Bar without any ballast
This really smart strategy with a low risk and a quick profit. I combine this two Indicators to save space.
The first condition is that the orange line and the lime line must be parallel and there is no other line between them because this condition is moving under 45 angle.
The second condition is that the target candles must be below the orange line in the case of the downtrend as we see.
As we see it here in the case of an uptrend should be candles above the orange line and this is logical as we see here.
Sometimes we noticed the appearance of the signal onto the candle but the conditions were not applicable because there is an orange line between the green line and the orange line and this means that the signal is fake.
This candle is also good for entry and we can place a buy order above it but is it beginner, so you must respect the conditions in order to be able to master it very well.
Enter with Confidence all conditions are present a red arrow above the candle and the candle is above the orange line and there are no lines between the lime and
orange line. Yes this is our target the entry-point will be a little above the wicked the candle, that is you will not buy now but it's a price exceeds the weight limit
even slightly, we will buy directly it is hoffman's method. Expected if the price in which resistance occurred which is the resistance represented
by the candlewick will be broken the price for rise up and strongly and if it does not happen you will not lose anything anyway to stop loss and take profit. Try the ratio by 1,5.
This part of this strategy is one of the best trading strategies with a low risk rate and can be used as an initial guide to know the market movement and to enter successful trades.
Let's start correctly. This strategy can be used on any time frame from one minute to one day or even more, but I recommend using it on a 10-minute frame one hour or 30 minutes frame. Here I use the 30-Minute frame.
This strategy is based on two things: Tramp Direction and the inventory retracement bar. Don't worry and don't think about it because all this will be automatic but let's understand some simple terms.
There many arrows in green and red. Please read the discription above.
Please read the following tipps:
To avoid the trend Reversal, try to add one one of the Divergence indicators to your chart.
To avoid entering in a pullback movement as much as possible.
--> Combine it with other indicators <--
Best Regards Chervolino
if there were any typographical errors, please forgive me
Note: Buy/Sell signals using non-standard chart types (Heikin Ashi, Renko, Kagi, Point & Figure, and Range) are not allowed, as they produce unrealistic results
EuroDollar Curve Implied 3M RateChart shows the Eurodollar futures prices latest prices from Sep 22 onwards. Display logic based on LongFiats code. This needs to be readjusted manually every 3 months whenever the front-month expires. Good tool to see where professional eurodollar futures think interest rates will be over the next few years. Check regularly as sentiment changes.
CDC Action Zone + 3MA Edited by Chayo// Edit from CDC Action Zone V3 2020
// Thanks you very much piriya33
Machete Trading® - L&SSearch for buy zone and sell zone for long and short trades.
Add Machete Formation script to your analysis for me precision.
Historical US Bond Yield CurvePreface: I'm just the bartender serving today's freshly blended concoction; I'd like to send a massive THANK YOU to all the coders and PineWizards for the locally-sourced ingredients. I am simply a code editor, not a code author. Many thanks to these original authors!
Source 1 (Aug 8, 2019):
Source 2 (Aug 11, 2019):
About the Indicator: The term yield curve refers to the yields of U.S. treasury bills, notes, and bonds in order from shortest to longest maturity date. The yield curve describes the shapes of the term structures of interest rates and their respective terms to maturity in years. The slope of the yield curve tells us how the bond market expects short-term interest rates to move in the future based on bond traders' expectations about economic activity and inflation. The best use of the yield curve is to get a sense of the economy's direction rather than to try to make an exact prediction. This indicator plots the U.S. yield curve as maturity (x-axis/time) vs yield (y-axis/price) in addition to historical yield curves and advanced data tickers . The visual array of historical yield curves helps investors visualize shifts in the yield curve that are useful when identifying & forecasting economic conditions. The bond market can help predict the direction of the economy which can be useful in crafting your investment strategy. An inverted 10y/2y yield curve for durations longer than 5 consecutive trading days signals an almost certain recession on the horizon. An inversion happens when short-term bonds pay better than longer-term bonds. There is Federal Reserve Board data that suggests the 10y3m may be a better predictor of recessions.
Features: Advanced dual data ticker that performs curve & important spread analysis, plus additional hover info. Advanced yield curve data labels with additional hover info. Customizable historical curves and color theme.
‼ IMPORTANT: Hover over labels/tables for advanced information. Chart asset and timeframe may affect the yield curve results; I have found consistently accurate results using BINANCE:BTCUSDT on 1d timeframe. Historical curve lookbacks will have an effect on whether the curve analysis says the curve is bull/bear steepening/flattening, so please use appropriate lookbacks.
⚠ DISCLAIMER: Not financial advice. Not a trading system. DYOR. I am not affiliated with the original authors, TradingView, Binance, or the Federal Reserve Board.
About the Editor: I am a former FINRA Registered Representative, inventor/patent holder, futures trader, and hobby PineScripter.
.srb suite Fib Retracement neoSPECIAL TOOLS - Auto Fibonacci Retracement neo - New GUI
designed for use with open-source indicator
'built-in auto FBR ' has been re-born
It shows - retracement Max top/ min bottom ; for higher visibility
It shows - current retracement position ; for higher visibility
The display of the Fib position that exceeds the regular range is auto-determined according to the price.
Fib.Retracement core is from tradingview built-in FBR ---> upgrade new-type GUI, and performance tuned.
.srb suiteThe essential suite Indicator.
that are well integrated to ensure visibility of essential items for trading.
it is very cumbersome to put symbol in the Tradingview chart and combine essential individual indicators one by one.
Moreover even with such a combination, the chart is messy and visibility is not good.
This is because each indicator is not designed with the others in mind.
This suite was developed as a composite-solution to that situation, and will make you happy.
designed to work in the same pane with open-source indicator by default.
Recommended visual order ; Back = .srb suite, Front = .srb suite vol & info
individually turn on/off only what you need on the screen.
BTC-agg. Volume
4 BTC-spot & 4 BTC-PERP volume aggregated.
It might helps you don't miss out on important volume flows.
Weighted to spot trading volume when using PERP+spot volume .
If enabled, BTC-agg.Vol automatically applied when selecting BTC-pair.
--> This is used in calculations involving volumes, such as VWAP.
Moving Average
1 x JMA trend ribbon ; Accurately follow short-term trend changes.
3 x EMA ribbon ; zone , not the line.
MA extension line ; It provide high visibility to recognize the direction of the MA.
SPECIAL TOOLS
VWAP with Standard Deviation Bands
VWAP ruler
BB regular (Dev. 2.0, 2.5)
BB Extented (Dev. 2.5, 3.0, 3.5)
Fixed Range Volume Profile ; steamlined one, performace tuned & update.
SPECIAL TOOLS - Auto Fibonacci Retracement - New GUI
'built-in auto FBR ' has been re-born
It shows - retracement Max top/ min bottom ; for higher visibility
It shows - current retracement position ; for higher visibility
The display of the Fib position that exceeds the regular range is auto-determined according to the price.
tradingview | chart setting > Appearance > Top margin 0%, Bottom margin 0% for optimized screen usage
tradingview | chart setting > Appearance > Right margin 57
.srb suite vol & info --> Visual Order > Bring to Front
.srb suite vol & info --> Pin to scale > No scale (Full-screen)
Visual order ; Back = .srb suite, Front = .srb suite vol & info
1. Fib.Retracement core is from tradingview built-in FBR ---> upgrade new-type GUI, and performance tuned.
2. Fixed-range volume-profile core is from the open-source one ---> some update & perf.tuned.
---------------------------------------------------------------------------------------------------------------------------------------
if you have any questions freely contact to me by message on tradingview.
but please understand that responses may be quite late.
Special thanks to all of contributors of community.
The script may be freely distributed under the MIT license.
Elliott Wave 3 FinderThis script will attempt to find the location of the third wave in the Elliot Wave Theory. The bars will become highlighted when possible wave 3 criteria is met. Multiple bars in a row may have a painted background. The point at which the bars are no longer painted will potentially be at or near the end of wave 3.
The background paints a baby blue for wave 3s in an overall uptrend, and pink for downtrends.
Deep FinderThis indicator shows you the most convenient buying times. It helps you lower your average and earn high profits by purchasing incrementally.