#### PocketsofTime

##### New member

I have the standard deviation code, I just want to plot the middle regression line off the 4H chart on another Time Frame.

It's still drawing the line of the time frame I am currently in.

Can someone point out where I went astray?

Eventually I gong to input other deviations and time frames but need to get this one first. I took out the other inputs to try and simplify the code.

Code:

```
input length = 21;
input agg = aggregationPeriod.FOUR_HOURS;
def price = close(period = agg);
def regression;
def stdDeviation;
if (fullRange) {
regression = InertiaAll(price);
stdDeviation = stdevAll(price);
} else {
regression = InertiaAll(price, length);
stdDeviation = stdevAll(price, length);
}
plot MiddleLine = regression;
MiddleLine.SetStyle(Curve.SHORT_DASH);
MiddleLine.SetDefaultColor(color.Red);
```