All indicators

Cubic Regression Moving Average (CRMA)

Fits a cubic curve to the lookback window by least squares and plots the fitted value at the newest bar.

BTCUSD1h
Fixed data to Oct 6, 2026, UTC
Loading the chart

CRMA fits a third-degree polynomial to the prices in the window by least squares, with x counting bars back from the newest (x = 0 is this bar). The fit is found by solving the four normal equations with Gaussian elimination and partial pivoting, and the line is the curve's value at x = 0.

A straight-line fit lags when a trend is speeding up or slowing down. A cubic can bend, so it follows acceleration and deceleration more closely. The window grows from the first bar up to the period; with fewer than four bars a cubic cannot be fitted, and the line is the price itself. If the equations are singular the line also falls back to the price. A missing source value reads as zero.

How to read Cubic Regression Moving Average (CRMA)

Read CRMA as a fast, low-lag moving average. Compared with a linear regression or a simple average of the same length, it usually sits closer to price and turns sooner. The price of that speed is overshoot: at a sharp reversal a cubic can swing past price before settling.

Use a longer period to calm it down. A crossing of price and CRMA comes earlier than with slower averages, so confirm it with the slope of the line.

Settings

Period
Number of bars in the regression window, at least 4. A longer window gives a steadier fit.
Source
The series being fitted, usually the close.

Frequently asked questions

Why does it overshoot price at turns?

A cubic can bend sharply, so near a reversal the fitted curve can extend beyond the latest price. A longer period reduces the effect.

Why does it need at least four bars?

A cubic has four coefficients, so it needs at least four points to fit. Before four bars exist the line is the price itself.

Write your own in OpenScript

Every study here is plain OpenScript. Change a setting, combine two, or turn one into a strategy, then backtest it in /trading and run it in sandbox trading (analyzer mode in OpenAlgo) before going further.