AF_StochZ_Overlay turns an oscillator into labels printed right on your candles
If you trade with Stochastic or RSI, you know the drill: your eyes keep bouncing between the price chart and the oscillator pane underneath. “Is it oversold yet?” “Is that a divergence?” Constantly glancing up and down gets tiring fast.
AF_StochZ_Overlay is built to cut out that back-and-forth. Under the hood it calculates a Stochastic-based oscillator, but it never plots a single line. Instead, it detects oscillator extremes and divergences and prints only the result as labels like “BUY” or “R-Bull” directly on the price chart.
AF_StochZ_Overlay has three label families, read by color and text
No oscillator line is plotted. Only the result of each check is printed as a label on the candles.
Vowars DE ver.3.12.36
There are three families of labels. Figure 1 shows BUY/SELL, the lead signals meant as entry cues. Figure 2 shows R-Bull/R-Bear for regular divergence, and Figure 3 shows H-Bull/H-Bear for hidden divergence. It looks simple on the surface, but three processing stages are stacked behind it: an adaptive lookback, a Fisher Transform, and a Z-Score. That stack is what gives AF_StochZ_Overlay its own character.
I ran it on BTCUSDT across eight timeframes, from the 1-minute to the weekly. Using those charts, this review walks through how to read the labels, when they print, how to tune the settings, and where the indicator struggles.

