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.
MIAYCaj.png

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.
MIAYCaj.png

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:
Solution

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

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.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
505 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • 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?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top