Login Page - Create Account

Support Board


Date/Time: Mon, 06 Apr 2026 22:28:27 +0000



Linear regression - standard deviation bands

View Count: 12

[2026-04-06 18:33:45]
12VMan - Posts: 58
I want to plot a rolling linear regression line based on the past 100 bars with standard deviation bands of, for example, 1.5 and 2 std deviations. This plots like a Bollinger band. I cannot figure out how to do this - can you assist?

To be clear, I do not want a channel like Linear Regression End Channel plots. I want a moving line + bands that shows where the value was at the time of each bar.
[2026-04-06 18:53:54]
John - SC Support - Posts: 45501
To get the current value of a Linear Regression fit to the last 100 bars and display the per bar value, you would need to use the Spreadsheet Study with the "FORECAST()" function. In this case, the you would enter the following in cell K3 to fit to the "Last" for each bar:
=FORECAST(A3, ID0.SG4@3:ID0.SG4@102, A3:A102)

Refer to the following:
https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#FORECAST_Function

You could then find the Standard Deviation of the forecasted data - meaning the per bar fit to the data, using the "STDEV.S()" or "STDEV.P()" function.

But there is not a way direct way to get the Standard Deviations for the Linear Regression fit itself at each bar. You could do it in the Spreadsheet by finding the Slope and Intercept of the fit data at each point, then finding the straight line and directly calculating the Standard Deviation. This is beyond our Support in terms of helping you further with this.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2026-04-06 18:54:30

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account