Label types and colors
For the most part, these labels are the only thing AF_StochZ_Overlay draws. You can turn on divergence lines in the settings, but they are off by default. Labels on the low side appear below the bar as upward-pointing callouts, and labels on the high side appear above the bar as downward-pointing callouts.
| Label text | Default color | Meaning | Placement |
|---|---|---|---|
| BUY | Green | Lead signal (long) | Below the swing-low bar |
| SELL | Red | Lead signal (short) | Above the swing-high bar |
| R-Bull | Green | Regular bullish divergence | Below the swing-low bar |
| R-Bear | Red | Regular bearish divergence | Above the swing-high bar |
| H-Bull | Dark green | Hidden bullish divergence | Below the swing-low bar |
| H-Bear | Orange | Hidden bearish divergence | Above the swing-high bar |
When a BUY and a divergence both trigger on the same swing low, they merge into one two-line label, such as “BUY” over “R-Bull”. The label then takes the divergence color. A “BUY” plus “H-Bull” combo, for example, shows up in dark green rather than the plain BUY green. Regular and hidden never share a label. The script checks prior lows starting from the nearest one, and only the first condition that matches gets printed.
By default, BUY and R-Bull are both green, so telling them apart by color alone can be a little confusing. In practice I found it easier to just read the text instead of relying on color. If that bugs you, changing only Buy Signal Color to a different color makes them much easier to tell apart.
The three processing stages behind the labels
Only labels show up on screen, but knowing what is being measured internally helps a lot in understanding why they print where they do. In order, it works like this.
1 Set the lookback between 8 and 34 bars using the Efficiency Ratio
First, Kaufman’s Efficiency Ratio (ER) sets the Stochastic lookback on every bar. ER divides how far price actually moved over the last 10 bars by the total distance it traveled up and down in that span. It approaches 1 when price moves cleanly in one direction and approaches 0 when price chops back and forth.
In AF_StochZ_Overlay, a higher ER shortens the lookback and a lower ER lengthens it. The upper limit is 34 bars, set by Max Length, and the lower limit is 8 bars, set by Min Length. The idea is to react quickly with a short lookback when a trend is running, and to smooth out the noise with a longer one when the market is choppy.
The lookback flexes between 8 and 34 bars depending on how price is moving
The higher the Efficiency Ratio (ER), meaning the more cleanly price moves in one direction, the shorter the lookback. The choppier price gets, the longer it becomes.
Vowars DE ver.3.12.36
During the sustained rally in Figure 1, the lookback shrinks to around 10 bars, and in the chop in Figure 2 it stretches to nearly 30. Once the selloff turns one-directional in Figure 3, it shortens again.
2 Run the Stochastic through a Fisher Transform
%K is calculated over that lookback and smoothed with a simple moving average of %K Smoothing bars (default 3). The 0-100 value is then rescaled to the -1 to +1 range and passed through a Fisher Transform.
The Fisher Transform stretches values more and more the closer they get to the extremes. Stochastic tends to flatten out around 80 or 90, but after the transform, the gap between “pinned at the extreme” and “just near the extreme” widens, so tops and bottoms stand out more clearly.
3 Convert it into a Z-Score against the last 20 bars
Finally, the script takes the difference between the transformed value and its average over the last Z-Score Length bars (default 20), then divides it by the standard deviation over the same period to get a Z-Score. A Z-Score tells you how many standard deviations the value sits away from its usual level.
Thanks to this last stage, overbought and oversold are no longer fixed numbers like 20 and 80. They become a measure of how stretched the reading is compared with recent swings on that specific asset and timeframe. That is why the same -1 and +1 thresholds work on a volatile asset like Bitcoin and on a calmer pair like USD/JPY.
BUY and SELL only print when an oscillator trough and a price low line up
The BUY and SELL lead signals don’t fire just because the Z-Score crosses a threshold. They print only after passing a two-step check, first on the oscillator side and then on the price side.
A BUY is confirmed in two steps: an oscillator trough, then a price low
The lower line is not shown on TradingView. It is added here to show why the label prints.
Vowars DE ver.3.12.36
Here is how a BUY comes together. A SELL is the same process mirrored on the high side.
- As in Figure 1, the Z-Score forms a trough below Oversold Level (Z-Score) (default -1.0), and that trough is confirmed by one bar on each side
- On the same bar as that trough, or within Max Lag After Osc Pivot (Bars) bars after it (default 5), a price swing low forms, as in Figure 2
- The swing low counts once it is lower than the 3 bars to its left and the 2 bars to its right, and as in Figure 3, the BUY label prints once those 2 right-hand bars have closed
If the price low forms before the oscillator trough, there is no BUY. The logic looks for a specific sequence: momentum bottoms first, then price bottoms. Also, each oscillator trough can produce only one BUY. Even if price makes several lows after the same trough, only the first one gets a BUY.
On the BTCUSDT charts I checked, BUY and SELL labels were far less frequent than divergence labels. Divergences have no Z-Score threshold, which explains the gap in frequency (more on this later).
A BUY label sits on the swing-low bar, but it only appears when the bar two bars later closes. Looking back at the chart, it may look like “BUY right at the bottom,” but in real time the label only shows up two bars after the low. The more a historical chart makes the signals look spot-on, the more you should mentally subtract those two bars.
How the divergence labels are detected
Divergence detection runs separately from BUY/SELL. Every time a price swing low (or high) is confirmed, the script looks back 5 to 60 bars for an earlier swing low (or high) and compares the Z-Score on those two bars.
R-Bull and R-Bear (regular divergence)
R-Bull means price made a lower low, yet the Z-Score is higher than it was at the previous low. It signals fading selling pressure and is used when you suspect a reversal. R-Bear is the opposite: price makes a higher high while the Z-Score comes in lower than last time.
R-Bull: a lower low in price against a higher low in the Z-Score
Price is making a new low, but the momentum reading isn't dropping as far as last time. That mismatch is labeled as a regular divergence.
Vowars DE ver.3.12.36
In Figure 1, price sets a lower low than before, while in Figure 2 the Z-Score turns up from a higher level than last time. With Show Divergence Lines turned on, the two lows are connected with a solid line, as in Figure 3.
H-Bull and H-Bear (hidden divergence)
H-Bull means price made a higher low, but the Z-Score sank deeper than it did last time. It catches pullbacks in an uptrend where only momentum cooled off for a moment. Hidden divergence is generally treated as a trend-continuation signal.
The pullback low in Figure 1 is above the previous one, while the Z-Score in Figure 2 is below its previous reading. When lines are enabled, hidden divergences are drawn as dashed lines, as in Figure 3, so you can tell them apart from regular ones.
Where it differs from the divergence you’re used to
Three things caught my attention while using it. If you are used to spotting divergence by eyeballing an oscillator in a separate pane, the way these labels print may feel a bit off at first.
- It compares the Z-Score on the price swing-low bars. It does not compare the oscillator’s own troughs. Even if the oscillator bottomed a few bars before the price low, the value that gets compared is the one on the swing-low bar.
- The comparison point isn’t always the previous low. The script scans back starting 5 bars ago and locks in the first swing low that meets the condition. If the most recent low doesn’t qualify, it keeps looking further back, so a line can stretch more than 30 bars.
- There is no Z-Score threshold. Unlike BUY/SELL, divergences have no -1 or +1 condition. Even with the Z-Score hovering around 0, a label prints as long as the comparison matches.
Because of that third point, divergence labels are plentiful. On BTCUSDT’s 1-minute and 5-minute charts, there were stretches where it looked like nearly every high and low had some kind of label. If you want fewer labels, the settings covered later will help.

