OPEN-SOURCE SCRIPT
Updated

ONE RING 8 MA Bands with Rays

417
Cycle analysis tool ...
MAs: Eight moving averages (MA1–MA8) with customizable lengths, types (RMA, WMA, EMA, SMA), and offsets

Bands: Upper/lower bands for each MA, calculated based on final_pctX (Percentage mode) or final_ptsX (Points mode), scaled by multiplier

Rays: Forward-projected lines for bands, with customizable start points, styles (Solid, Dashed, Dotted), and lengths (up to 500 bars)

Band Choices
Manual: Uses individual inputs for band offsets

Uniform: Sets all offsets to base_pct (e.g., 0.1%) or base_pts (e.g., 0.1 points)

Linear: Scales linearly (e.g., base_pct * 1, base_pct * 2, base_pct * 3 ..., base_pct * 8)

Exponential: Scales exponentially (e.g., base_pct * 1, base_pct * 2, base_pct * 4, base_pct * 8 ..., base_pct * 128)

ATR-Based: Offsets are derived from the Average True Range (ATR), scaled by a linear factor. Dynamic bands that adapt to market conditions, useful for breakout or mean-reversion strategies. (final_pct1 = base_pct * atr, final_pct2 = base_pct * atr * 2, ..., final_pct8 = base_pct * atr * 8)

Geometric: Offsets follow a geometric progression (e.g., base_pct * r^0, base_pct * r^1, base_pct * r^2, ..., where r is a ratio like 1.5) This is less aggressive than Exponential (which uses powers of 2) and provides a smoother progression.
Example: If base_pct = 0.1, r = 1.5, then final_pct1 = 0.1%, final_pct2 = 0.15%, final_pct3 = 0.225%, ..., final_pct8 ≈ 1.71%

Harmonic: Offsets are based on harmonic flavored ratios. final_pctX = base_pct * X / (9 - X), final_ptsX = base_pts * X / (9 - X) for X = 1 to 8 This creates a harmonic-like progression where offsets increase non-linearly, ensuring MA8 bands are wider than MA1 bands, and avoids duplicating the Linear choice above.
Ex. offsets for base_pct = 0.1: MA1: ±0.0125% (0.1 * 1/8), MA2: ±0.0286% (0.1 * 2/7), MA3: ±0.05% (0.1 * 3/6), MA4: ±0.08% (0.1 * 4/5), MA5: ±0.125% (0.1 * 5/4), MA6: ±0.2% (0.1 * 6/3), MA7: ±0.35% (0.1 * 7/2), MA8: ±0.8% (0.1 * 8/1)

Square Root: Offsets grow with the square root of the band index (e.g., base_pct * sqrt(1), base_pct * sqrt(2), ..., base_pct * sqrt(8)). This creates a gradual widening, less aggressive than Linear or Exponential. Set final_pct1 = base_pct * sqrt(1), final_pct2 = base_pct * sqrt(2), ..., final_pct8 = base_pct * sqrt(8).
Example: If base_pct = 0.1, then final_pct1 = 0.1%, final_pct2 ≈ 0.141%, final_pct3 ≈ 0.173%, ..., final_pct8 ≈ 0.283%.

Fibonacci: Uses Fibonacci ratios (e.g., base_pct * 1, base_pct * 1.618, base_pct * 2.618

Percentage vs. Points Toggle:
In Percentage mode, bands are calculated as ma * (1 ± (final_pct / 100) * multiplier)
In Points mode, bands are calculated as ma ± final_pts * multiplier, where final_pts is in price units.

Threshold Setting for Slope:
Threshold setting for determining when the slope would be significant enough to call it a change in direction. Can check efficiency by setting MA1 to color on slope temporarily

Arrow table: Shows slope direction of 8 MAs using an Up or Down triangle, or shows Flat condition if no triangle.
Release Notes
Added shading for Env1 in general and on slope, added a bunch of MA types, added a Harmonic Denominator (the stock formula denominator was throwing MA8 way out of scene), added consistency for colors. Now the color of the MA carries through to the table and the rays if you change it... enjoy

Disclaimer

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.