The following chart shows HD (Home Depot) compared with a LOW (Lowe's Companies) script with 2 lines (one with 0 days displacement and line width of 1, second with 14 days displacement and line width of 3)):
View attachment 21740
Both HD and LOW track similarly.
I see in your new post you want the inverse of LOW:
Change in the script to:
plot s = 1 / symbol[displaceLength];
Are you wanting to move/shift the 14 day displacement forward to match the same time with HD?
There are extra options (labels, bubble with move, cloud) included in script (attaches in lower grid, move to upper, if needed):
Code:
declare lower;
input bubble = no;
input bubbleMoveH = 0; # bubble Move Horizontal
input bubbleMoveV = 0.0; # bubble Move Vertical
input cloud = no;
input DisplaceLength = 0;
input label = yes;
input Length = 1;
def symbol = close("LOW");
plot s = symbol[displaceLength];
s.DefineColor("Up", GetColor(6));
s.DefineColor("Down", GetColor(5));
s.AssignValueColor(if s > s[1] then s.Color("Up") else s.Color("Down"));
s.SetLineWeight(1);
s.SetStyle(1);
s.HideBubble();
s.HideTitle();
def data = if isNaN(s) then data[1] else s + bubbleMoveV * TickSize();
def x = !IsNaN(close[(0+(+bubbleMoveH))]) and IsNaN(close[(-1+(+bubbleMoveH))]);
def y = data;
AddChartBubble(Bubble and x, y,
symbol + " " + Round(y, 2),
s.TakeValueColor(),
if s > s[1] then yes else no);
def k = 0;
def bubline = IsNaN(close[k]) and !IsNaN(close[bubbleMoveH + 0]);
def w = if (bubble and !IsNaN(close[k]) and IsNaN(close[k - 1])) then s[k] else if bubline then w[1] else double.NaN;
plot zw = w;
zw.SetDefaultColor(Color.GRAY);
zw.SetLineWeight(1);
zw.HideBubble();
zw.HideTitle();
AddLabel(label, if s > s[1] then
" LOW "
else
" LOW ",
if s > s[1] then color.GREEN else color.RED);
def hiLevel = if s >= s[-1] then Double.POSITIVE_INFINITY else Double.NEGATIVE_INFINITY;
AddCloud(if cloud and -hiLevel then -hiLevel else double.NaN, hiLevel, color.GREEN, color.RED);