Moving Average Structure Matrix Guide | SG Group
Skip to content
Japanese page

FreeOpen sourcePine Script v6

Treat up to eight moving averages as an ordered structure through pair order, slopes, fast/slow cohorts, bundle width and reorder rate. The current source expands the study into Bias, lifecycle Phase, MTF context, memory and forward-outcome research.

Trend / Moving-average structure
Real chart published on TradingView: Moving Average Structure Matrix
Real chart image from the published TradingView page. The symbol, timeframe, settings and prices shown are a captured example, not current data or a trading result.
PurposeSeparate MA direction from lifecycle
Best forSystematic moving-average structure research
Primary outputStructure ribbon, centerline, fixed HUD and events
Chart placementPrice-chart overlay
01 — Overview

The current Regime Transition Lab is larger than the older catalogue summary

The public H1 remains Moving Average Structure Matrix, while the July 26, 2026 source identifies the expanded build as Moving Average Structure Matrix — Regime Transition Lab. It now covers Bias, Phase, Clarity, confirmed higher-timeframe context, completed-regime memory and conditional outcome samples.

What it visualizes

A fast/slow cohort ribbon, ensemble centerline, optional individual MAs and bundle envelope, lifecycle tint, a fixed bottom-left MA REGIME HUD and selected factual event markers. HUD detail can be Clean, Analyst or Research.

How it works

MA distances and slopes are normalized by ATR, Percentage or Rolling stdev. Pair order, slope coherence, cohort spread, width rank and reorder rate feed Bias and Clarity, while a separate ruleset classifies lifecycle Phase.

Bias is separate from Phase

Bias combines 45% order coherence, 30% slope coherence and 25% cohort bias. Phase classifies compression, release, expansion, pullback, deceleration or transition.

Structure Clarity

Order, purity, slope, energy and ties form a 0–100 clarity score after a reorder-rate penalty. It is not a profit probability.

MTF, memory and outcomes

Confirmed higher-timeframe structures can be compared, while completed episodes and conditional forward samples are summarized. This is not a strategy backtest.

02 — Install and start

Add it to TradingView

Add the public script to a chart and identify every drawing in the default configuration first. Change only one input at a time.

Moving Average Structure Matrix

Open the public Moving Average Structure Matrix page and add it to a TradingView chart. No SG Group account is required.

  1. Open the “Use on TradingView” link below.
  2. Select “Use on chart” on TradingView to add the script to your chart.
  3. Open the gear icon, then Settings → Inputs, and observe the default configuration first.
  4. Change one input at a time for the symbol and timeframe you are studying.
Observe the defaults firstChange one input at a timeVerify symbol, timeframe and feed

Prevent misreads when indicators overlap

Overlapping lines, bands, backgrounds or tables can be duplicate drawings of the same kind of information. Never treat visual overlap by itself as stronger evidence or signal agreement. Another MA ribbon, EMA/SMA set, Ichimoku or Supertrend can duplicate up to eight MA lines, the fast/slow ribbon, centerline and bundle envelope. Lines meeting at one price are not independent support or resistance.

  • Start with Show fast/slow structure ribbon and Show ensemble centerline; leave Show individual MAs and Show full MA bundle envelope off.
  • Do not combine Fill full MA bundle or Show lifecycle background tint with another band or background study until each source is clear.
  • If Show fixed bottom-left regime HUD covers a logo or another HUD, change HUD clearance or hide one panel.
  • Keep Marker display at Major only or Off so several studies do not label the same bar.
03 — How to read it

A practical reading order

Do not turn one value or color into a conclusion. Check the condition, persistence and relationship to price in order.

Check readiness and configuration

Identify the preset, enabled MAs, normalization mode, required history and Chart/Anchor/Macro hierarchy.

Read Bias and Phase separately

BULLISH can coexist with COMPRESSION or DECELERATION; do not collapse the labels into one signal.

Use Clarity and MTF as context

Clarity, WAITING HTF CLOSE, MEM and OUT describe conditions, not entries or win rate.

Status and display terms

BULLISH / BEARISH / NEUTRAL

Composite MA-structure direction, not a trade recommendation.

COMPRESSION / RELEASE

