Systemicbeta

Average

systemic:core-avgStatistics

Inputs

NameTypeDescription
DataNumber seriesThe series of numbers to compute the cumulative (running) average of.

Outputs

NameTypeDescription
AverageNumber seriesThe running (cumulative) average: each bar holds the mean of all input values from the start up to that bar.

Cost

6
credits per run
1,000
bars

0.202 + 0.00569·n credits for n bars, rounded up. The marks are each plan's limit of bars.

The Cumulative Average module computes the running mean of a series. At each bar, it returns the average of all values from the start up to that bar.

xˉn=1n∑i=1nxi\bar{x}_n = \frac{1}{n} \sum_{i=1}^{n} x_i

How It Works

flowchart TD
    subgraph Input["Input Series"]
        D["x1, x2, x3, ... xn"]
    end
    
    subgraph Process["Cumulative Calculation"]
        S1["Position 1: x1"]
        S2["Position 2: sum / 2"]
        S3["Position 3: sum / 3"]
        SN["Position n: sum / n"]
    end
    
    subgraph Output["Running Average"]
        R["avg1, avg2, avg3, ... avgn"]
    end
    
    D --> S1 --> S2 --> S3 --> SN --> R

Step-by-Step Example

PositionInput ValueCumulative SumRunning Average
1101010.0
2203015.0
3154515.0
4257017.5
53010020.0

The Stabilization Effect

As more data accumulates, each new value has less impact on the average.

After N ValuesNew Value WeightEffect
250%High sensitivity
1010%Moderate sensitivity
1001%Low sensitivity
10000.1%Nearly stable

Cumulative Average vs Moving Averages

AspectAVGSMAEMA
WindowAll dataFixed rollingWeighted decay
MemoryFull historyLimitedFading
SensitivityDecreasesConstantConstant
Best forBaselinesTrendsResponsive

The Philosophy of Averages

The arithmetic mean turns a set of observations into one representative value.

"The arithmetic mean is a point of balance—the fulcrum where all deviations cancel out."

The cumulative average has one special property: it remembers everything. A rolling window forgets old data; the cumulative average keeps the whole history. This is both a strength and a limitation:

  • Strength: Provides a stable, long-term reference point
  • Limitation: Slow to react to regime changes

Creative Application 1: The "Gravitational Pull" Trading Concept

Markets often seem to have a center of gravity. The cumulative average can serve as this "gravitational mean": a price level that prices tend to return to.

flowchart TD
    subgraph MarketPhysics["Market Gravity Concept"]
        PRICE["Current Price"]
        AVG["Cumulative Average<br/>(Gravitational Center)"]
        ABOVE["Price > Average<br/>Extension above equilibrium"]
        BELOW["Price < Average<br/>Compression below equilibrium"]
    end
    
    PRICE --> |"Distance from center"| AVG
    AVG --> ABOVE
    AVG --> BELOW
    ABOVE --> |"Pull back toward mean"| AVG
    BELOW --> |"Pull back toward mean"| AVG
    
    style AVG fill:#3498db,stroke:#fff,color:#fff

Research Insight: Studies on mean reversion suggest that extreme deviations from long-term averages tend to correct over time. The cumulative average is a neutral baseline because it weights every historical price equally. This idea underpins strategies like pairs trading and statistical arbitrage.


Creative Application 2: Dollar-Cost Averaging Tracker

Dollar-cost averaging (DCA) means buying at regular intervals. If you buy the same number of units each time, the cumulative average of the prices is your average cost. Comparing it with the current price shows whether you are buying at a premium or a discount.

flowchart LR
    subgraph DCA["DCA Performance System"]
        BUY["Monthly Purchase"]
        PRICE["Current Price"]
        AVG["Cumulative Avg<br/>(Your Cost Basis)"]
        COMPARE{"Price vs Avg?"}
        PREMIUM["Buying at Premium ⚠️"]
        DISCOUNT["Buying at Discount ✓"]
    end
    
    BUY --> PRICE
    BUY --> AVG
    AVG --> COMPARE
    PRICE --> COMPARE
    COMPARE -->|"Price > Avg"| PREMIUM
    COMPARE -->|"Price < Avg"| DISCOUNT
MonthPriceYour Avg CostStatus
Jan$50$50.00—
Feb$45$47.50Buying at discount
Mar$60$51.67Buying at premium
Apr$40$48.75Buying at discount
May$55$50.00Buying at premium

Key Insight: When the current price is below your cumulative average, your next purchase lowers your average cost. This view helps investors stay disciplined during drawdowns, when emotional selling is most tempting.


Practical Applications

1. Lifetime Performance Baseline

Track the lifetime average return of a strategy or portfolio. The stabilization effect makes this baseline steadier over time.

2. Fair Value Reference

Use the cumulative average of earnings, revenues, or other fundamentals as a "fair value" anchor.

3. Regime Detection

Compare current values to the cumulative average. Persistent deviations may signal regime changes:

  • Sustained above average: Expansion regime
  • Sustained below average: Contraction regime

Missing Data

Gaps in the input (a closed market, a missing value) are gaps in the output, never zero. The output is empty at that bar. The running average skips the gap and continues from the next value, so it only counts bars that have data.

Edge Cases

ScenarioBehavior
Empty inputReturns empty output
Single valueReturns that value
Missing value (gap)Output at that bar is empty; the running average continues from the next value, unaffected by the gap
All values missingEvery output value is empty

Further Reading

Rendering diagrams...
© 2026 WanoLabs. All rights reservedBeta v0.1.5