OPEN-SOURCE SCRIPT
Atualizado

Quad Rotation - 4 Stochastics Overlay with ABCD Detection

1792
"Quad Rotation - 4 Stochastics Overlay with ABCD Detection" is a momentum indicator combining four separate Stochastics and an ABCD pattern detection system.

Each Stochastic uses different parameter settings to capture potential rotation points in market momentum.

When three or more (this number is user customizable) of these Stochastics simultaneously slope downward above the 80 level (or slope upward below the 20 level), the chart background highlights in red (bearish) or green (bullish), indicating a multi-Stochastic momentum signal.

Additionally, the script tracks Stochastic #4 to detect an ABCD pattern:

Long Pattern (A-B) triggers if Stochastic #4 remains above 90 for a specified number of bars (abBars).
Short Pattern (C-D) triggers if Stochastic #4 remains below 10 for a specified number of bars (cdBars).

Visual markers (green X for long setups, red X for short setups) appear on the chart once these conditions are met. Users can enable alerts to receive real-time notifications whenever momentum signals or ABCD patterns occur.

This combination of multi-Stochastic momentum and ABCD detection helps traders gauge potential trend exhaustion and reversal points with greater confidence.
Notas de Lançamento
Added super signal logic, where all 4 stochs are above or below 80 / 20
Notas de Lançamento
added alerts
Notas de Lançamento
bug fixes etc
Notas de Lançamento
some improvements
Notas de Lançamento
Added divergence detection and some cleanup
Notas de Lançamento
I added some code that allows for divergence colors that can match the line colors for easier visual differentiation.
Notas de Lançamento
Minor bug fix
Notas de Lançamento
one more bug fix
Notas de Lançamento
Bug fix for the Alert Conditions for Divergences section

Resetting Alerts:
At the beginning of each divergence block (for Stochastics 1–4), the script resets the corresponding divergence alert flags to false. This ensures that an alert is only flagged on the bar where the divergence condition is met.

Divergence Logic:
After resetting, the script computes the pivot points and then checks if the price and the oscillator move in opposite directions. If the condition is met, it draws a line and sets the alert flag to true for that divergence.

Alert Conditions:
The final alertcondition calls trigger an alert whenever the corresponding alert flag is true on that bar.

Notas de Lançamento
Bug fix:

In this version each divergence block resets its respective alert flags at the start of every bar. This ensures the alert conditions (which remain unchanged at the bottom) only trigger on the bar where a divergence is first detected rather than on every subsequent bar.





Notas de Lançamento
I am having a lot of trouble with the divergence alerts firing all the time.

Alert Condition Updates:
Instead of having alert conditions simply check if the divergence flag is true, each alert now includes a condition to check that the flag was false on the previous bar. For example, for Stoch1 Bearish Divergence, the alert condition changed from:

alertcondition(alertDivergenceStoch1Bearish, title="Stoch1 Bearish Divergence", message="Bearish divergence detected on Stochastic 1")
to
alertcondition(alertDivergenceStoch1Bearish and not alertDivergenceStoch1Bearish[1], title="Stoch1 Bearish Divergence", message="Bearish divergence detected on Stochastic 1")

This ensures that the alert fires only at the moment the divergence is newly detected rather than continuously on subsequent bars.
This update should prevent repeated alerts for past divergences.
Notas de Lançamento
In the divergence section (step 8), after computing a one‑shot divergence condition (using persistent “last alert bar” variables) we now add the check:

and barstate.isconfirmed

to each alertcondition(). This ensures that the alert only fires once when a bar is closed (i.e. the bar is confirmed), rather than triggering repeatedly during realtime updates (which can happen every minute or more frequently).
Notas de Lançamento
reverting the code - still t'shooting divergence alerts
Notas de Lançamento
OK I think I might have fixed the stochastic divergence alert bug...
Notas de Lançamento
reverted changes
Notas de Lançamento
I think I finally fixed the stochastic divergence alerts - this was harder than doing the entire indicator.
Notas de Lançamento
reverted again! :(

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.