Hi. Is it possible to do for premarket? and is it possible to place this script in the watchlist after the selection of stocks in the premarket, so that the stock that has broken through the premarket price would be highlighted? I ask for help!
your words are too vague.
what do these this mean?
1. bell open morning stock ? all stocks open in the morning
2. runs up down ? how far up? how far down? based on what ? is this even important ?
--------------------------
here is a study that,
. finds the highest and lowest levels during pre market,
. draws lines at those levels during normal hours
. draws an arrow if price crosses above the high line or below the low line
Code:#pre_hilow_breakout_00 #https://usethinkscript.com/threads/question-about-breakout-pre_market-high-low.14488/ #UnAnswered Question about breakout Pre_Market high low #shih90 Feb 14, 2023 #Is anyone know the LABEL showing that when bell open morning stock runs up down and break either side premarket high/low ? def na = double.nan; def bn = barnumber(); # true during normal hours def rth = (GetTime() >= RegularTradingStart(GetYYYYMMDD()) and GetTime() < RegularTradingEnd(GetYYYYMMDD()) ); #def isup = close > open; #def isdwn = close < open; def prehi; def prelo; if bn == 1 then { prehi = 0; prelo = 0; } else if !rth and rth[1] then { # first bar of ah prehi = high; prelo = low; } else if !rth then { prehi = if high > prehi[1] then high else prehi[1]; prelo = if low < prelo[1] then low else prelo[1]; } else { prehi = prehi[1]; prelo = prelo[1]; } input show_lines_on_AH = no; def ahlines = if (show_lines_on_AH and !rth) then 1 else 0; plot zhi = if prehi < 1 then na else if rth then prehi else if ahlines then prehi else na; zhi.SetDefaultColor(Color.light_gray); zhi.hidebubble(); plot zlo = if prelo < 1 then na else if rth then prelo else if ahlines then prelo else na; zlo.SetDefaultColor(Color.light_gray); zlo.hidebubble(); plot zup = if rth and close crosses above prehi then low*0.998 else na; zup.SetPaintingStrategy(PaintingStrategy.ARROW_UP); zup.SetDefaultColor(Color.cyan); zup.setlineweight(3); zup.hidebubble(); plot zdwn = if rth and close crosses below prelo then high*1.002 else na; zdwn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); zdwn.SetDefaultColor(Color.cyan); zdwn.setlineweight(3); zdwn.hidebubble(); #------------------------- # test stuff addchartbubble(0, low, rth + "\n" + !rth + "\n" + prehi + "\n" + prelo , color.yellow, no); #
![]()
Is anyone know the LABEL showing that when bell open morning stock runs up down and break either side premarket high/low ?
Thank you for your research and help!!!
#pre_hilow_breakout_00
#https://usethinkscript.com/threads/question-about-breakout-pre_market-high-low.14488/
#UnAnswered Question about breakout Pre_Market high low
#shih90 Feb 14, 2023
#Is anyone know the LABEL showing that when bell open morning stock runs up down and break either side premarket high/low ?
def na = double.nan;
def bn = barnumber();
# true during normal hours
def rth = (GetTime() >= RegularTradingStart(GetYYYYMMDD()) and GetTime() < RegularTradingEnd(GetYYYYMMDD()) );
#def isup = close > open;
#def isdwn = close < open;
def prehi;
def prelo;
if bn == 1 then {
prehi = 0;
prelo = 0;
} else if !rth and rth[1] then {
# first bar of ah
prehi = high;
prelo = low;
} else if !rth then {
prehi = if high > prehi[1] then high else prehi[1];
prelo = if low < prelo[1] then low else prelo[1];
} else {
prehi = prehi[1];
prelo = prelo[1];
}
input show_lines_on_AH = no;
def ahlines = if (show_lines_on_AH and !rth) then 1 else 0;
plot zhi = if prehi < 1 then na
else if rth then prehi
else if ahlines then prehi
else na;
zhi.SetDefaultColor(Color.light_gray);
zhi.hidebubble();
plot zlo = if prelo < 1 then na
else if rth then prelo
else if ahlines then prelo
else na;
zlo.SetDefaultColor(Color.light_gray);
zlo.hidebubble();
plot zup = if rth and close crosses above prehi then low*0.998 else na;
zup.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
zup.SetDefaultColor(Color.cyan);
zup.setlineweight(3);
zup.hidebubble();
plot zdwn = if rth and close crosses below prelo then high*1.002 else na;
zdwn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
zdwn.SetDefaultColor(Color.cyan);
zdwn.setlineweight(3);
zdwn.hidebubble();
#-------------------------
# test stuff
addchartbubble(0, low,
rth + "\n" +
!rth + "\n" +
prehi + "\n" +
prelo
, color.yellow, no);
#
This PreMkt Hi/Low saves me about 20 minutes of charting my watchlist each morning. Thank you, Thank you, Thank you! cmfyour words are too vague.
what do these this mean?
1. bell open morning stock ? all stocks open in the morning
2. runs up down ? how far up? how far down? based on what ? is this even important ?
--------------------------
here is a study that,
. finds the highest and lowest levels during pre market,
. draws lines at those levels during normal hours
. draws an arrow if price crosses above the high line or below the low line
Code:#pre_hilow_breakout_00 #https://usethinkscript.com/threads/question-about-breakout-pre_market-high-low.14488/ #UnAnswered Question about breakout Pre_Market high low #shih90 Feb 14, 2023 #Is anyone know the LABEL showing that when bell open morning stock runs up down and break either side premarket high/low ? def na = double.nan; def bn = barnumber(); # true during normal hours def rth = (GetTime() >= RegularTradingStart(GetYYYYMMDD()) and GetTime() < RegularTradingEnd(GetYYYYMMDD()) ); #def isup = close > open; #def isdwn = close < open; def prehi; def prelo; if bn == 1 then { prehi = 0; prelo = 0; } else if !rth and rth[1] then { # first bar of ah prehi = high; prelo = low; } else if !rth then { prehi = if high > prehi[1] then high else prehi[1]; prelo = if low < prelo[1] then low else prelo[1]; } else { prehi = prehi[1]; prelo = prelo[1]; } input show_lines_on_AH = no; def ahlines = if (show_lines_on_AH and !rth) then 1 else 0; plot zhi = if prehi < 1 then na else if rth then prehi else if ahlines then prehi else na; zhi.SetDefaultColor(Color.light_gray); zhi.hidebubble(); plot zlo = if prelo < 1 then na else if rth then prelo else if ahlines then prelo else na; zlo.SetDefaultColor(Color.light_gray); zlo.hidebubble(); plot zup = if rth and close crosses above prehi then low*0.998 else na; zup.SetPaintingStrategy(PaintingStrategy.ARROW_UP); zup.SetDefaultColor(Color.cyan); zup.setlineweight(3); zup.hidebubble(); plot zdwn = if rth and close crosses below prelo then high*1.002 else na; zdwn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); zdwn.SetDefaultColor(Color.cyan); zdwn.setlineweight(3); zdwn.hidebubble(); #------------------------- # test stuff addchartbubble(0, low, rth + "\n" + !rth + "\n" + prehi + "\n" + prelo , color.yellow, no); #
![]()
your words are too vague.
what do these this mean?
1. bell open morning stock ? all stocks open in the morning
2. runs up down ? how far up? how far down? based on what ? is this even important ?
Hi @halcyonguy. In looking at charts using your script I note that the pre-market plots are pulling data from the after-hours session of the day before, rather than from the pre-market session starting at 0400 hrs of the current day.
An example would be ticker TSLA from today (April 11, 2023). The PM low being plotted ($184.06) is the low from yesterday's after-hours session rather than the low from today's PM session ($184.50).
I am not a coder so don't have a suggested fix, but thought I would share this as an FYI. Keep well.
@halcyonguyThis PreMkt Hi/Low saves me about 20 minutes of charting my watchlist each morning. Thank you, Thank you, Thank you! cmf
Hi. Is it possible to do for premarket? and is it possible to place this script in the watchlist after the selection of stocks in the premarket, so that the stock that has broken through the premarket price would be highlighted? I ask for help!your words are too vague.
what do these this mean?
1. bell open morning stock ? all stocks open in the morning
2. runs up down ? how far up? how far down? based on what ? is this even important ?
--------------------------
here is a study that,
. finds the highest and lowest levels during pre market,
. draws lines at those levels during normal hours
. draws an arrow if price crosses above the high line or below the low line
Code:#pre_hilow_breakout_00 #https://usethinkscript.com/threads/question-about-breakout-pre_market-high-low.14488/ #UnAnswered Question about breakout Pre_Market high low #shih90 Feb 14, 2023 #Is anyone know the LABEL showing that when bell open morning stock runs up down and break either side premarket high/low ? def na = double.nan; def bn = barnumber(); # true during normal hours def rth = (GetTime() >= RegularTradingStart(GetYYYYMMDD()) and GetTime() < RegularTradingEnd(GetYYYYMMDD()) ); #def isup = close > open; #def isdwn = close < open; def prehi; def prelo; if bn == 1 then { prehi = 0; prelo = 0; } else if !rth and rth[1] then { # first bar of ah prehi = high; prelo = low; } else if !rth then { prehi = if high > prehi[1] then high else prehi[1]; prelo = if low < prelo[1] then low else prelo[1]; } else { prehi = prehi[1]; prelo = prelo[1]; } input show_lines_on_AH = no; def ahlines = if (show_lines_on_AH and !rth) then 1 else 0; plot zhi = if prehi < 1 then na else if rth then prehi else if ahlines then prehi else na; zhi.SetDefaultColor(Color.light_gray); zhi.hidebubble(); plot zlo = if prelo < 1 then na else if rth then prelo else if ahlines then prelo else na; zlo.SetDefaultColor(Color.light_gray); zlo.hidebubble(); plot zup = if rth and close crosses above prehi then low*0.998 else na; zup.SetPaintingStrategy(PaintingStrategy.ARROW_UP); zup.SetDefaultColor(Color.cyan); zup.setlineweight(3); zup.hidebubble(); plot zdwn = if rth and close crosses below prelo then high*1.002 else na; zdwn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); zdwn.SetDefaultColor(Color.cyan); zdwn.setlineweight(3); zdwn.hidebubble(); #------------------------- # test stuff addchartbubble(0, low, rth + "\n" + !rth + "\n" + prehi + "\n" + prelo , color.yellow, no); #
![]()
Hi. Is it possible to do for premarket? and is it possible to place this script in the watchlist after the selection of stocks in the premarket, so that the stock that has broken through the premarket price would be highlighted? I ask for help!
#pre_hilow_breakout_01
# choose pre/post/both after hours
#https://usethinkscript.com/threads/question-about-breakout-pre_market-high-low.14488/
#UnAnswered Question about breakout Pre_Market high low
def na = double.nan;
def bn = barnumber();
#def diffday = if getday() != getday()[1] then 1 else 0;
def rth = (GetTime() >= RegularTradingStart(GetYYYYMMDD()) and GetTime() < RegularTradingEnd(GetYYYYMMDD()) );
def rthstart = 0930;
def rthend = 1600;
def daystart = 0;
def dayend = 2359;
def pre1 = if secondsfromTime(daystart) >= 0 and secondstillTime(rthstart) > 0 then 1 else 0;
def post1 = if secondsfromTime(rthend) >= 0 and secondstillTime(dayend) > 0 then 1 else 0;
input after_hours = { pre_hours , post_hours , default both };
def prehi;
def prelo;
def x;
switch (after_hours) {
case pre_hours:
prehi = if !pre1[1] and pre1 then high
else if pre1 and high > prehi[1] then high
else prehi[1];
prelo = if !pre1[1] and pre1 then low
else if pre1 and low < prelo[1] then low
else prelo[1];
x = if pre1 then 1 else 0;
case post_hours:
prehi = if !post1[1] and post1 then high
else if post1 and high > prehi[1] then high
else prehi[1];
prelo = if !post1[1] and post1 then low
else if post1 and low < prelo[1] then low
else prelo[1];
x = if post1 then 1 else 0;
case both:
prehi = if !rth and rth[1] then high
else if !rth and high > prehi[1] then high
else prehi[1];
prelo = if !rth and rth[1] then low
else if !rth and low < prelo[1] then low
else prelo[1];
x = if !rth then 1 else 0;
}
input show_lines_on_AH = no;
def ahlines = if (show_lines_on_AH and !rth) then 1 else 0;
plot zhi = if prehi < 1 then na
else if rth then prehi
else if ahlines then prehi
else na;
zhi.SetDefaultColor(Color.light_gray);
zhi.hidebubble();
plot zlo = if prelo < 1 then na
else if rth then prelo
else if ahlines then prelo
else na;
zlo.SetDefaultColor(Color.light_gray);
zlo.hidebubble();
plot zup = if rth and close crosses above prehi then low*0.998 else na;
zup.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
zup.SetDefaultColor(Color.cyan);
zup.setlineweight(3);
zup.hidebubble();
plot zdwn = if rth and close crosses below prelo then high*1.002 else na;
zdwn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
zdwn.SetDefaultColor(Color.cyan);
zdwn.setlineweight(3);
zdwn.hidebubble();
#-------------------------
# test stuff
input test1 = no;
addchartbubble(test1, low*0.998,
rth + "\n" +
!rth + "\n" +
prehi + "\n" +
prelo
, (if x then color.yellow else color.gray), no);
#
Hal, Would you mind turning this into a watchlist that will change colors when Pre low/hi is broken. Also with alert. Thank Youwill look into watch list...
i'm sorry for responding so late, i'm sometimes terrible at replying.
i see you 2 probably aren't around, but will still reply.
@shih90
here is an updated version
@DMacTrades
there is nothing to fix. i took the original request to be any time that isn't normal trading hours, hours before normal trading hours AND hours after them.
after hours, pre market,... these terms could be interpretted differently or as the same period, unless specific times are mentioned.
@LivingWithInterest
..read data from pre market and after hours,.. yes. i lumped them together in my previous version.
you wrote a lot of words, without defining WHAT time period defines what you want. although providing examples are usually good, i'm not going to type in symbols , and go look up data from some date, and try to interpret what you want.
just say , read data from 4am to 9:30. (or whatever the correct EST times are)
@EnotTrader
thanks for replying and bringing this post back to my attention.
premarket , again , be specific.
i'm not trying to sound like a dick.
i want people to think about their questions, and be as specific as they can, to provide pertinent information, in order to better communicate their request.
-----------------------------
this version allows the user to pick the 'after hours' time period to read highs and lows from.
...from normal day close to normal day open - default time
...from midnight to day open - pre
...from day close to midnight - post
the default pre and post times are from and to midnight. if 4am and 8pm are desired, then those times could be typed in the code, for these 2 variables.
def daystart = 0;
def dayend = 2359;
Code:#pre_hilow_breakout_01 # choose pre/post/both after hours #https://usethinkscript.com/threads/question-about-breakout-pre_market-high-low.14488/ #UnAnswered Question about breakout Pre_Market high low def na = double.nan; def bn = barnumber(); #def diffday = if getday() != getday()[1] then 1 else 0; def rth = (GetTime() >= RegularTradingStart(GetYYYYMMDD()) and GetTime() < RegularTradingEnd(GetYYYYMMDD()) ); def rthstart = 0930; def rthend = 1600; def daystart = 0; def dayend = 2359; def pre1 = if secondsfromTime(daystart) >= 0 and secondstillTime(rthstart) > 0 then 1 else 0; def post1 = if secondsfromTime(rthend) >= 0 and secondstillTime(dayend) > 0 then 1 else 0; input after_hours = { pre_hours , post_hours , default both }; def prehi; def prelo; def x; switch (after_hours) { case pre_hours: prehi = if !pre1[1] and pre1 then high else if pre1 and high > prehi[1] then high else prehi[1]; prelo = if !pre1[1] and pre1 then low else if pre1 and low < prelo[1] then low else prelo[1]; x = if pre1 then 1 else 0; case post_hours: prehi = if !post1[1] and post1 then high else if post1 and high > prehi[1] then high else prehi[1]; prelo = if !post1[1] and post1 then low else if post1 and low < prelo[1] then low else prelo[1]; x = if post1 then 1 else 0; case both: prehi = if !rth and rth[1] then high else if !rth and high > prehi[1] then high else prehi[1]; prelo = if !rth and rth[1] then low else if !rth and low < prelo[1] then low else prelo[1]; x = if !rth then 1 else 0; } input show_lines_on_AH = no; def ahlines = if (show_lines_on_AH and !rth) then 1 else 0; plot zhi = if prehi < 1 then na else if rth then prehi else if ahlines then prehi else na; zhi.SetDefaultColor(Color.light_gray); zhi.hidebubble(); plot zlo = if prelo < 1 then na else if rth then prelo else if ahlines then prelo else na; zlo.SetDefaultColor(Color.light_gray); zlo.hidebubble(); plot zup = if rth and close crosses above prehi then low*0.998 else na; zup.SetPaintingStrategy(PaintingStrategy.ARROW_UP); zup.SetDefaultColor(Color.cyan); zup.setlineweight(3); zup.hidebubble(); plot zdwn = if rth and close crosses below prelo then high*1.002 else na; zdwn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); zdwn.SetDefaultColor(Color.cyan); zdwn.setlineweight(3); zdwn.hidebubble(); #------------------------- # test stuff input test1 = no; addchartbubble(test1, low*0.998, rth + "\n" + !rth + "\n" + prehi + "\n" + prelo , (if x then color.yellow else color.gray), no); #
how can I turn this code into a scan filter?will look into watch list...
i'm sorry for responding so late, i'm sometimes terrible at replying.
i see you 2 probably aren't around, but will still reply.
@shih90
here is an updated version
@DMacTrades
there is nothing to fix. i took the original request to be any time that isn't normal trading hours, hours before normal trading hours AND hours after them.
after hours, pre market,... these terms could be interpretted differently or as the same period, unless specific times are mentioned.
@LivingWithInterest
..read data from pre market and after hours,.. yes. i lumped them together in my previous version.
you wrote a lot of words, without defining WHAT time period defines what you want. although providing examples are usually good, i'm not going to type in symbols , and go look up data from some date, and try to interpret what you want.
just say , read data from 4am to 9:30. (or whatever the correct EST times are)
@EnotTrader
thanks for replying and bringing this post back to my attention.
premarket , again , be specific.
i'm not trying to sound like a dick.
i want people to think about their questions, and be as specific as they can, to provide pertinent information, in order to better communicate their request.
-----------------------------
this version allows the user to pick the 'after hours' time period to read highs and lows from.
...from normal day close to normal day open - default time
...from midnight to day open - pre
...from day close to midnight - post
the default pre and post times are from and to midnight. if 4am and 8pm are desired, then those times could be typed in the code, for these 2 variables.
def daystart = 0;
def dayend = 2359;
Code:#pre_hilow_breakout_01 # choose pre/post/both after hours #https://usethinkscript.com/threads/question-about-breakout-pre_market-high-low.14488/ #UnAnswered Question about breakout Pre_Market high low def na = double.nan; def bn = barnumber(); #def diffday = if getday() != getday()[1] then 1 else 0; def rth = (GetTime() >= RegularTradingStart(GetYYYYMMDD()) and GetTime() < RegularTradingEnd(GetYYYYMMDD()) ); def rthstart = 0930; def rthend = 1600; def daystart = 0; def dayend = 2359; def pre1 = if secondsfromTime(daystart) >= 0 and secondstillTime(rthstart) > 0 then 1 else 0; def post1 = if secondsfromTime(rthend) >= 0 and secondstillTime(dayend) > 0 then 1 else 0; input after_hours = { pre_hours , post_hours , default both }; def prehi; def prelo; def x; switch (after_hours) { case pre_hours: prehi = if !pre1[1] and pre1 then high else if pre1 and high > prehi[1] then high else prehi[1]; prelo = if !pre1[1] and pre1 then low else if pre1 and low < prelo[1] then low else prelo[1]; x = if pre1 then 1 else 0; case post_hours: prehi = if !post1[1] and post1 then high else if post1 and high > prehi[1] then high else prehi[1]; prelo = if !post1[1] and post1 then low else if post1 and low < prelo[1] then low else prelo[1]; x = if post1 then 1 else 0; case both: prehi = if !rth and rth[1] then high else if !rth and high > prehi[1] then high else prehi[1]; prelo = if !rth and rth[1] then low else if !rth and low < prelo[1] then low else prelo[1]; x = if !rth then 1 else 0; } input show_lines_on_AH = no; def ahlines = if (show_lines_on_AH and !rth) then 1 else 0; plot zhi = if prehi < 1 then na else if rth then prehi else if ahlines then prehi else na; zhi.SetDefaultColor(Color.light_gray); zhi.hidebubble(); plot zlo = if prelo < 1 then na else if rth then prelo else if ahlines then prelo else na; zlo.SetDefaultColor(Color.light_gray); zlo.hidebubble(); plot zup = if rth and close crosses above prehi then low*0.998 else na; zup.SetPaintingStrategy(PaintingStrategy.ARROW_UP); zup.SetDefaultColor(Color.cyan); zup.setlineweight(3); zup.hidebubble(); plot zdwn = if rth and close crosses below prelo then high*1.002 else na; zdwn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); zdwn.SetDefaultColor(Color.cyan); zdwn.setlineweight(3); zdwn.hidebubble(); #------------------------- # test stuff input test1 = no; addchartbubble(test1, low*0.998, rth + "\n" + !rth + "\n" + prehi + "\n" + prelo , (if x then color.yellow else color.gray), no); #
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
J | Candle Range Breakout | Questions | 4 | |
R | Help needed creating breakout resistance line | Questions | 1 | |
S | opening-range-breakout(orb) with Breaks and Retests | Questions | 1 | |
S | Scan: Breakout of previous day high | Questions | 2 | |
M | Shaded Opening Range (No Breakout) | Questions | 8 |
Start a new thread and receive assistance from our community.
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.
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.