Watchlist Column - Current price wicking premarket high/low?

phil48

New member
Hi there! I've made watchlists to indicate price wicking the high/low of previous days, but I can't seem to make it work for premarket data. I'm looking to see something like this

on a 15-minute time frame

plot x= open>premarkethigh and low<premarkethigh and close>premarkethigh

I'm also looking for a specific time range premarket that I can't seem to define properly between 8am and 9:29am ET.

I feel like it's an easy script, but I just can't figure it out. Any help would be greatly appreciated!

Thanks in advance!
 
Solution
on a 15-minute time frame
plot x= open>premarkethigh and low<premarkethigh and close>premarkethigh
I'm also looking for a specific time range premarket that I can't seem to define properly between 8am and 9:29am ET.


hello and welcome.
it helps others to help you, if you post the code you tried.
when making a post, there is an icon in the header </> , that will open a code window, for you to paste in the code. don't have to pick a code type, but ruby seems to have nice formatting.

it helps to debug scans and column studies, if you design them as a lower study. then you can see what is happening and show some bubbles with variable values.
add
declare lower;

in premarket, there is a good chance that there will be few bars...
on a 15-minute time frame
plot x= open>premarkethigh and low<premarkethigh and close>premarkethigh
I'm also looking for a specific time range premarket that I can't seem to define properly between 8am and 9:29am ET.


hello and welcome.
it helps others to help you, if you post the code you tried.
when making a post, there is an icon in the header </> , that will open a code window, for you to paste in the code. don't have to pick a code type, but ruby seems to have nice formatting.

it helps to debug scans and column studies, if you design them as a lower study. then you can see what is happening and show some bubbles with variable values.
add
declare lower;

in premarket, there is a good chance that there will be few bars for a stock. because of this, there may not be a bar at your start time, which can cause errors.

i don't know what wicking means. if you properly describle the desired action, it will help others help you.
do you mean,
..when a high crosses above a pre market high
. when a low crosses below a pre market low

------------------

this is a column study that display the number of bars sine price crossed a pre market level.
if a high is crossed, it is green
if a low is crossed, it is red, and a negative number (helps for sorting the column)


column

Code:
# zprecomphilo
# pre_compare_hilo_0

# https://usethinkscript.com/threads/watchlist-column-current-price-wicking-premarket-high-low.12213/
# Watchlist Column - Current price wicking premarket high/low?

# use just  >  when checking the end time
input prestart = 0800;
input preend = 0930;
def preperiod = (SecondsFromTime(prestart) >= 0 and SecondsTillTime(preend) > 0);

# find high low of a time period
def hi;
def lo;
if (!preperiod[1] and preperiod)
then {
    hi = high;
    lo = low;
} else if preperiod
then {
    hi = if high > hi[1] then high else hi[1];
    lo = if low < lo[1] then low else lo[1];
} else {
    hi = hi[1];
    lo = lo[1];
}

input start = 0930;
input end = 1600;
def rth = (SecondsFromTime(start) >= 0 and SecondsTillTime(end) > 0);

def hiz = if rth and high crosses above hi then 1 else 0;
def loz = if rth and low crosses below lo then 1 else 0;

# display a count since a crossing
def hix = if BarNumber() == 1 then 0
else if hiz then 0
else hix[1] + 1;
def lox = if BarNumber() == 1 then 0
else if loz then 0
else lox[1] - 1;

#def xmin = Min(hix, AbsValue(lox));
def xmin = if AbsValue(lox) < hix then lox else hix;
plot z = xmin;
z.setdefaultcolor(color.black);

AssignBackgroundColor(if xmin == hix then Color.GREEN
 else if AbsValue(lox) < hix then Color.RED else Color.GRAY);

#--------------
# test data
#addchartbubble(hiz, high, high, color.green, yes);
#addchartbubble(loz, low, low, color.red, no);
#AddChartBubble(preperiod, low, hi + "\n" + lo, Color.YELLOW, no);
#


---------------

test - upper study

Code:
# pre_compare_hilo_0

# https://usethinkscript.com/threads/watchlist-column-current-price-wicking-premarket-high-low.12213/
# Watchlist Column - Current price wicking premarket high/low?
# phil48  8/12  #1

# Hi there! I've made watchlists to indicate price wicking the high/low of previous days, but I can't seem to make it work for premarket data. I'm looking to see something like this
#on a 15-minute time frame
# plot x= open>premarkethigh and low<premarkethigh and close>premarkethigh
# I'm also looking for a specific time range premarket that I can't seem to define properly between 8am and 9:29am ET.








# use just  >  when checking the end time
input prestart = 0800;
input preend = 0930;
def preperiod = (SecondsFromTime(prestart) >= 0 and SecondsTillTime(preend) > 0);

# find high low of a time period
def hi;
def lo;
if (!preperiod[1] and preperiod)
then {
    hi = high;
    lo = low;
} else if preperiod
then {
    hi = if high > hi[1] then high else hi[1];
    lo = if low < lo[1] then low else lo[1];
} else {
    hi = hi[1];
    lo = lo[1];
}

input start = 0930;
input end = 1600;
def rth = (SecondsFromTime(start) >= 0 and SecondsTillTime(end) > 0);

def hiz = if rth and high crosses above hi then 1 else 0;
def loz = if rth and low crosses below lo then 1 else 0;

# display a count since a crossing
def hix = if BarNumber() == 1 then 0
else if hiz then 0
else hix[1] + 1;
def lox = if BarNumber() == 1 then 0
else if loz then 0
else lox[1] - 1;

#def xmin = Min(hix, AbsValue(lox));
def xmin = if AbsValue(lox) < hix then lox else hix;
plot z = xmin;
# z.setdefaultcolor(color.black);

# AssignBackgroundColor(if xmin == hix then Color.GREEN else if AbsValue(lox) < hix then Color.RED else Color.GRAY);

#--------------
# test data

addchartbubble(hiz, high, high, color.green, yes);
addchartbubble(loz, low, low, color.red, no);

AddChartBubble(preperiod, low,
hi + "\n" +
lo
, Color.YELLOW, no);
#
 
Solution

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

Thank you very much @halcyonguy. By wicking, I meant that the price opened above the premarket high, moved below the premarket high and then moved back above the premarket high. I'll be trying out your code this morning. Thanks again!
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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