I have a somewhat curious question regarding linear regression

J007RMC

Well-known member
2019 Donor
Probably most of you all know the answer to my question but I need answers too. So, when using the linear regression indicator and it seems realistic to me is to turn the drawn lines off and use the averages alone to find targets? And Im just throwing this out there. My for instance is the model I am using shows optionable: Avg, Avg 2, Avg 3.
# Mobius
# Mobius at MyTrade
# V02.04.2014 :

input price = hl2;
input n = 500;
input StartDate = 0;
input StartTime = 00;
input ExtendToRight = yes;
input ExtendToLeft = no;
input nAvg200 = 200;
input nAvg50 = 50;
input nAvg21 = 21;
input widthOfChannel = 2.0;
input fib1 = 0.382;
input fib2 = 0.618;
input fib3 = 0.764;

def o = open;
def h = high;
def l = low;
def c = close;
def ATR = Average(TrueRange(h, c, l), 21);
plot Avg = Average(c, nAvg200);
Avg.SetDefaultColor(Color.WHITE);
plot Avg2 = Average(c, nAvg50);
Avg2.SetDefaultColor(Color.YELLOW);
plot Avg3 = Average(c, nAvg21);
Avg3.SetDefaultColor(Color.GRAY);
plot MidLine = InertiaAll(price, n, StartDate, StartTime, ExtendToLeft, ExtendToRight);
def dist = HighestAll(StDev(h + l) / 2) * widthOfChannel;

plot UpperBand = MidLine + dist;
plot LowerBand = MidLine - dist;
plot UpperFibLine1 = (UpperBand - MidLine) * fib1 + MidLine;
plot UpperFibLine2 = (UpperBand - MidLine) * fib2 + MidLine;
plot UpperFibLine3 = (UpperBand - MidLine) * fib3 + MidLine;
plot LowerFibLine1 = (LowerBand - MidLine) * fib1 + MidLine;
plot LowerFibLine2 = (LowerBand - MidLine) * fib2 + MidLine;
plot LowerFibLine3 = (LowerBand - MidLine) * fib3 + MidLine;

LowerBand.SetLineWeight(2);
MidLine.SetLineWeight(2);
UpperBand.SetLineWeight(2);
LowerBand.SetDefaultColor(Color.BLUE);
MidLine.SetDefaultColor(Color.GRAY);
UpperBand.SetDefaultColor(Color.BLUE);
UpperFibLine1.SetDefaultColor(Color.GRAY);
UpperFibLine2.SetDefaultColor(Color.GRAY);
UpperFibLine3.SetDefaultColor(Color.GRAY);
LowerFibLine1.SetDefaultColor(Color.GRAY);
LowerFibLine2.SetDefaultColor(Color.GRAY);
LowerFibLine3.SetDefaultColor(Color.GRAY);
UpperFibLine1.SetStyle(Curve.SHORT_DASH);
UpperFibLine2.SetStyle(Curve.SHORT_DASH);
UpperFibLine3.SetStyle(Curve.SHORT_DASH);
LowerFibLine1.SetStyle(Curve.SHORT_DASH);
LowerFibLine2.SetStyle(Curve.SHORT_DASH);
LowerFibLine3.SetStyle(Curve.SHORT_DASH);
#end

Last edited:

horserider

Well-known member
VIP
Then just plot the three moving averages. That is all those are , simple moving averages.