I was using a Standard Deviation Channel Double indicator that I found here a long time ago. I wanted to have the same visual with clouds with the 50 and 100 Linear Regressions, so I came up with this. It's crude but it works. Suggestions for improvement are welcome!
Code:
#
# TD Ameritrade IP Company, Inc. (c) 2008-2022
# 2-11-23 Modified by Jeff Horton to show 50 and 100 lines together with clouds for clarity
input price = close;
input length = 21;
plot MiddleLR = InertiaAll(price);
def dist = HighestAll(AbsValue(MiddleLR - price)) * 0.5;
plot UpperLR = MiddleLR + dist;
plot LowerLR = MiddleLR - dist;
MiddleLR.setDefaultColor(GetColor(7));
MiddleLR.SetStyle(Curve.LONG_DASH);
UpperLR.setDefaultColor(GetColor(1));
LowerLR.setDefaultColor(GetColor(5));
def dist1 = HighestAll(AbsValue(MiddleLR - price));
plot UpperL1 = MiddleLR + dist1;
plot LowerLR1 = MiddleLR - dist1;
UpperL1.setDefaultColor(GetColor(1));
LowerLR1.setDefaultColor(GetColor(5));
AddCloud(UpperL1, UpperLR, Color.white, Color.white);
AddCloud(LowerLR1, LowerLR, Color.white, Color.white);
Last edited: