# 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;
def c = (close+10); # 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, Round(c));
#plot P = if ThisBar - LineLimit <= bar then HighestAll (cLine) else Double.NaN;
#P.SetStyle(Curve.Short_Dash);
#P.SetLineWeight(1);
#P.SetDefaultColor(CreateColor(100,100,200));
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(Color.Light_Red);
#ExpLine.SetDefaultColor(CreateColor(150,150,150));
# End Code Dynamic Line Mobius • 8:23 PM
input show_bubbles = yes;
def current = !isnan(close) and isnan(close[-1]);
#AddChartBubble(show_bubbles and current, c, Round(c), color.dark_orange, no);
input bubble_mover = 2; #Moves bubbles left/right then number of bars input here
def n = bubble_mover;
def n1 = n +1;
AddChartBubble(show_bubbles ,cline[n1], "Target " +
AsDollars(condi) , Color.dark_orange, yes);