OPEN-SOURCE SCRIPT

Swing Oracle + Cycle M5

167
// (\_/)
// ( •.•)
// (")_(")

Follow the White Rabbitz

Swing Oracle + Cycle M5 is a custom TradingView indicator combining a normalized oscillator (NDOS) with a 7-day cycle counter, designed for 5-minute charts. It helps traders identify overbought/oversold swing zones while tracking the market’s position within a weekly cycle that resets every Tuesday at midnight.

1. Inputs
Horizontal Levels

High Level (line_up): above this, NDOS signals overbought (“buy zone”)
Low Level (line_dn): below this, NDOS signals oversold (“sell zone”)
Mid-High / Mid-Low (line_mid_high, line_mid_low): for nuanced thresholding
Extra Levels (line_extra1–line_extra4): four additional hidden levels for advanced tuning

Trendline Source
Choose between EMA 8 or SMA 231 via trendline_source

Display Options

Draw Background Color? (button1): toggles colored background based on NDOS zone
Draw Candlesticks? (button2): toggles bar-coloring according to NDOS

2. Trendline & NDOS Calculation
Trendline

If “EMA8” selected: calculates ema(close, 8)

If “SMA231”: calculates sma(close, 231)

NDOS (Normalized Difference Oscillator)

Computes distance of current trendline value from its local high and low over the past Length bars (length)


Rendered on a 0–100 scale with a color gradient between two user-defined colors (gradientbull/gradientbear).

3. Weekly Cycle Counter (M5)
Cycle Start Detection

Marks every Tuesday at 00:00 as cycle zero (isTuesdayZero), storing its timestamp.

Cycle Number

Computes the number of full 7-day intervals since the last stored Tuesday, then plots it as a semi-transparent histogram aligned with the NDOS panel.

4. Visualization & Styles
Oscillator Plot

Thick line for NDOS, colored blue above line_up, red below line_dn, neutral otherwise—overlaid with the same gradient as the histogram.

Horizontal Levels
Distinct plots for each user level (High, Low, Mid-High, Mid-Low).

Filled Zones

Buy Zone: area between NDOS and High Level
No-Trade Zone: between High and Low Levels
Sell Zone: area between NDOS and Low Level

Optional Coloring
Background and candlesticks can be tinted based on whether NDOS is in buy or sell territory.

5. Typical Use Case
*Scalping & Swing: Quickly spot overbought/oversold conditions on 5-minute bars.

*Cycle Awareness: Ensure entries/exits align with your preferred phase of the weekly cycle (e.g., early vs. late in a Tuesday→Tuesday loop).

*Customization: Adjust levels, gradient colors, and trendline source to match your strategy’s sensitivity and preferred look.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.