Bundle compression / directional width emergence after recent compression.

EXPANSION / PULLBACK

Directional expansion / return inside the bundle while structure holds.

DECELERATION / CHURN

Falling energy/coherence/width / high-reorder transition.

Clarity

A 0–100 clarity score for related MA structure, not win rate.

WAITING HTF CLOSE / INVALID HIERARCHY

Waiting for confirmed higher-timeframe data / invalid timeframe order.

04 — Settings reference

Settings reference

The labels below match the published script’s English Inputs panel. Defaults reflect the public source at the time of review and may change in a later TradingView update.

On small screens, each input is reformatted as a readable stacked card.

1. Core configuration

5 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
Structure presetBalanced Trend | options: Short Horizon, Balanced Trend, Long Horizon, Investor, CustomSelects a reference MA configuration; Custom uses the eight slot settings.
SourceclosePrice series used for MA and price-location calculations.
Slope lookback5 | range: 1–100Bars used to measure each MA's slope.
Minimum warm-up bars80 | range: 20–2000Minimum history required before classification starts.
Use automatic warm-up floortrueAutomatically raises warm-up to cover active calculation lengths.

2. Normalization and structure engine

15 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
Distance normalizationATR | options: ATR, Percentage, Rolling stdevChooses ATR, percent, or rolling-standard-deviation normalization.
ATR normalization length14 | range: 2–500ATR length used by ATR normalization.
Rolling stdev length50 | range: 5–1000Lookback used by rolling-standard-deviation normalization.
Pair tie threshold (normalized units)0.030 | min: 0 | step: 0.005Normalized separation below which an MA pair is treated as tied.
Slope flat threshold (normalized units)0.020 | min: 0 | step: 0.005Normalized slope magnitude treated as flat.
Slope energy = 100 scale0.300 | min: 0.001 | step: 0.01Normalized slope energy corresponding to a score of 100.
Cohort spread = ±100 scale0.300 | min: 0.001 | step: 0.01Fast/slow cohort spread corresponding to a ±100 score.
Horizon-distance weight power1.0 | range: 0–3 | step: 0.25Controls weighting by analytical-horizon distance.
Horizon orderingManual rank | options: Manual rank, Length ascendingOrders analytical horizons by explicit rank or ascending length.
Bundle-width rank lookback250 | range: 20–2000Lookback for the bundle-width percentile rank.
Bundle-width motion bars3 | range: 1–50Bars used to measure bundle-width change.
Reorder-rate lookback50 | range: 5–500Lookback used to calculate pair reorder rate.
Fast/slow cohort splitHorizon rank | options: Horizon rank, Median length, Manual lengthMethod used to split enabled MAs into fast and slow cohorts.
Fast cohort maximum rank4 | range: 1–7Highest horizon rank included in the fast cohort.
Fast cohort maximum length50 | range: 1–5000Maximum MA length included in the fast cohort under manual split.

3. Lifecycle thresholds

18 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
Bias composite threshold22.0 | range: 0–100 | step: 1Absolute composite threshold for Bullish or Bearish bias.
Directional order threshold62.0 | range: 0–100 | step: 1Order-coherence threshold for a directional structure.
Directional slope coherence45.0 | range: 0–100 | step: 1Slope-coherence threshold for directional alignment.
Compression width-rank maximum18.0 | range: 0–100 | step: 1Maximum bundle-width rank allowed for Compression.
Compression energy maximum32.0 | range: 0–100 | step: 1Maximum slope-energy score allowed for Compression.
Compression |order| maximum35.0 | range: 0–100 | step: 1Maximum absolute order coherence allowed for Compression.
Release |order| minimum48.0 | range: 0–100 | step: 1Minimum absolute order coherence required for Release.
Release width expansion minimum0.005 | min: 0 | step: 0.005Minimum normalized width expansion required for Release.
Release centroid acceleration minimum0.0 | min: 0 | step: 0.005Minimum direction-aligned centroid acceleration for Release.
Compression-to-release origin window3 | range: 1–20Bars within which a prior Compression can seed Release.
Pullback order-hold floor25.0 | range: 0–100 | step: 1Minimum directional order retained during Pullback.
Slow-cohort slope-hold threshold15.0 | range: 0–100 | step: 1Minimum directional slow-cohort slope retained during Pullback.
Deceleration comparison bars5 | range: 1–50Comparison interval for Deceleration tests.
Deceleration energy drop8.0 | range: 0–100 | step: 1Slope-energy decline sufficient for Deceleration.
Deceleration coherence drop10.0 | range: 0–100 | step: 1Slope-coherence decline sufficient for Deceleration.
Deceleration width contraction0.005 | min: 0 | step: 0.005Normalized bundle contraction sufficient for Deceleration.
Churn reorder-rate threshold5.0 | range: 0–100 | step: 0.5Reorder-rate threshold associated with churning structure.
Clarity penalty per reorder-rate point1.5 | range: 0–10 | step: 0.25Clarity points deducted per reorder-rate point.

