Reverse Stoch [BAPig]

balipour Premium Updated   
Reverse Indicator calculation: Oscillators value output are calculated based on the input price (open, high, low or close). This means certain input price can generate the according to the output value of the oscillator. They are both sides of an equation, the process is reversible. Once we know one side of the equation, we can get the value of the other side. We can turn any oscillator into a moving average like indicator on price. This indicator is the reverse calculation of stochastic oscillator. They provide users the exact price level input needed for the stochastic to reach a certain value (crossover, oversold, overbought).



We provide two ways of reverse calculation. Current reverse value and forecasted value.
Current K and Current D option is just the simple reverse calculation of stochastic .

However, we found due to stochastic oscillator’s calculation (based on high, low and close), the indicator repaints or update value too much. For example, when price moves up, the reverse value also moves up a lot, it’s too reactive to the current price. So we made the reverse stochastic even better by forecasting the value by the open of next bar. This makes the indicator much more stable to the current price and allows you to anticipate the crossing of the stochastic oscillator one step ahead.

Even though it's "forecast", it's just simple math trick. The value of oscillator is calculated by the length of the sample size. When it does the calculation on the next bar, it will erase the last bar in the sample and add a new bar which equals to the one bar ago closing price. By moving all the data of price forward by one bar we produce a 100% accurate forecast of the value the indicator will produce by the closing of the current bar or open of next bar.

One usage of Using Forecast K and Forecast D is that you can anticipate the turning point one bar ahead:
One Bar before the actual stochastic cross
When they actually crossed

All stochastic display, The forecast K and D leads the current K and D by one bar, it's almost like one bar offset ahead.

Now we can apply this forecast VS original stochastic concept on reverse stochastic . It makes even more impact. It reduces lag and overshoot. It's also more stable to changes in the current price. So the reversal price value won't change too much intrabar.

Reverse Stoch Forecast VS Reverse Stoch Original

Reverse Stoch Forecast leads Reverse Stoch Current one bar ahead

One bar before stoch cross

After they both cross

Our recommendation in K,D options:
For people who want to anticipate turning point earlier, they should use forecast K and forecast D options.
For people who like more confirmation, they should use current K and current D options.

Warning: For forecast value, even though its 100% accurate. The value can still change due to the next bar value. Eg: Current Bar close below forecast level, the next bar can close above to reverse the result.

Settings functions explanation:

K,D, and Smooth length is the same as stochastic K,D and smooth length

"Show stochastic cross value panel" and "Show overbought and oversold Panel" allows users to display or hide a panel with stoch crossing or overbought and oversold price.

"Overbought and Oversold Style" changes the display of the overbought and oversold price of stochastic .

Option "Line Levels" plots horizontal lines of the price when stochastic K reaches overbought and oversold level.

Option "Bands" plots the historical running value of the price when stochastic K reaches overbought and oversold level. The user should tick off log display of the chart when they choose "Bands" option.

'Line Levels" and "Bands" have the same current value just different displays.

User can choose to plot or hide the overbought and oversold price by ticking and unticking the "plot overbought price" and "plot oversold price"
They can also adjust the oversold and overbought value of stochastic (Default is 80 and 20).

"Stoch Cross Smoothing" enables users to smooth out the reverse stochastic . It turns the reverse stoch into a close to moving average smooth filter.
User can adjust the length of smoothing to change the smoothness of the filter.

"Plot Stoch Historical Value" the stochastic value when it crosses in the past on the running reverse stoch .
User can choose the display K or D value when it crosses.

"Plot Crossing Circles" plots circles on the reverse stoch when stoch crosses.

There's a bug in Tradingview label system. When the background of the label is transparent, the text will get burry when we scroll in and out on the chart. When this happens, changing any settings on the panel could refresh the text display. It could also be avoided by ticking the "dark background" setting to make the background not transparent.

For prices that require more decimal places, users can type in the decimals places they want in the “decimal” setting.
Release Notes:
Updated Code
Release Notes:
Combined "K Estimation" and "D Estimation" Into One Options "KD Estimation". The user can choose "Forecast" or "Current" in only one setting.

Added Multi Time Frame Options, Tick "Use Multi Time Frame" to enable this function. Select the time frame in the "Multi Time Frame Resolution". Added More selections in the resolution such as 12 hours. The time frame selected should be higher than the current time frame. If not an error warning will appear.

Release Notes:
Changed Cover
Release Notes:
changed short title
Release Notes:
fixed description multi time frame
Release Notes:
removed error warning
Release Notes:
Reverse Stochastic indicator is now Free and Open-Source. Click the chart/link above to see. This is our Christmas Gift for the community.
Merry Christmas🎄

TA is a mental illness & stubborn idiots are highly susceptible to it. Banned because the "artist" bums in charge are allergic to math. Butthurt TA scammers who are too dumb to understand stats. Broke line drawing retards larping expertise in finance.
Invite-only script

Access to this script is restricted to users authorized by the author and usually requires payment. You can add it to your favorites, but you will only be able to use it after requesting permission and obtaining it from its author. Contact balipour for more information, or follow the author's instructions below.

TradingView does not suggest paying for a script and using it unless you 100% trust its author and understand how the script works. In many cases you can find a good open-source alternative for free in our Community Scripts.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?

Warning: please read before requesting access.