see if the high is at the beginning or at a different hour.

JLtrader

New member
I'm new at this so please be patient. I'm trying to make a script for the scan. I want to show what hour the high so far has been. the idea is to see if the high is at the beginning or at a different hour. It would be nice if the script return what our or even just a number like say 10 am = 1 and 11 am 2 ... I am trying to test a theory but doing it in my head is kind of slow. I need thinkscript to process this faster.
 
Solution
This one was kinda fun to throw together.

Code:
declare upper;

input tz_adjust = -3;
def t = getTime() % (360 * 1 * 10000);

def h = if secondsFromTime(0930) == 0 then 9 + tz_adjust else if t == 0 then h[1] + 1 else h[1];

def high_of_day = if secondsFromTime(0930) == 0 then high else if high > high_of_day[1] then high else high_of_day[1];

def time_of_hod = if high_of_day != high_of_day[1] then h else time_of_hod[1];

AddLabel(yes, "  High occurred in the " + time_of_hod + " o'clock hour.   ", color.black);

Note that I am in the pacific time zone, so my tz_adjust (to get local time from East Coast time) is -3. If you're on the eastern seaboard, just set it to 0. If you're in Hawaii, good on ya and get some more sleep rather...
This one was kinda fun to throw together.

Code:
declare upper;

input tz_adjust = -3;
def t = getTime() % (360 * 1 * 10000);

def h = if secondsFromTime(0930) == 0 then 9 + tz_adjust else if t == 0 then h[1] + 1 else h[1];

def high_of_day = if secondsFromTime(0930) == 0 then high else if high > high_of_day[1] then high else high_of_day[1];

def time_of_hod = if high_of_day != high_of_day[1] then h else time_of_hod[1];

AddLabel(yes, "  High occurred in the " + time_of_hod + " o'clock hour.   ", color.black);

Note that I am in the pacific time zone, so my tz_adjust (to get local time from East Coast time) is -3. If you're on the eastern seaboard, just set it to 0. If you're in Hawaii, good on ya and get some more sleep rather than trading so early. ;-P

-mashume
 
Solution

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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