Formula examples
Workbench examples
Explore daily Bitcoin transformations with independently sourced inputs. Each example keeps its own units, warmup, missing observations and source clocks; open the chart information for the exact calculation.
Simple MA, exponential MA and medians
Compare three ways to smooth daily ending quotes. A mean gives each observation equal weight, an EMA weights recent observations more, and a median selects the middle of an ordered window. Example: sma(price,200), ema(price,21) and median(price,90).
- BTC ending quote.
- Arithmetic mean of 200 adjacent daily quotes.
- 21-day EMA with its declared arithmetic seed.
- Median of 90 adjacent daily quotes.
The windows are different lengths. Differences between these lines reflect both the method and the window; they are not a like-for-like smoothing comparison.
Example: rolling SMA, EMA and median
Bitcoin's 200-day moving average: the average of its last 200 daily closing prices.
Cumulative maximum
A running maximum records the highest admitted daily closing quote so far. A 90-day maximum instead considers only a complete trailing window. Example: cummax(price) and max(price,90 days).
- BTC ending quote.
- Maximum over the available quote prefix.
- Maximum over 90 adjacent daily quotes.
These are closing-quote highs, not intraday highs or a complete exchange-market history. Missing input is not interpolated.
Example: all-time-high
The highest daily closing price bitcoin had reached up to each day.
Drawdown
Drawdown measures how far the current closing quote is below the highest earlier or current admitted close. The high updates causally as new observations arrive. Example: 100 * (price / running_high - 1).
- BTC ending quote and running closing high.
- Drawdown = 100 × (quote / running high − 1).
Zero indicates a closing high; negative values indicate a decline from it. The shaded percentage and the USD/BTC lines have separate axes. This is not an intraday maximum-loss calculation.
Rolling sum
Add 365 adjacent daily fee reference values to compare the current fee flow with a trailing year of activity. Each daily BTC fee total is converted with its own ending quote before summation. Example: sum(daily_fee_BTC * daily_ending_quote,365).
- BTC ending quote.
- Daily transaction fees at the ending quote.
- Sum of 365 complete daily USD fee observations.
The sum is a trailing flow in USD, not an annualized daily amount. Incomplete windows remain undefined.
Example: rolling yearly sum
The total fees Bitcoin users paid each day, week or month, in US dollars at the period's closing price.
Cumulative sum
A cumulative sum adds daily raw transfer reference values from a declared origin. A second line starts on 30 January 2020, allowing the effect of the starting date to be seen directly. Example: cumsum(daily_raw_transfer_BTC * daily_ending_quote).
- Daily raw output transfer value at its ending quote.
- Cumulative value from the complete priced origin.
- Cumulative value from 30 January 2020.
Raw outputs include change and self-transfers. These totals can count the same BTC repeatedly; they are neither supply nor net capital entering Bitcoin. A missing daily input breaks the complete cumulative prefix.
Example: cumulative sum
The running total of all bitcoin sent on-chain, in US dollars at each day's closing price, with nothing taken out for change or moves between an owner's own addresses.
Percent change
Compare the current quote with the quote exactly 30 UTC days earlier. Percentage change expresses the difference relative to that earlier positive value. Example: 100 * (price / price_30_days_earlier - 1).
- BTC ending quote.
- 100 × (quote / quote 30 days earlier − 1).
This daily endpoint comparison is not an intraday return. Required missing observations remain gaps; no interpolation creates a return.
Example: percent change
How much bitcoin's daily closing price rose or fell over the last 30 days, in percent.
Difference
Subtract the stock measured 30 days earlier from the current stock of outputs aged at least one fixed 365-day year. This change remains denominated in BTC. Example: aged_supply(t) - aged_supply(t-30 days).
- BTC ending quote.
- Native output supply aged at least 365 days.
- Current aged stock minus its 30-day-earlier stock.
Coins age into this population and spending removes outputs from it. A positive change does not identify buying or a particular owner. Native block-header age is the actual age convention.
Example: difference
The bitcoin that has not moved for at least a year.
Absolute value
Subtract 600 seconds from the signed daily mean block interval, then take the magnitude of that difference. The signed line shows direction; the absolute line shows distance from the reference. Example: abs(mean_signed_interval - 600).
- BTC ending quote on its own axis.
- Signed daily mean interval minus 600 seconds.
- Absolute value of that difference.
Block-header timestamps can regress. The mean uses actual signed parent-header differences, so unusual negative means are retained rather than corrected into positive intervals.
Example: absolute value
The day's average time between blocks minus the 10-minute target, in seconds.
Round up and down
Round a 30-day arithmetic mean of native created-output BTC amounts to compare different decimal-place rules. Rounding changes presentation precision, not the underlying inputs. Example: round(mean30,0), ceil(mean30/100)*100, floor(mean30/10)*10.
- Mean created-output amount after a 30-day mean.
- Nearest integer BTC, with the stated tie rule.
- Ceiling to a multiple of 100 BTC.
- Floor to a multiple of 10 BTC.
Negative decimal places specify tens or hundreds; they do not mean a number of significant figures. These native output statistics include their stated coinbase and output-eligibility scope.
Example: round
The average size of the new coins made by the transactions of each period.
Value at a date
Compare the daily quote with horizontal references obtained from exact UTC dates. A latest-value reference describes the latest eligible observed quote, not a known future price. Example: value_at(price,"2020-03-12") and value_at(price,"2016-08-01").
- Latest retained closed-day quote reference.
- Quote labeled 12 March 2020.
- Quote labeled 1 August 2016.
A fixed-date value remains unavailable when its exact source observation is absent. Historical reference lines use information from their stated date and must not be interpreted as a signal already known before it.
Example: value at timestamp
Bitcoin's latest daily closing price, drawn as a level across the chart.
Maximum and minimum
Compare quote-to-trend ratios with their declared extrema. One ratio divides price by a 200-day arithmetic mean; the other divides it by a 90-day EMA. Example: price / sma(price,200) and price / ema(price,90).
- Quote / 200-day arithmetic mean.
- Quote / 90-day EMA.
- Maximum and minimum across both ratio series over the full admitted closed prefix at read time.
A horizontal extremum summarises the full admitted closed prefix available at read time, independently of zoom. It therefore contains lookahead when drawn over earlier dates. It is not the point-by-point upper or lower curve, and a sample-wide result can use observations later than an earlier plotted date. Extrema use all eligible ratio observations in the complete closed quote prefix at read time, not the visible viewport. An interior missing raw quote makes the annotation undefined.
Example: max and min
The Mayer Multiple: Bitcoin's price divided by its average price over the last 200 days.
Upper and lower bounds
Choose the highest or lowest value at each date from the smoothed created/spent output counts and a constant reference. This illustrates pointwise bounds rather than a historical maximum. Example: max(created_EMA30,spent_EMA30,250000) and min(created_EMA30,spent_EMA30,600000).
- Created and spent output counts, each with a 30-day EMA.
- Upper curve: maximum of both counts and 250,000.
- Lower curve: minimum of both counts and 600,000.
The constants are demonstration inputs, not estimated network limits. Outputs are not transactions or owners. Unknown required counts stay undefined.
Example: upper and lower
The number of separate amounts of bitcoin created by transactions in each period: every payment received, and every piece of change returned to a sender, is one.
Shift
Move daily quote observations by exactly 365 UTC days along the time axis. Positive displacement puts an earlier source observation at a later plotted date; negative displacement does the reverse. Example: shift(price,+365 days) and shift(price,-365 days).
- Original BTC ending quote.
- Same observations shifted forward by 365 days.
- Same observations shifted backward by 365 days.
The backward shift exposes future information at earlier x-axis dates and is for illustration only. Original observation clocks remain attached; shifting does not make a new observation.
Example: shift
Bitcoin's daily closing price drawn one year later than it happened, so that each date shows the price a year before.
Subset
Keep the quote only inside two declared calendar intervals. Values outside each interval are missing, not zero, and the original full quote remains a separate comparison. Example: subset(price,start,end).
- 29 November 2013 through 17 December 2017.
- 12 March 2020 through 31 December 2022.
Endpoints follow the exact inclusive/exclusive UTC convention in the method details. These examples select dates; they do not establish scientifically detected market-cycle boundaries.
Example: subset
Bitcoin's daily closing price from 29 November 2013 to 17 December 2017 only.
If–Then conditional
A condition selects one result when a comparison is true and another when it is false. Here, it compares 14-day arithmetic means of spent and created output counts. Example: if(spent_SMA14 > created_SMA14,1,0).
- Created output count after a 14-day mean.
- Spent output count after a 14-day mean.
- Return 1 when the spent mean is strictly greater; otherwise return 0.
Equality belongs to 0. Missing inputs remain undefined and cannot be classified as false. The binary result has its own axis and is not a count, price or probability.
Conditions can distinguish =, !=, >, >=, < and <=. This fixed example deliberately uses >; changing it to >= changes equal-value cases.
Example: if-then conditional (outputs)
The number of separate amounts of bitcoin created by transactions in each period: every payment received, and every piece of change returned to a sender, is one.
Example: if-then conditional (index)
The share of the last 14 days on which more outputs were spent than created: days when the set of unspent coins shrank.
Logarithms, exponents and roots
Use a natural logarithm and its exponential inverse to demonstrate a consistent transformation pair. The positive square root is a separate power transformation. Example: ln(price / 1 USD per BTC), exp(ln_price) and sqrt(price).
- Natural logarithm of a positive quote.
- Exponential of that natural logarithm.
- Positive square root of the quote.
Logarithms are taken relative to one USD/BTC unit. The logarithm is dimensionless; the inverse reconstructs USD/BTC and the root has square-root units. A power of −0.5 would be a reciprocal square root, which is not the curve shown here.
Example: logarithm and exponentials (USD/BTC)
Bitcoin's daily closing price, rebuilt by taking its natural logarithm and then reversing it: a worked example that returns the price itself.
Example: logarithm and exponentials (log ratio)
The natural logarithm of bitcoin's daily closing price, which turns equal percentage moves into equal steps.
Example: logarithm and exponentials (sqrt(USD/BTC))
The square root of bitcoin's daily closing price.
Cumulative mean
An expanding mean averages every required daily quote from a fixed origin through the current date. Starting later changes the population and the result. Example: expanding_mean(price,since).
- Mean over the complete available quote prefix.
- Mean from 17 December 2017.
Each day receives equal weight. The starting date is fixed independently of chart zoom; missing required history is not silently skipped or replaced by the first visible observation.
Example: cumulative mean
The average of every daily closing price from the start of the price record to each day.
Rolling standard deviation
Measure dispersion of quote levels within fixed trailing windows. The 1,460-day window is four fixed 365-day years; the shorter window contains 90 daily observations. Example: std(price,1460) and std(price,90).
- Standard deviation of 1,460 adjacent daily quotes.
- Standard deviation of 90 adjacent daily quotes.
Population standard deviation divides the squared-deviation sum by N. These are dispersions of price levels in USD/BTC, not annualized volatility of returns. Full warmup is required before the first value.
Example: rolling standard deviation
How widely bitcoin's daily closing price has ranged over the last 4 years: the standard deviation of those closes, in US dollars.
Cumulative standard deviation
Measure dispersion over an expanding quote sample, either from the complete quoted origin or from 14 January 2015. The starting population stays fixed when the displayed range changes. Example: expanding_std(price,since).
- Expanding standard deviation from the quoted origin.
- Expanding standard deviation from 14 January 2015.
Population standard deviation divides by N and follows the complete declared daily prefix. Standard deviation is not a cumulative mean, and these level statistics are not return-volatility estimates.
Example: cumulative standard deviation
How widely bitcoin's daily closing price has ranged over all history to each day: the standard deviation of every close so far, in US dollars.
Relative strength index
Wilder RSI compares smoothed daily upward and downward quote changes over a 14-day period. An arithmetic seed and the stated flat-window behavior make the calculation reproducible. Example: RSI_Wilder(price,14).
- BTC ending quote.
- 14-day Wilder RSI.
- Horizontal guides at 30 and 70.
The oscillator ranges from 0 to 100. The displayed axis includes extra headroom to preserve the example’s visual separation; the guides do not establish a trading rule or guarantee a reversal.
Example: RSI
Bitcoin's 14-day RSI (relative strength index): recent daily gains against recent daily losses, on a scale of 0 to 100.
Pearson correlation
Compare co-movement between daily raw transfer BTC volume and daily mean serialized transaction size in bytes over 365 adjacent observations. Correlation is dimensionless and uses aligned native populations. Example: corr(raw_transfer_BTC,mean_serialized_transaction_bytes,365).
- BTC ending quote as a separate context.
- Raw transferred output BTC.
- Rolling 365-day Pearson coefficient.
The coefficient is undefined for a constant input or an incomplete required window. It does not measure causation. Raw output volume includes change and self-transfers; the size input is the daily mean serialized transaction size in bytes.
Example: pearson correlation (BTC)
Bitcoin's raw on-chain volume: the total BTC in all transaction outputs created in the period, before any adjustment.
Transfer volume to transaction size correlation (1-year)
How closely the dollar value sent on-chain each day has moved with the size of the day's transactions in bytes over the last year: a correlation from -1 to +1.
Calculated from our own Bitcoin and Ethereum nodes and from market, fund and company data we collect. Free charts and their data are CC BY 4.0. Method and sources