Indicator for intraday HOD break

zeek

Active member
2019 Donor
I am looking for an indicator that will alert me when price breaks through the intraday high of day and would like a chart label that says "HOD break" once triggered and also an audio alert as soon as price breaks.
Preferably, i would like to have two separate alerts depending on if price breaks the HOD before 12AM (noon) or after 12AM. So the critera for the alerts are as follows,
Alert 1 = When price breaks the HOD at or after 10AM until 12AM. HOD price should be set somewhere between 9:30AM and 9:59AM.
Alert 2 = When price breaks the HOD price at or after 12AM until 4PM. HOD price should be set somewhere between 10AM and 11:59AM

Would appreciate it very much if anyone could help me code this. @SleepyZ @halcyonguy ?

Here are two example pics to show you the morning break and the afternoon break


 
Solution
Try this, let me know how it works out. It might need some tweaking.

Code:
Script PartialSessionHigh{
    input Start = 0930;
    Input End = 1000;
    def trackHigh =
        if !SecondsFromTime(Start) then high
        else if SecondsFromTime(Start) > 0
            and SecondsFromTime(End) < 0
            and High > trackHigh[1]
            then high
        else trackHigh[1];
    plot PartialSessionHigh = TrackHigh;
}
def MorningHigh =
    PartialSessionHigh(0930,1000)
;
def MidDayHigh =
    PartialSessionHigh(1000,1200)
;
def MorningCross =
    SecondsFromTime(1000) >= 0
    and Crosses(High,MorningHigh,CrossingDirection.ABOVE)
;
def MidDayCross =
    SecondsFromTime(1200) >= 0
    and Crosses(High,MidDayHigh ,CrossingDirection.ABOVE)...
Try this, let me know how it works out. It might need some tweaking.

Code:
Script PartialSessionHigh{
    input Start = 0930;
    Input End = 1000;
    def trackHigh =
        if !SecondsFromTime(Start) then high
        else if SecondsFromTime(Start) > 0
            and SecondsFromTime(End) < 0
            and High > trackHigh[1]
            then high
        else trackHigh[1];
    plot PartialSessionHigh = TrackHigh;
}
def MorningHigh =
    PartialSessionHigh(0930,1000)
;
def MidDayHigh =
    PartialSessionHigh(1000,1200)
;
def MorningCross =
    SecondsFromTime(1000) >= 0
    and Crosses(High,MorningHigh,CrossingDirection.ABOVE)
;
def MidDayCross =
    SecondsFromTime(1200) >= 0
    and Crosses(High,MidDayHigh ,CrossingDirection.ABOVE)
;
def MornArmed =
    if GetDay() != GetDay()[1] then Yes
    else if MornArmed[1] and MorningCross[1] then no
    else MornArmed [1]
;
def MidArmed =
    if GetDay() != GetDay()[1] then Yes
    else if MidArmed[1] and MidDayCross[1] then no
    else MidArmed [1]
;
Alert(MornArmed and MorningCross, "Monring High", Alert.Bar);
Alert(MidArmed and MidDayCross, "Mid Day High", Alert.Bar);
AssignPriceColor(
    if (MornArmed and MorningCross)
        or (MidArmed and MidDayCross)
    then color.blue
    else color.current
);
 
Solution

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

Hey Zeek i like a lot of your theories i've seen in post on here, what is your strategy behind this one?
Hi there,

A hod break can be powerful and something i´d like to be notified about as soon as it happens and typically on a normal day, i monitor up to 15 different symbols at once so it really helps having an indicator like this giving me alerts instead of constantly having to watch the charts.

When price breaks the HOD, i basically look for two things.
  • Continuation of bull trend with price going to the next pivot. Key is to watch what happens shortly after the break and if there´s follow through and bids building to hold and keep price going higher. Then i´ll be looking for the long.
  • Sometimes the market makers will run the price up above the prior highs just to clear out some SL liquidity sitting there and then you´ll see an instant drop and those can be great short opportunities so i like to watch for this as well.

Hope that makes sense.
 
Try this, let me know how it works out. It might need some tweaking.
Hey @Joshua , the alerts work like a charm but because i already use another upper study that paints candles, i think there´s a conflict between these two studies so would it be possible instead to have a chart bubble positioned above the candle that stays visible as long as the candle is open and goes away once candle is closed?

Great work! (y)
 
I think this should work, but I haven't tested it.

AddChartBubble (MornArmed and MorningCross and isNaN(Close[-1]), high, "Morning", color.white);
AddChartBubble (MidArmed and MidDayCross and isNaN(Close[-1]), high, "Mid Day", color.white);
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
299 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