Labels never disappear, but they land two bars back
On repainting: signals are evaluated only on confirmed bars, so once a label appears, it never moves or disappears later. Labels also won’t flicker on and off while the current bar is still forming.
That said, a label is placed not on the bar where the check happens, but on the swing-low or swing-high bar Price Pivot Right Bars bars earlier (default 2). In other words, once a signal is confirmed, the label gets drawn back onto a past bar. Divergence lines work the same way, connecting two past bars at the moment they appear.
On a historical chart, labels sit right on the highs and lows, which makes them look more accurate than they really are. The earliest point you can actually act on is the close of the bar two bars after the labeled bar. If you estimate P&L from past labels, always build that offset into your numbers.
If you want to see this delay for yourself, TradingView’s Bar Replay does the job. Step forward one bar at a time from a past point, and you can watch the label appear on the swing-low bar two bars after the low formed. You do have to advance the bars manually, and how far back you can replay depends on your plan and the timeframe.
One more thing: only up to 500 labels stay on the chart. Once that limit is reached, the oldest ones are removed first, so if you scroll far back on a 1-minute chart, older labels will be gone. That comes from the display limit, not from any change in the signals. Divergence lines don’t have their display limit raised either, so only roughly the 50 most recent remain.
Switching timeframes changes how the labels behave
I compared BTCUSDT on the 1-minute, 5-minute, 15-minute, 30-minute, 1-hour, 4-hour, daily, and weekly charts, all with default settings. These are tendencies I saw on the charts as of October 2026, but the way the labels printed clearly changed with the timeframe.
- On the 1-minute and 5-minute, labels are everywhere, with something attached to almost every high and low. It was almost quicker to look for the stretches without labels.
- From the 15-minute to the 1-hour, labels get more spaced out, and labels including BUY/SELL more often cluster at the top and bottom edges of a range.
- From the 4-hour to the weekly, the number of labels settles down, and combos like BUY+R-Bull or SELL+R-Bear showed up near major turning points. That said, the same combos also appeared in the middle of strong trends.

On the weekly example, three bearish labels in a row near the highs were followed by a big drop. That is a case where the bearish labels could be read as an early warning of a top. On the other hand, price kept falling even after a BUY+R-Bull printed during the decline. Even on higher timeframes, a label is no guarantee of a reversal.
Strong trends keep printing counter-trend labels
Every label from AF_StochZ_Overlay boils down to one of two calls: “momentum is temporarily overextended” or “momentum and price are out of sync.” In a strong trend, those conditions get met again and again at short intervals.
In a strong selloff, BUY+R-Bull combos don't stop the decline
A label prints when momentum is judged to be temporarily overextended. It is no promise that the trend is over.
Vowars DE ver.3.12.36
Even with back-to-back BUY+R-Bull labels as in Figure 1 and Figure 2, the lower lows keep coming, as Figure 3 shows. As the selloff continues, the Z-Score keeps dipping below -1 at short intervals, and the conditions line up every time. The flip side is that a sustained rally lines up SELL and R-Bear labels. On the daily chart too, SELL and R-Bear labels kept printing near the highs after the sharp rally in August 2026, yet price pushed even higher into late September.