4. Multi-timeframe matrix

5 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
Enable anchor timeframetrueEnables the anchor-timeframe comparison.
Anchor240Anchor timeframe; 240 is four hours.
Enable macro timeframetrueEnables the macro-timeframe comparison.
Macro1DMacro timeframe.
Requested HTF calculation bars5000 | range: 500–10000Requested history for higher-timeframe calculations.

5. Historical structure memory

4 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
Enable completed-episode memorytrueStores and summarizes completed bias/phase episodes.
Maximum completed episodes per state120 | range: 20–300Maximum completed episodes retained for each state.
Minimum samples before interpretation20 | range: 5–100Minimum memory samples before interpretation.
Persistence horizon (additional bars)10 | range: 1–100Additional bars used to measure persistence.

6. Event outcome lab

6 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
Enable forward outcome studytrueEnables descriptive forward-outcome sampling after events.
Study eventPullback Reclaim | options: Compression Release, Pullback Reclaim, Structural Failure, MTF Alignment, Expansion EntrySelects the event sampled by the outcome study.
Forward horizon (bars)20 | range: 1–250Bars measured after each study event.
Maximum completed samples200 | range: 20–500Maximum completed outcome samples retained.
Minimum samples before interpretation20 | range: 5–100Minimum outcome samples before interpretation.
Use non-overlapping samplestruePrevents overlapping forward windows from becoming separate samples.

7. Events and interaction engine

7 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
Confirm events on bar closetrueRestricts events to confirmed bar closes.
Phase bars before phase-entry event1 | range: 1–20Phase persistence required before a phase-entry event.
One displayed event per bartrueLimits displayed output to one event per bar.
Displayed-event cooldown bars0 | range: 0–100Cooldown between displayed events.
Maximum event labels40 | range: 10–300Maximum event labels retained on the chart.
Structural-failure order floor10.0 | range: 0–100 | step: 1Order floor used by structural-failure detection.
Structural-failure slow-slope flip5.0 | range: 0–100 | step: 1Slow-cohort slope threshold used by structural-failure detection.

8. Display

14 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
Show individual MAsfalseShows every enabled MA line.
Show fast/slow structure ribbontrueShows the fast/slow cohort structure ribbon.
Show ensemble centerlinetrueShows the enabled-MA ensemble centerline.
Show full MA bundle envelopefalseShows the full MA bundle high/low envelope.
Fill full MA bundlefalseFills the complete MA bundle envelope.
Show lifecycle background tintfalseTints the chart background by lifecycle phase.
Show fixed bottom-left regime HUDtrueShows the fixed bottom-left regime HUD.
HUD detailClean | options: Clean, Analyst, ResearchSelects Clean, Analyst, or Research HUD detail.
HUD text sizeNormal | options: Tiny, Small, Normal, LargeSets HUD text size.
HUD clearance above TradingView logo (%)6 | range: 3–16Adds bottom clearance above the TradingView logo.
Use HUD iconstrueUses icons in the HUD.
Use HUD meterstrueUses compact visual meters in the HUD.
Marker displayMajor only | options: Off, Major only, Key events, All eventsSelects which event markers are drawn over price.
Use marker iconstrueUses icons in chart markers.

9. Futuristic theme

