PM high low on watchlist

Khahuy12

Member
VIP
hi, can someone create a premarket high low on watchlist? if current price greater then PM high then color greeen else red on watchlist? thank you!
 
Solution
EDIT 2022/01 --- changed the label color , from black to white
sorry for that mistake


i think this will do it

Ruby:
# prehighlow_col_01

# -------------------
# halcyonguy
# 21-06-15
# column study. find highest and lowest in premarket, and compare to daytime highs/lows
# -------------------

# https://usethinkscript.com/threads/pm-high-low-on-watchlist.6893/
#khahuy12
#can someone create a premarket high low on watchlist? if current price greater then PM high then color green else red on watchlist?

input start = 0930;
input end = 1600;
# is current bar during normal trading hours?
def daytime = if secondsfromTime(start) >= 0 and secondstillTime(end) > 0 then 1 else 0;

def prehi =
  # starting pre, reset
  if  daytime[1] and...
EDIT 2022/01 --- changed the label color , from black to white
sorry for that mistake


i think this will do it

Ruby:
# prehighlow_col_01

# -------------------
# halcyonguy
# 21-06-15
# column study. find highest and lowest in premarket, and compare to daytime highs/lows
# -------------------

# https://usethinkscript.com/threads/pm-high-low-on-watchlist.6893/
#khahuy12
#can someone create a premarket high low on watchlist? if current price greater then PM high then color green else red on watchlist?

input start = 0930;
input end = 1600;
# is current bar during normal trading hours?
def daytime = if secondsfromTime(start) >= 0 and secondstillTime(end) > 0 then 1 else 0;

def prehi =
  # starting pre, reset
  if  daytime[1] and !daytime then high
  # if a higher high, set it to var
  else if !daytime and high > prehi[1] then high
  # else keep previous value
  else prehi[1];

def prelo =
  # starting pre, reset
  if  daytime[1] and !daytime then low
  # if a lower low, set it to var
  else if !daytime and low < prelo[1] then low
  # else keep previous value
  else prelo[1];

def dayhigher = ( high > prehi );
def daylower = ( low < prelo );

addlabel(1, (if close > prehi then ((close - prehi) + " above pre hi")
else if close < prelo then ((prelo - close) + " below pre low") else "in pre rng"), color.white);

assignbackgroundcolor( if dayhigher then color.green else if daylower then color.red else color.current );

# -----------------
# test data for upper study
#input show_test_data = no;
#addlabel( show_test_data , "pre high= " + prehi, color.yellow);
#addlabel( show_test_data , "pre low= " + prelo, color.yellow);
#
 
Last edited:
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
178 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