If you take these labels at face value as signals to fade the move, you will end up repeatedly trading against the trend. There are two main fixes: the trend filter covered next, and confirming trend strength with another indicator.
Two filters to thin out the labels
Use Trend Filter (EMA)
With Use Trend Filter (EMA) turned on, only BUY signals print when the close is above the EMA, and only SELL signals print when it is below. The EMA length is set by Trend EMA Length (default 200). The check uses the close of the bar where the signal is confirmed, not the swing-low bar the label sits on.
With Use Trend Filter on, only BUY/SELL against the EMA disappear
The filter only restricts the BUY and SELL lead signals. Divergence labels still print as usual.
Vowars DE ver.3.12.36
The easy-to-miss part is that this filter only affects BUY and SELL. The label in Figure 2 would read “SELL” over “R-Bear” with the filter off, but with it on, only R-Bear remains. Divergence labels still print as usual, so even with the filter on, you’ll still see R-Bear labels lining up during an uptrend. If you only want to see trend-aligned signals, consider also turning off one or both divergence types.
Note that AF_StochZ_Overlay itself does not plot the EMA. The blue line in Figure 1 is TradingView’s built-in EMA, added just for reference. If you want to see where the filter flips on the chart, adding an EMA with the same length separately makes it easier to judge.
Require %K/%D Confirmation
Turning on Require %K/%D Confirmation adds one more condition: %K above %D for a BUY, and %K below %D for a SELL. %D is %K averaged over %D Signal bars (default 3). Think of it as checking that the Stochastic has already started turning in the signal’s direction on the bar where the signal is confirmed. This one doesn’t affect divergence labels either.
%D Signal is only used when this confirmation is turned on. While it stays off, changing the value won’t change any labels.
What each setting does, and which ones are worth changing
There are quite a few settings, but they are easy to sort out once you group them by role. The Suggested column is a guide for day trading around the 1-hour chart, tuned to cut the labels down a little.
| Setting | Default | Suggested | Effect |
|---|---|---|---|
| Min Length | 8 | 8 (13 for swing) | Lower limit of the lookback. Lower values make it react faster in trends and produce more labels |
| Max Length | 34 | 34 (55 for swing) | Upper limit of the lookback. Higher values make it less sensitive to small swings in choppy markets |
| ER Length | 10 | 10 | Bars used to measure the Efficiency Ratio. Shorter values make the lookback switch more often, longer values change it more slowly |
| %K Smoothing | 3 | 3 | Bars used to smooth %K. Higher values reduce noise at the cost of slower turn detection |
| %D Signal | 3 | 3 | %D length. Only used when Require %K/%D Confirmation is on |
| Require %K/%D Confirmation | Off | On for 5-minute and below | Adds %K above %D for BUY and %K below %D for SELL. Does not affect divergences |
| Z-Score Length | 20 | 20 (30 for swing) | Bars used as the Z-Score baseline. Longer values make the baseline move more slowly and extreme readings rarer |
| Oscillator Pivot Bars (L=R) | 1 | 1-2 | Bars on each side used to confirm Z-Score troughs and peaks (1-5). Higher values mean fewer and later BUY/SELL signals |
| Oversold Level (Z-Score) | -1.0 | -1.0 to -1.5 | Z-Score trough level required for BUY. Lower values mean fewer BUYs |
| Overbought Level (Z-Score) | 1.0 | 1.0 to 1.5 | Z-Score peak level required for SELL. Higher values mean fewer SELLs |
| Price Pivot Left Bars | 3 | 3 | Left-side bars needed to confirm a swing low or high. Higher values mean fewer labels |
| Price Pivot Right Bars | 2 | 2 (1 if speed matters) | Right-side bars needed to confirm a swing low or high. This number is exactly how many bars the labels lag |
| Max Lag After Osc Pivot (Bars) | 5 | 5 | Bars allowed between the Z-Score trough (peak) and the price swing low (high) (1-10). Lower values mean fewer BUY/SELL signals |
| Use Trend Filter (EMA) | Off | On for strongly trending assets | Allows only BUY above the EMA and only SELL below it. Does not affect divergences |
| Trend EMA Length | 200 | 200 (50 for 5-minute and below) | EMA length used by the trend filter |
| Show Regular Divergence | On | On | Shows R-Bull/R-Bear |
| Show Hidden Divergence | On | On for trend-following, off for reversals only | Shows H-Bull/H-Bear |
| Show Divergence Lines | Off | On only when checking | Line joining the two compared lows (highs). Hidden divergence is dashed |
| Divergence Min Lookback (Bars) | 5 | 5 | Where the search for the earlier swing low or high starts |
| Divergence Max Lookback (Bars) | 60 | 30-60 | How far back to search. Lower values stop comparisons between lows that are far apart |
There are six color settings: Buy Signal Color (green), Sell Signal Color (red), Reg. Bullish Div Color (green), Reg. Bearish Div Color (red), Hid. Bullish Div Color (dark green), and Hid. Bearish Div Color (orange). None of them affect the signal logic.
If there are too many labels
To cut down on BUY/SELL, the quickest move is to widen Oversold Level (Z-Score) and Overbought Level (Z-Score) to -1.5 and 1.5. Signals will then only trigger on deeper extremes in the Z-Score. The script’s public page also suggests -1.5 and 1.5 as a starting point for swing trading on the 4-hour to daily charts.
The threshold settings won’t reduce divergence labels. For those, raise Price Pivot Left Bars and Price Pivot Right Bars to make the swing-low and swing-high criteria stricter. Keep in mind that more right-side bars also means a longer delay before the label prints.
If you want less lag
Dropping Price Pivot Right Bars from 2 to 1 makes labels print one bar after the low. The trade-off is that it also picks up shallow lows that get taken out right away, so you’ll see more labels. If you run this setting on the 1-minute to 5-minute charts, turning on both the trend filter and the %K/%D confirmation to thin out BUY/SELL keeps things balanced.
Example setups by timeframe
| Use case | Main changes | Goal |
|---|---|---|
| Scalping on the 1-minute to 5-minute | Min/Max Length 5/21, Price Pivot 2/1, trend filter and %K/%D confirmation on, EMA 50 | React faster while restricting counter-trend BUY/SELL to the trend direction |
| Day trading on the 15-minute to 1-hour | Defaults, with the trend filter on as needed | The use case the defaults are designed for |
| Swing trading on the 4-hour to daily | Min/Max Length 13/55, Z-Score Length 30, Level -1.5/1.5, Price Pivot 5/3 | Catch only big extremes and clear-cut swing highs and lows |
This table summarizes the timeframe-specific settings from the usage guide on the script’s public page. Rather than copying the exact numbers, take away the general direction: “shorter timeframes, shorter lookbacks plus filters” and “longer timeframes, wider lookbacks and thresholds.” The practical approach is to adjust gradually while watching how many labels print on your own market and where they land.
Pair it with ADX to see when the labels are worth trusting
The weak spot of AF_StochZ_Overlay is that it keeps printing counter-trend labels in strong trends. That is where ADX, which measures trend strength, pairs well. ADX tracks strength only, not direction, so a rising ADX means momentum is building, whether price is going up or down.
While ADX is rising, treat a BUY as a label printed mid-selloff
AF_StochZ_Overlay is designed to catch reversals from extremes, so keeping ADX, a trend-strength gauge, alongside it makes it easier to tell when a label is worth trusting.
Vowars DE ver.3.12.36
In Figure 1, ADX bottoms and turns up, and right after that the BUY+R-Bull in Figure 2 prints. But as Figure 3 shows, the decline kept going while ADX kept rising, and the selloff didn’t stop after the BUY. This makes it easier to skip counter-trend labels while ADX is rising, treating them as labels printed mid-trend, and give priority to labels that print while ADX is flat or falling.
I also found these indicators easy to combine with it.
- Keltner Channels let you check whether a BUY or R-Bull printed near the lower band or near the midline, which confirms the extreme from a price-range perspective as well.
- Chaikin Money Flow (CMF) helps you check, when a divergence label prints, whether volume-weighted buying or selling pressure is also fading.
- Supertrend shows the trend direction through its line color, so you can use it as a visual guide instead of the trend filter’s EMA.
What you can rely on, and what to take with a grain of salt
What you can rely on
- Read the oscillator’s signals on the price chart alone, without a separate pane
- Z-Score normalization lets you use the same -1 and +1 levels on assets with very different volatility
- Signals are evaluated on confirmed bars only, and labels never vanish once they appear
- When BUY/SELL and a divergence overlap, they merge into one label, so confluence is obvious at a glance
- Each of the six label types has its own alert condition
Take with a grain of salt
- Labels print two bars after the swing high or low, so historical charts make them look more accurate than they are
- Strong trends keep producing counter-trend labels
- Divergence labels have no Z-Score threshold, so lower timeframes get flooded with them
- The oscillator value itself is never shown, so you can’t tell from a label how stretched the move is
- The EMA used by the trend filter isn’t drawn on the chart
Six alerts, one for each label type
Alert conditions map one-to-one to the labels. An alert fires on the bar where the label is confirmed, which is two bars after the swing low or high.
| Alert condition | Matching label |
|---|---|
| StochZ Lead BUY | BUY |
| StochZ Lead SELL | SELL |
| Regular Bullish Divergence | R-Bull |
| Regular Bearish Divergence | R-Bear |
| Hidden Bullish Divergence | H-Bull |
| Hidden Bearish Divergence | H-Bear |
Since the signals themselves are evaluated at bar close, setting the alert trigger to “Once Per Bar Close” keeps the alerts in sync with when the labels appear. When BUY and R-Bull print on the same bar, each alert condition triggers separately. And if the trend filter or %K/%D confirmation is on, the BUY/SELL alerts follow the filtered results.
Who AF_StochZ_Overlay is for, and who it isn’t for
ImageAF_StochZ_Overlay packages Stochastic extremes and divergences so you can read them directly on the price chart. Since you don’t need a separate pane, it should suit traders who want a cleaner chart or who make decisions mainly from price action.
It shines most when you are hunting for reversals at the upper and lower edges of a range. On the other hand, if you are a trend follower and take every label as a fade signal, you’ll get run over again and again. Keep a second yardstick such as the trend filter or ADX, and treat the labels as markers that flag overextended momentum. In my experience, that is the key to getting long-term value out of this indicator.
Finally, when you add it to your chart, remember one thing above all: labels print two bars late and attach to a past bar. Judge signals by the close of the bar where the label appears, not by how the historical chart looks. Keep that in mind, and AF_StochZ_Overlay can pack a lot of information into a single chart.