17 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
Bullish / cyan#00C2FFBullish structure color.
Bearish / orange#FF7A45Bearish structure color.
Neutral#8A93A6Neutral structure color.
Accent / violet#B56CFFAccent color used for highlighted context such as Release.
Compression#5F6B82Compression phase color.
Deceleration#F2C94CDeceleration phase color.
Dashboard header#0B1220HUD header background color.
Dashboard panel#101A2EHUD primary panel background color.
Dashboard alternate#14213AHUD alternate panel background color.
Dashboard border#284564HUD border color.
Dashboard primary text#EAF2FFHUD primary text color.
Dashboard muted text#8FA5BFHUD muted text color.
Marker text#FFFFFFMarker text color.
Marker transparency5 | range: 0–100Marker transparency.
Preset MA transparency35 | range: 0–100Preset MA line transparency.
Centerline transparency10 | range: 0–100Ensemble centerline transparency.
Ribbon base transparency72 | range: 0–100Base transparency of the cohort ribbon.

MA 1 — Custom

8 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
EnabletrueEnables MA slot 1.
TypeEMA | options: EMA, SMA, WMA, RMA, HMA, DEMA, TEMA, VWMA, ALMA, KAMAMoving-average method for slot 1.
Length5 | range: 1–4000Calculation length for slot 1.
Horizon rank1 | range: 1–8Analytical horizon rank for slot 1; lower is faster and equal ranks are skipped.
NameFast 1Display name for slot 1.
Color#00B8FFLine color for slot 1.
Width1 | range: 1–4Line width for slot 1.
Transparency35 | range: 0–100Line transparency for slot 1.

MA 2 — Custom

8 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
EnabletrueEnables MA slot 2.
TypeEMA | options: EMA, SMA, WMA, RMA, HMA, DEMA, TEMA, VWMA, ALMA, KAMAMoving-average method for slot 2.
Length10 | range: 1–4000Calculation length for slot 2.
Horizon rank2 | range: 1–8Analytical horizon rank for slot 2; lower is faster and equal ranks are skipped.
NameFast 2Display name for slot 2.
Color#00E0C6Line color for slot 2.
Width1 | range: 1–4Line width for slot 2.
Transparency35 | range: 0–100Line transparency for slot 2.

MA 3 — Custom

8 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
EnabletrueEnables MA slot 3.
TypeEMA | options: EMA, SMA, WMA, RMA, HMA, DEMA, TEMA, VWMA, ALMA, KAMAMoving-average method for slot 3.
Length20 | range: 1–4000Calculation length for slot 3.
Horizon rank3 | range: 1–8Analytical horizon rank for slot 3; lower is faster and equal ranks are skipped.
NameFast 3Display name for slot 3.
Color#6C7BFFLine color for slot 3.
Width1 | range: 1–4Line width for slot 3.
Transparency35 | range: 0–100Line transparency for slot 3.

MA 4 — Custom

8 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
EnabletrueEnables MA slot 4.
TypeSMA | options: EMA, SMA, WMA, RMA, HMA, DEMA, TEMA, VWMA, ALMA, KAMAMoving-average method for slot 4.
Length50 | range: 1–4000Calculation length for slot 4.
Horizon rank4 | range: 1–8Analytical horizon rank for slot 4; lower is faster and equal ranks are skipped.
NameCore 1Display name for slot 4.
Color#B56CFFLine color for slot 4.
Width1 | range: 1–4Line width for slot 4.
Transparency35 | range: 0–100Line transparency for slot 4.

MA 5 — Custom

8 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
EnabletrueEnables MA slot 5.
TypeSMA | options: EMA, SMA, WMA, RMA, HMA, DEMA, TEMA, VWMA, ALMA, KAMAMoving-average method for slot 5.
Length100 | range: 1–4000Calculation length for slot 5.
Horizon rank5 | range: 1–8Analytical horizon rank for slot 5; lower is faster and equal ranks are skipped.
NameSlow 1Display name for slot 5.
Color#F45B9ALine color for slot 5.
Width1 | range: 1–4Line width for slot 5.
Transparency35 | range: 0–100Line transparency for slot 5.

MA 6 — Custom

