# Left Extending Line at Current Low

#### MFitz73

##### Member
Hi guys, I like to trade(2min chart) bounces and reversals off the low of day or dips. I spend time drawing horizontal lines on the 1y1D chart to find possible bottoms where I would take a trade. I thought if I had a left extending line on the 1y1D chart that moved with the current price it would help me quickly identify areas where the bounce might happen.
I do have a code that works sort of. But the problem is that it doesn't update unless I refresh the chart by switching to another time frame and back again.
here is the code that I use on the 1y1d chart:
plot hide = double.nan;
hide.SetDefaultColor(Color.black);
plot priceLine = lowestAll(if isNaN(low[-1])
then low else Double.NaN);

Is there a way to do this and have the line update in realtime? Also if this can be done, I think some kind of graphic element where if the left extending line is matching up with any low or close of any candle on the 1y1D chart would really be helpful. Maybe if the current price is with in, for example, 10 cents of any close or low on the 1y1D chart, there would be a dot painted at the bottom of those candles. But would not be there if the Left extending line is not within that 10 cent or less
threshold.
thanks so much in advance for any help.
Mike Fitz

Last edited:
Solution
@MFitz73
Recycled code from another post.

Code:
``````#Svanoy
#HighLight bars within range of current close.
input Range = .25;

def barNum = if !IsNaN(BarNumber()) and !IsNaN(close) then Barnumber() else Double.NaN;
def numBars = HighestAll(barNum);
def FinalClose = fold c = 0 to numBars while !IsNaN(GetValue(close, -c)) do GetValue(close, -c);
def FinalCloseLine = fold fcl = 0 to 1 do FinalClose;

def HighLightBar = fold hlb = 0 to BarNumber() while (high >= (FinalCloseLine-Range) and high <= (FinalCloseLine))
or (low >= (FinalCloseLine) and low <= (FinalCloseLine+Range))
and !IsNaN(close[-1]) do GetValue(BarNumber(), 0);

plot DayClose = if FinalCloseLine > 0 then FinalCloseLine else...``````
@MFitz73
Recycled code from another post.

Code:
``````#Svanoy
#HighLight bars within range of current close.
input Range = .25;

def barNum = if !IsNaN(BarNumber()) and !IsNaN(close) then Barnumber() else Double.NaN;
def numBars = HighestAll(barNum);
def FinalClose = fold c = 0 to numBars while !IsNaN(GetValue(close, -c)) do GetValue(close, -c);
def FinalCloseLine = fold fcl = 0 to 1 do FinalClose;

def HighLightBar = fold hlb = 0 to BarNumber() while (high >= (FinalCloseLine-Range) and high <= (FinalCloseLine))
or (low >= (FinalCloseLine) and low <= (FinalCloseLine+Range))
and !IsNaN(close[-1]) do GetValue(BarNumber(), 0);

plot DayClose = if FinalCloseLine > 0 then FinalCloseLine else Double.NaN;
DayClose.SetStyle(Curve.LONG_DASH);
DayClose.AssignValueColor(Color.LIME);

AssignPriceColor(if HighLightBar != 0 then Color.BLUE else Color.CURRENT);``````

Last edited:
Svanoy, ok quick update, the line does not update in realtime. But I think I might be able to pull parts of this code and use it in another line script I have which does update realtime. If I can put it all together I will post here.
thanks.

### Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
393 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• Add-ons and resources
• 1 full year of unlimited support

### Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?