Pi - Intraday High-Low Predictor
Pi - Intraday High-Low Predictor
This is not my Strategy/Research , I've just coded it into a indicator.
I found it interesting & useful so I'm sharing it here.
This Strategy/Research is by Kshirod Chandra Mohanty ( y-o-u-t-u-b-e : Trade with IITIAN )
You can watch his video on y-o-u-t-u-b-e for more info on this one.
the video has following title :
"1Cr Paid Strategy For Free || 10000 Subscribers Special Giveaway || How to find Day High or Low"
This will not tell you which is day high or day low, but it will help you to predict the day high from a day low and day low from a day high.
It will give you a possible range to which the prices could move to.
He has explained/used this on Banknifty.
How to Find out Day High from Day Low & Day Low from Day High :-
He uses the value of Pi (3.14) and the Range of 1st 5minute candle to find out the possible highs from day low and the possible lows from day high.
Range = value of Pi * 1st 5minutes Range
Small range = Range / 2
Large range = Range + Small range
so to find out the possible lows from day high we do following calculations
Small range low = day high - Small range
Range low = day high - Range
Large range low = day high - Large range
and to find out the possible highs from day low we do following calculations
Small range high = day low + Small range
Range high = day low + Range
Large range high = day low + Large range
Note :- This Indicator does Repaint in following ways,
As the script uses the Day High to predict the possible lows ,
so if it's an up-trending day and price keeps on making new High's then the ranges for lows will keep on changing.
similarly the script uses the Day Low to predict the possible high's ,
so if it's an down-trending day and price keeps on making new Low's then the ranges for highs will keep on changing.
My observations / thoughts about this :-
This script does not provide buy/sell recommendations. it just provides possible ranges to where prices can go from Day-High & Day-Low.
It's better to avoid trading when the price is trading between the Small range high & Small range low levels.
As it has high probability that it will be a range bound day and price will stay in between those two levels.
There is a high probability that it will be a trending day if price breaks either the Small range high/low ,
then the price could move to Range low/high.
If price breaks from Range High/Low then there is a high probability that it will be a trending day and the price could move to Large Range low/high.
Note :- If you want to use this on instruments/scripts/indexes which are active for large session such as forex/cryptos , then i suggest that you use the Opening Range period of 4Hours i.e 240minutes, to get better results.
using the default setting of 5minutes will not give good results on them.
play around with this value to find out which one suits that instrument/script/index the best.
Don't trust these levels blindly, do backtest or live testing of this then use for real trade if you want.
Use Price action near these levels to make any trading decision's.
The script provides following options :
1. Option to display Ranges in a Table (which you can enable/hide as you wish)
You can set the Table's location, size , background color & text color according to your preference.
2. Option to enable/hide Predicted-Highs from Day-Low on chart.
3. Option to enable/hide Predicted-Lows from Day-High on chart.
4. Option to set the Opening range period - here you can select your preferred opening range for calculation purpose.
5. Option to enable/hide historical levels on chart.
6. Options to customize the colors & line styles for lines.
7. Options to customize the colors , position & size for labels.
Predictor
Pocket Pivot with extrapolated Volume and Moving AveragesThe script shows historical pocket pivots, much as other scripts with a green diamond shape on the volume pane.
When the market is open, the current bar, however, is extrapolated to the end of the day using a sixth-order polynomial.
Thus real-time pocket pivots are shown. To work properly, the user must input a time-zone offset parameter; the default is west coast USA.
Time-zone offset is -12 hours to +12 hours compared to the NYSE exchange time zone (USA west coast: -3.)
The volume extrapolation polynomial is based on a historical NASDAQ intraday volume model developed locally by a team.
Only ten-day lookback pocket pivots are computed as defined initially by Dr. Chris Kacher. (The default lookback can be changed by the user.)
Only pocket pivots are shown where the low of the daily bar is within user-defined proximity to the 50-day moving average or 10-day moving average (for continuation pocket pivots.)
Ehlers Two-Pole Predictor [Loxx]Ehlers Two-Pole Predictor is a new indicator by John Ehlers . The translation of this indicator into PineScript™ is a collaborative effort between @cheatcountry and I.
The following is an excerpt from "PREDICTION" , by John Ehlers
Niels Bohr said “Prediction is very difficult, especially if it’s about the future.”. Actually, prediction is pretty easy in the context of technical analysis . All you have to do is to assume the market will behave in the immediate future just as it has behaved in the immediate past. In this article we will explore several different techniques that put the philosophy into practice.
LINEAR EXTRAPOLATION
Linear extrapolation takes the philosophical approach quite literally. Linear extrapolation simply takes the difference of the last two bars and adds that difference to the value of the last bar to form the prediction for the next bar. The prediction is extended further into the future by taking the last predicted value as real data and repeating the process of adding the most recent difference to it. The process can be repeated over and over to extend the prediction even further.
Linear extrapolation is an FIR filter, meaning it depends only on the data input rather than on a previously computed value. Since the output of an FIR filter depends only on delayed input data, the resulting lag is somewhat like the delay of water coming out the end of a hose after it supplied at the input. Linear extrapolation has a negative group delay at the longer cycle periods of the spectrum, which means water comes out the end of the hose before it is applied at the input. Of course the analogy breaks down, but it is fun to think of it that way. As shown in Figure 1, the actual group delay varies across the spectrum. For frequency components less than .167 (i.e. a period of 6 bars) the group delay is negative, meaning the filter is predictive. However, the filter has a positive group delay for cycle components whose periods are shorter than 6 bars.
Figure 1
Here’s the practical ramification of the group delay: Suppose we are projecting the prediction 5 bars into the future. This is fine as long as the market is continued to trend up in the same direction. But, when we get a reversal, the prediction continues upward for 5 bars after the reversal. That is, the prediction fails just when you need it the most. An interesting phenomenon is that, regardless of how far the extrapolation extends into the future, the prediction will always cross the signal at the same spot along the time axis. The result is that the prediction will have an overshoot. The amplitude of the overshoot is a function of how far the extrapolation has been carried into the future.
But the overshoot gives us an opportunity to make a useful prediction at the cyclic turning point of band limited signals (i.e. oscillators having a zero mean). If we reduce the overshoot by reducing the gain of the prediction, we then also move the crossing of the prediction and the original signal into the future. Since the group delay varies across the spectrum, the effect will be less effective for the shorter cycles in the data. Nonetheless, the technique is effective for both discretionary trading and automated trading in the majority of cases.
EXPLORING THE CODE
Before we predict, we need to create a band limited indicator from which to make the prediction. I have selected a “roofing filter” consisting of a High Pass Filter followed by a Low Pass Filter. The tunable parameter of the High Pass Filter is HPPeriod. Think of it as a “stone wall filter” where cycle period components longer than HPPeriod are completely rejected and cycle period components shorter than HPPeriod are passed without attenuation. If HPPeriod is set to be a large number (e.g. 250) the indicator will tend to look more like a trending indicator. If HPPeriod is set to be a smaller number (e.g. 20) the indicator will look more like a cycling indicator. The Low Pass Filter is a Hann Windowed FIR filter whose tunable parameter is LPPeriod. Think of it as a “stone wall filter” where cycle period components shorter than LPPeriod are completely rejected and cycle period components longer than LPPeriod are passed without attenuation. The purpose of the Low Pass filter is to smooth the signal. Thus, the combination of these two filters forms a “roofing filter”, named Filt, that passes spectrum components between LPPeriod and HPPeriod.
Since working into the future is not allowed in EasyLanguage variables, we need to convert the Filt variable to the data array XX. The data array is first filled with real data out to “Length”. I selected Length = 10 simply to have a convenient starting point for the prediction. The next block of code is the prediction into the future. It is easiest to understand if we consider the case where count = 0. Then, in English, the next value of the data array is equal to the current value of the data array plus the difference between the current value and the previous value. That makes the prediction one bar into the future. The process is repeated for each value of count until predictions up to 10 bars in the future are contained in the data array. Next, the selected prediction is converted from the data array to the variable “Prediction”. Filt is plotted in Red and Prediction is plotted in yellow.
The Predict Extrapolation indicator is shown below for the Emini S&P Futures contract using the default input parameters. Filt is plotted in red and Predict is plotted in yellow. The crossings of the Predict and Filt lines provide reliable buy and sell timing signals. There is some overshoot for the shorter cycle periods, for example in February and March 2021, but the only effect is a late timing signal. Further reducing the gain and/or reducing the BarsFwd inputs would provide better timing signals during this period.
Figure 2. Predict Extrapolation Provides Reliable Timing Signals
I have experimented with other FIR filters for predictions, but found none that had a significant advantage over linear extrapolation.
MESA
MESA is an acronym for Maximum Entropy Spectral Analysis. Conceptually, it removes spectral components until the residual is left with maximum entropy. It does this by forming an all-pole filter whose order is determined by the selected number of coefficients. It maximally addresses the data within the selected window and ignores all other data. Its resolution is determined only by the number of filter coefficients selected. Since the resulting filter is an IIR filter, a prediction can be formed simply by convolving the filter coefficients with the data. MESA is one of the few, if not the only way to practically determine the coefficients of a higher order IIR filter. Discussion of MESA is beyond the scope of this article.
TWO POLE IIR FILTER
While the coefficients of a higher order IIR filter are difficult to compute without MESA, it is a relatively simple matter to compute the coefficients of a two pole IIR filter.
(Skip this paragraph if you don’t care about DSP) We can locate the conjugate pole positions parametrically in the Z plane in polar coordinates. Let the radius be QQ and the principal angle be 360 / P2Period. The first order component is 2*QQ*Cosine(360 / P2Period) and the second order component is just QQ2. Therefore, the transfer response becomes:
H(z) = 1 / (1 - 2*QQ*Cosine(360 / P2Period)*Z-1 + QQ2*Z-2)
By mixing notation we can easily convert the transfer response to code.
Output / Input = 1 / (1 - 2*QQ*Cosine(360 / P2Period)* + QQ2* )
Output - 2*QQ*Cosine(360 / P2Period)*Output + QQ2*Output = Input
Output = Input + 2*QQ*Cosine(360 / P2Period)*Output - QQ2*Output
The Two Pole Predictor starts by computing the same “roofing filter” design as described for the Linear Extrapolation Predictor. The HPPeriod and LPPeriod inputs adjust the roofing filter to obtain the desired appearance of an indicator. Since EasyLanguage variables cannot be extended into the future, the prediction process starts by loading the XX data array with indicator data up to the value of Length. I selected Length = 10 simply to have a convenient place from which to start the prediction. The coefficients are computed parametrically from the conjugate pole positions and are normalized to their sum so the IIR filter will have unity gain at zero frequency.
The prediction is formed by convolving the IIR filter coefficients with the historical data. It is easiest to see for the case where count = 0. This is the initial prediction. In this case the new value of the XX array is formed by successively summing the product of each filter coefficient with its respective historical data sample. This process is significantly different from linear extrapolation because second order curvature is introduced into the prediction rather than being strictly linear. Further, the prediction is adaptive to market conditions because the degree of curvature depends on recent historical data. The prediction in the data array is converted to a variable by selecting the BarsFwd value. The prediction is then plotted in yellow, and is compared to the indicator plotted in red.
The Predict 2 Pole indicator is shown above being applied to the Emini S&P Futures contract for most of 2021. The default parameters for the roofing filter and predictor were used. By comparison to the Linear Extrapolation prediction of Figure 2, the Predict 2 Pole indicator has a more consistent prediction. For example, there is little or no overshoot in February or March while still giving good predictions in April and May.
Input parameters can be varied to adjust the appearance of the prediction. You will find that the indicator is relatively insensitive to the BarsFwd input. The P2Period parameter primarily controls the gain of the prediction and the QQ parameter primarily controls the amount of prediction lead during trending sections of the indicator.
TAKEAWAYS
1. A more or less universal band limited “roofing filter” indicator was used to demonstrate the predictors. The HPPeriod input parameter is used to control whether the indicator looks more like a trend indicator or more like a cycle indicator. The LPPeriod input parameter is used to control the smoothness of the indicator.
2. A linear extrapolation predictor is formed by adding the difference of the two most recent data bars to the value of the last data bar. The result is considered to be a real data point and the process is repeated to extend the prediction into the future. This is an FIR filter having a one bar negative group delay at zero frequency, but the group delay is not constant across the spectrum. This variable group delay causes the linear extrapolation prediction to be inconsistent across a range of market conditions.
3. The degree of prediction by linear extrapolation can be controlled by varying the gain of the prediction to reduce the overshoot to be about the same amplitude as the peak swing of the indicator.
4. I was unable to experimentally derive a higher order FIR filter predictor that had advantages over the simple linear extrapolation predictor.
5. A Two Pole IIR predictor can be created by parametrically locating the conjugate pole positions.
6. The Two Pole predictor is a second order filter, which allows curvature into the prediction, thus mitigating overshoot. Further, the curvature is adaptive because the prediction depends on previously computed prediction values.
7. The Two Pole predictor is more consistent over a range of market conditions.
ADDITIONS
Loxx's Expanded source types:
Library for expanded source types:
Explanation for expanded source types:
Three different signal types: 1) Prediction/Filter crosses; 2) Prediction middle crosses; and, 3) Filter middle crosses.
Bar coloring to color trend.
Signals, both Long and Short.
Alerts, both Long and Short.
Ehlers Optimum Predictor [CC]The Optimum Predictor was created by John Ehlers (Rocket Science For Traders pgs 209-210) and this indicator does a pretty good job of predicting major market moves. When the blue line crosses over the red line then this indicator is predicting an upcoming uptrend and when the blue line crosses under the red line then it is predicting an upcoming downtrend. Ehlers recommends using this indicator with an entire trading system to filter out any bad signals but most of the signals it gives are pretty accurate. He uses advanced digital signal processing to predict the future prices and uses it in an ema formula for the calculation. There are several ways to interpret this indicator: you can look for crossovers, you can also look for when the indicator goes above 0 for a general uptrend or below 0 for a general downtrend.
Let me know if there are any other scripts you would like to see me publish!
Ehlers Voss Predictive Filter [CC]The Voss Predictive Filter was created by John Ehlers (Stocks and Commodities August 2019) and this is a unique indicator in that it tries to predict future price action. I have color coded the middle line to show buy and sell signals so buy when the line turns green and sell when it turns red.
Let me know if there are any other indicators you want me to publish!
Voss Predictor (A Peek Into the Future) - Dr. John EhlersI have been sitting on this for over a year, but I now present this "Voss Predictive Filter" multicator employing PSv4.0 upon initial release, originally formulated by the great and empowering Dr. John Ehlers for TASC - August 2019 Traders Tips. This is a slightly modified version of the original indicator John Ehlers designed. My improved implementation is an all-in-one combination of three indicators, consisting of Ehlers' 2-pole bandpass filter, fed into the Voss predictor, and my Correlation Color. I also purposefully attempted to make this indicator work on both "Light" and "Dark" charts equally well.
You can search for this indicator's white paper, entitled "A PEEK INTO THE FUTURE By John Ehlers", on his site in the educational reference section. It's VERY important that you fully grasp how this indicator works and when it doesn't during trending price movements. According to "TV House Rules", I can't link directly to his white paper on his web site. Technically he's a vendor, even though it has been divulged to me, that he is intending to retire after his last and final wØℾk$#Øp, where he is publicly disseminating the bulk of his unpublished proprietary code that drives his other website VERY SOON.
I love John Ehlers in a respectfully appreciative manner and he is my hero in life! I simply don't revel about pretended celebrities and supposed rock stars. I will never be able to adequately explain to you how much he has influenced me AND this website as it currently exists AND what is in store for the future of the ever evolving "Power of Pine". His inspiring legacy of code poetry shall forever be immortally enshrined here on TV and influence it.
Back to the topic of interest, this script originating from John Ehlers' mind... This indicator helps to anticipate cyclic turning points via negative group delay. It is NOT a predictive crystal ball. Do not become cluelessly disillusioned by it's title. I need to explain.
For example, this indicator could not have anticipated that the bold faced lie of "15 Days to Slow the Spread" of the CHImeravirus "plandemic" in the USA, would turn into our factual reality of multi state mandated orders demanding months of unconstitutional prison cell styled lockdowns with closures and the absurd criminalization of not wearing a mouth mask made from underwear while not being evidently ill, additionally combined with 24/7 black magick mass hypnosis spoon feeding non-scientific fear based psychological propaganda from the world's "finest" epidemiological data analysts and misleaders, eventually decimating the world's markets into zombie economies with abhorrent results of long term massive unemployment and financial hardship on a chart scale never before witnessed. Yep, it's NOT capable of predetermining any of that. I just wanted to make that very clear by example in a metaphorical manner many people can relate to concerning Voss' ability to anticipate.
The indicator consists of a bandpass filter coupled to the Voss predictor. Also, one thing about the Voss predictor, it can catch minute turning points or even false ones as explained in the white paper. So... I included my Correlation Color as a fitting companion to aid you in filtering out false signals during trending price movements. The Voss Predictive Filter should never be used alone, be forewarned!
Features List Includes:
Dark Background - Easily disabled in indicator Settings->Style for "Light" charts or with Pine commenting
AND a few more... Why list them, when you have the source code to explore!
When available time provides itself, I will consider your inquiries, thoughts, and concepts presented below in the comments section, should you have any questions or comments regarding this indicator. When my indicators achieve more prevalent use by TV members , I may implement more ideas when they present themselves as worthy additions. Have a profitable future everyone!