8 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
EnabletrueEnables MA slot 6.
TypeSMA | options: EMA, SMA, WMA, RMA, HMA, DEMA, TEMA, VWMA, ALMA, KAMAMoving-average method for slot 6.
Length200 | range: 1–4000Calculation length for slot 6.
Horizon rank6 | range: 1–8Analytical horizon rank for slot 6; lower is faster and equal ranks are skipped.
NameSlow 2Display name for slot 6.
Color#FFAA3DLine color for slot 6.
Width1 | range: 1–4Line width for slot 6.
Transparency35 | range: 0–100Line transparency for slot 6.

MA 7 — Custom

8 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
EnablefalseEnables MA slot 7.
TypeEMA | options: EMA, SMA, WMA, RMA, HMA, DEMA, TEMA, VWMA, ALMA, KAMAMoving-average method for slot 7.
Length34 | range: 1–4000Calculation length for slot 7.
Horizon rank7 | range: 1–8Analytical horizon rank for slot 7; lower is faster and equal ranks are skipped.
NameCustom 7Display name for slot 7.
Color#7D8A99Line color for slot 7.
Width1 | range: 1–4Line width for slot 7.
Transparency45 | range: 0–100Line transparency for slot 7.

MA 8 — Custom

8 inputs
Input labelDefault / optionsWhat it controls and when to adjust it
EnablefalseEnables MA slot 8.
TypeSMA | options: EMA, SMA, WMA, RMA, HMA, DEMA, TEMA, VWMA, ALMA, KAMAMoving-average method for slot 8.
Length300 | range: 1–4000Calculation length for slot 8.
Horizon rank8 | range: 1–8Analytical horizon rank for slot 8; lower is faster and equal ranks are skipped.
NameCustom 8Display name for slot 8.
Color#AAB4C3Line color for slot 8.
Width1 | range: 1–4Line width for slot 8.
Transparency45 | range: 0–100Line transparency for slot 8.
05 — Alerts

Alerts report events, not decisions

Alerts are state, touch or transition events defined in the public source. They are not trade instructions.

  • MA structure compression release, expansion entered, compression entered and transition entered.
  • First MA bundle touch, MA bundle reclaim and MA structural failure.
  • MTF structure alignment gained and lost.
06 — Limitations and responsible use

Not a buy/sell signal

This tool is for analysis and visualization. It is not investment advice, a trade recommendation, a forecast, or a promise of profit or accuracy. Results depend on inputs, symbol, timeframe, and data feed. You remain responsible for every trading decision.

Moving averages lag

Alignment and high Clarity do not guarantee continuation, and CHURN does not guarantee reversal. Presets are not optimized strategies.

Statistics are conditional samples

MEM and OUT depend on symbol, timeframe, configuration and available history. Changing inputs changes the sample; it is not probability of profit or a backtest result.

Publication-version gap

The catalogue and initial description focus on the older Matrix. This guide prioritizes the current 1,613-line Regime Transition Lab source.

Important

Do not count Bias, Phase, Clarity, MTF and OUT as separate votes. They are related derivatives of the same moving-average structure, not independent evidence.

07 — FAQ

Frequently asked questions

Clarify the current version, Bias versus Phase, MTF handling and outcome statistics.

Is Moving Average Structure Matrix free to use?

Yes. It is a free, open-source indicator published by SG Group on TradingView. Review TradingView’s terms and the conditions attached to the public script before reuse or redistribution.

Should I change the settings immediately?

Start with the published defaults and observe the drawings and state changes first. Then change one input at a time for the symbol, timeframe and data feed so you can identify what caused each visual change.

Can I display it with other indicators?

Yes, but similar lines, bands, backgrounds and tables can overlap and obscure their source. Isolate each indicator first and hide duplicate components. Visual overlap alone is not stronger evidence or signal agreement.

Does the display provide trade signals?

No. It is analysis and visualization context consistent with the public description. It does not provide entries, exits, targets, stops, price forecasts, or promises of profit, win rate or accuracy.

Is OUT Positive frequency a strategy win rate?

No. It is a sign frequency in completed conditional samples. It contains no trade rules, fees, execution or position management, and changing the configuration changes the sample.

Source basis and update policy

This guide is grounded in SG Group’s live catalogue, the script’s published TradingView description, and the user-facing inputs in its open source. Labels and defaults can change after a script update.