RSI Divergence [Quanty]

695
Most divergence scripts draw the line back to the pivot and put the signal there, so in hindsight every divergence looks perfectly timed. In real time you only know about it a few bars later, once the pivot is confirmed. This script alerts on, and measures, each divergence from the bar where it actually becomes known, and its stats table tests that moment against chance.

WHAT IT FINDS

Only the classic case. Price makes a lower low while RSI makes a higher low (upward), or price makes a higher high while RSI makes a lower high (downward). Hidden divergences are not searched.

HOW IT IS CALCULATED

RSI (14 by default). The anchors are RSI's own troughs and peaks: a trough is confirmed once 5 bars have closed on each side of it. For each anchor, price is read from a small window around it (5 bars either side), because price often bottoms or tops a few bars before or after RSI.

A new trough is compared with the deepest trough of the last 60 bars, not only with the one just before it, so smaller wiggles between two lows do not hide a divergence. Peaks are compared with the highest peak in the same way.

Filters, all adjustable: the two RSI values must differ by at least 2 points; by default the first RSI low must be at or below 35 and the second still below 50 (upward), and the first RSI high at or above 65 with the second still above 50 (downward). When a later trough or peak diverges from the same anchor, the older line is replaced instead of fanning out.

READING IT

A thin line joins the two RSI troughs or peaks, and a faint line joins the matching price lows or highs on the main chart. The RSI line shifts from grey near 30 to mint near 70; light bands mark 20 to 30 and 70 to 80.

SETTINGS

Source, RSI length, pivot bars left and right, minimum and maximum bars between pivots, minimum RSI difference, the oversold and overbought filter and its levels. Appearance: the two divergence colours, the RSI line colours, and whether to draw on the price chart. Two alerts: upward divergence and downward divergence, both firing on the bar where the divergence becomes known.

NOTES AND LIMITATIONS

A divergence is known only after its second pivot is confirmed, 5 bars later by default; the lines are drawn back to the pivots for reference, but nothing is triggered there. RSI and price pivots are read on closed bars, so lines and alerts do not repaint. A divergence describes momentum that is weaker than price; on its own it says nothing about what comes next, which is why the table is there. We tested this exact definition offline across more than 500 crypto perpetuals and will publish the full results separately once they are verified.

HOW TO READ THE STATS TABLE

The table in the corner measures this indicator's own past signals on the chart you are viewing: how many signals fired (the number after the slash), and in how many of them price moved at least 1 ATR (14 bars) in the signal's direction within the next 10 bars. It is a measurement of history on this symbol and timeframe, not a prediction and not a promise. Change the symbol or the timeframe and the numbers change with it. Past results do not guarantee future results.

It opens collapsed to one line: the share that moved in the signal's direction, the share that moved the same distance the opposite way, and what any bar on the chart scored in a random direction (a coin toss). Untick "collapsed" in the settings to see the full table, including the median moves and a split by volume (signals whose candle volume was at least 2 times the average of the previous 50 bars, and the rest). When one side has only a handful of signals, read it as a handful, not as a rate. Pending signals are too recent to be measured and are not counted.

Here a signal is the closed bar on which a divergence becomes known: price at a lower low with RSI at a higher low (upward), or price at a higher high with RSI at a lower high (downward).

Not investment advice.

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.