# Posted from Mobius 1/15/18 - This puts a Horizontal Line at Price to see price level at potential Support / Resistance
# Here is a code Snippet that gives you all you need to limit a line both forward and backward
# Dynamic_Line
# Mobius
# V01.09.2012
input LineLimit = 100;
input OnExpansion = yes;
input OnExpansionLimit = 30;
input bubble_mover = 5; #Moves bubbles left/right then number of bars input here
def n = bubble_mover;
def n1 = n +1;
def c = close; # Replace close with any conditional value that meets your requirement
def barNumber = barNumber();
def bar = if IsNaN(c) then Double.NaN else BarNumber();
def ThisBar = HighestAll(bar);
def cline = if bar == ThisBar then c else Double.NaN;
def condi = CompoundValue(1, if IsNaN(c) then condi [1] else c, c);
plot P = if ThisBar - LineLimit <= bar then HighestAll (cLine) else Double.NaN;
P.SetStyle(Curve.Short_Dash);
P.SetLineWeight(1);
P.SetDefaultColor(CreateColor(75,250,150));
plot ExpLine = if OnExpansion and barNumber < HighestAll (bar + OnExpansionLimit) and IsNaN(c) then condi else Double.NaN;
ExpLine.SetStyle(Curve.Short_Dash);
ExpLine.SetLineWeight(1);
ExpLine.SetDefaultColor(CreateColor(150,150,150));
# End Code Dynamic Line Mobius • 8:23 PM
input show_bubbles = yes;
def current = !isnan(close[n1])and isnan(close[-1]);
AddChartBubble(show_bubbles and current, c, Round(c), color.cyan,yes
);