<edited>
1) Included transparency ability under Globals tab in Edit Studies and Strategies dialog.
2) Included line code "# replace... " for user to change code to half-Cloud instead of full-Cloud.
I added a dynamic Cloud and Label (Up = GREEN / Down = RED) to the LinearRegChVar study found here:
https://toslc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/G-L/LinearRegChVar
1) Included transparency ability under Globals tab in Edit Studies and Strategies dialog.
2) Included line code "# replace... " for user to change code to half-Cloud instead of full-Cloud.
I added a dynamic Cloud and Label (Up = GREEN / Down = RED) to the LinearRegChVar study found here:
https://toslc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/G-L/LinearRegChVar
Code:
input Cloud = no;
input price = close;
input widthOfChannel = 100.0;
input fullRange = Yes;
input Label = yes;
input length = 21;
plot MiddleLR;
if (fullRange)
then {
MiddleLR = InertiaAll(price);
} else {
MiddleLR = InertiaAll(price, length);
}
def dist = HighestAll(AbsValue(MiddleLR - price)) * (widthOfChannel / 100.0);
plot UpperLR = MiddleLR + dist;
plot LowerLR = MiddleLR - dist;
MiddleLR.DefineColor("Up", GetColor(6));
MiddleLR.DefineColor("Down", GetColor(5));
MiddleLR.AssignValueColor(if MiddleLR > MiddleLR[1] then MiddleLR.Color("Up") else MiddleLR.Color("Down"));
MiddleLR.SetLineWeight(1);
MiddleLR.SetStyle(1);
MiddleLR.HideBubble();
MiddleLR.HideTitle();
UpperLR.DefineColor("Up", GetColor(6));
UpperLR.DefineColor("Down", GetColor(5));
UpperLR.AssignValueColor(if UpperLR > UpperLR[1] then UpperLR.Color("Up") else UpperLR.Color("Down"));
UpperLR.SetLineWeight(1);
UpperLR.SetStyle(1);
UpperLR.HideBubble();
UpperLR.HideTitle();
LowerLR.DefineColor("Up", GetColor(6));
LowerLR.DefineColor("Down", GetColor(5));
LowerLR.AssignValueColor(if LowerLR > LowerLR[1] then LowerLR.Color("Up") else LowerLR.Color("Down"));
LowerLR.SetLineWeight(1);
LowerLR.SetStyle(1);
LowerLR.HideBubble();
LowerLR.HideTitle();
DefineGlobalColor("UpperLR", GetColor(6));
AddCloud(if Cloud and MiddleLR > MiddleLR[1] then LowerLR else double.NaN, UpperLR,
GlobalColor("UpperLR"), GlobalColor("UpperLR")); # replace LowerLR with MiddleLR for shading upper half
DefineGlobalColor("LowerLR", GetColor(5));
AddCloud(if Cloud and MiddleLR < MiddleLR[1] then UpperLR else double.NaN, LowerLR,
GlobalColor("LowerLR"), GlobalColor("LowerLR")); # replace UpperLR with MiddleLR for shading lower half
AddLabel(Label,
if MiddleLR > MiddleLR[1] then
" Bullish "
else
" Bearish ",
if MiddleLR > MiddleLR[1] then Color.GREEN else Color.RED);
Last edited: