# Plot 52-week high/low once using current symbol

##### New member
VIP
Hello,
Looking to plot 52 week high and 52 week low once and not dynamically update (recalculate) with each tick.

Code:
``````def Start;
def Finish;

if (GetUnderlyingSymbol() == GetSymbol())
{
Start = Highest(high, 252);
Finish = Lowest(low, 252);
}
else
{
Start = Double.NaN;
Finish = Double.NaN;
}``````

#### Nikola

##### Member
Using this to show a dashed line for 52wk high, how can i add a price bubble to show on the right axis

Code:
``````def a = Highest(high, 252);
def barNumber = barNumber();
def bar = if IsNaN(a)
then Double.NaN
else BarNumber();
def ThisBar = HighestAll(bar);
def Line = if bar == ThisBar
then a
else Double.NaN;
plot P = if ThisBar
then HighestAll(Line)
else Double.NaN;
P.SetStyle(Curve.Short_Dash);
P.SetLineWeight(1);
P.SetDefaultColor(CreateColor(75,250,150));``````

#### BenTen

Staff
VIP

Code:
``````input showBubble = yes;
def SR = showBubble and !IsNaN(close) and IsNaN(close [-1] ) && HighestAll(BarNumber());
AddChartBubble(SR and p, HighestAll(Line), "Highest", Color.RED, yes);``````

• mourningwood4521

#### Nikola

##### Member
how can i add to the code to show the 52wk low also?

#### BenTen

Staff
VIP
@Nikola Here you go:

Code:
``````def a = Lowest(low, 252);
def barNumber = barNumber();
def bar = if IsNaN(a)
then Double.NaN
else BarNumber();
def ThisBar = HighestAll(bar);
def Line = if bar == ThisBar
then a
else Double.NaN;
plot P = if ThisBar
then HighestAll(Line)
else Double.NaN;
P.SetStyle(Curve.Short_Dash);
P.SetLineWeight(1);
P.SetDefaultColor(CreateColor(75,250,150));

input showBubble = yes;
def SR = showBubble and !IsNaN(close) and IsNaN(close [-1] ) && HighestAll(BarNumber());
AddChartBubble(SR and a, HighestAll(Line), "Lowest", Color.Green, yes);``````

#### Nikola

##### Member
It wont work in the same script because the "def a" and "plot p".

Can the bubbles be moved to the left so they don't block stuff?

Last edited by a moderator: