# After Hours highs and low label

#### rudy seena

##### New member
Hi all, as always thanks for the great work you guys are doing. I am learning a ton. My question is how do I add a label for only "AFTER HOURS" highs and lows (NOT Premarket) . I checked your extensive library but could not find any posts related to my specific question. Would love your help on this. Thanks, Rudy

Solution
OK. Price in a ime range...

Code:
``````declare upper;

def endRTH = 1600;

def midnight = 2359;

def aftermarket = if secondsFromTime(endRTH) > 0 AND secondsTillTime(midnight) > 0 then 1 else 0;

def yesterday = if GetLastDay() == GetDay() then 1 else 0;

rec post_market_high = if aftermarket == 1 and yesterday == 1 and HIGH > post_market_high[1] then HIGH else post_market_high[1];

addLabel(yes, "After-Market High: " + post_market_high, color.orange);``````

This may, or may not run exactly as you expect. I still, after spending years with ThinkScript, have a hard time wrapping my head around how to deal with weekends.

mashume
OK. Price in a ime range...

Code:
``````declare upper;

def endRTH = 1600;

def midnight = 2359;

def aftermarket = if secondsFromTime(endRTH) > 0 AND secondsTillTime(midnight) > 0 then 1 else 0;

def yesterday = if GetLastDay() == GetDay() then 1 else 0;

rec post_market_high = if aftermarket == 1 and yesterday == 1 and HIGH > post_market_high[1] then HIGH else post_market_high[1];

addLabel(yes, "After-Market High: " + post_market_high, color.orange);``````

This may, or may not run exactly as you expect. I still, after spending years with ThinkScript, have a hard time wrapping my head around how to deal with weekends.

mashume

Last edited:
OK. Price in a ime range...

Code:
``````declare upper;

def endRTH = 1600;

def midnight = 2359;

def aftermarket = if secondsFromTime(endRTH) > 0 AND secondsTillTime(midnight) > 0 then 1 else 0;

def yesterday = if GetLastDay() == GetDay() then 1 else 0;

rec post_market_high = if aftermarket == 1 and yesterday == 1 and HIGH > post_market_high[1] then HIGH else post_market_high[1];

addLabel(yes, "After-Market High: " + post_market_high, color.orange);``````

This may, or may not run exactly as you expect. I still, after spending years with ThinkScript, have a hard time wrapping my head around how to deal with weekends.

mashume
Hi Mashume, thanks for the code. I really appreciate your valuable time to share. Unfortunately, it gives me a value of zero & only After-Market High:0, not After-Market Low, also. I used TOS OnDemand to backtest on a Saturday, so not sure if I have to wait for regular market hours for it to work? Thoughts? Rudy

@rudy seena Maybe it is an on-demand issue. It works fine on the regular platform.
And yes, this is only a High label. But now that you have the logic, you can add & modify the code to meet your needs.

@rudy seena Maybe it is an on-demand issue. It works fine on the regular platform.
And yes, this is only a High label. But now that you have the logic, you can add & modify the code to meet your needs.
View attachment 1086
Thanks. I called TOS and it was an OnDemand issue. Also, I was able to modify your code for the AH Low. Thanks again. You guys are awesome! Rudy

Thanks. I called TOS and it was an OnDemand issue. Also, I was able to modify your code for the AH Low. Thanks again. You guys are awesome! Rudy
Can u post the modification? Thanks

Hi all, sorry for the delay. Below is the code for the After Hours highs and lows. Unfortunately, when I ran this morning at 9.22am, before mkt opens, it still does not give me the correct data. Instead it prints: AHH: 0, AHL: 0.

I did speak to TOS but they were unable to help me and said it was a coding issues. Can you guys help? Thanks, Rudy

declare upper;

def endRTH = 1600;

def midnight = 2359;

def aftermarket = if secondsFromTime(endRTH) > 0 AND secondsTillTime(midnight) > 0 then 1 else 0;

def yesterday = if GetLastDay() == GetDay() then 1 else 0;

rec post_market_high = if aftermarket == 1 and yesterday == 1 and HIGH > post_market_high[1] then HIGH else post_market_high[1];

addLabel(yes, "AHH: " + post_market_high, color.orange);

rec post_market_low = if aftermarket == 1 and yesterday == 1 and LOW > post_market_low[1] then low else post_market_low[1];

addLabel(yes, "AHL: " + post_market_Low, color.orange);

Hi all, as always thanks for the great work you guys are doing. I am learning a ton. My question is how do I add a label for only "AFTER HOURS" highs and lows (NOT Premarket) . I checked your extensive library but could not find any posts related to my specific question. Would love your help on this. Thanks, Rudy
Interesting. How are you using this information to help make a trade?

Interesting. How are you using this information to help make a trade?
I use pre-mkt data to see strength or weakness at daily support or resistance areas. For example, if pre-mkt highs are > than After Hours and prior day highs - at the open, I wait for a pullback to prior day highs and enter. Currently, I have to physically locate After Hours highs and lows. A label would save much valuable time.

interesting Idea. Why the after hours high and low? why not from close to open after hours high and low? What is it that you think is happening during that time? On tesla yesterday i noticed a huge spike down from 821 to 816 witch just seems very manipulated/fishy

interesting Idea. Why the after hours high and low? why not from close to open after hours high and low? What is it that you think is happening during that time? On tesla yesterday i noticed a huge spike down from 821 to 816 witch just seems very manipulated/fishy
Previous Prior day, Prior day, After Hours, Pre market highs & lows are support & resistance price levels (R1, R2, R3, R4, etc) I use for game planning what if scenarios for the trading day. For example, if SPY is weak, but stock opens strong & jacks to Previous Prior day Highs, I will short it.

87k+ Posts
369 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
• 1 full year of unlimited support

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?