Premarket After-market For ThinkOrSwim

Thanks @Len20 . I just added this watchlist column. It is showing the % change from the previous close not the % change after the market close.

Please check the ticker EVOK and it showing 2.6% and it is same as default % change column.

The formula would be Market % Change - % Change will be the correct value to identify the AH price change.

Here is another set of code found from Hahn site. I hope this okay to be shared here.

Code:
input marketClose = 1555;
def closeCounter = SecondsTillTime(marketClose);
def regSessEnd = closeCounter == 0;
rec priorDayClose = if regSessEnd then close else priorDayClose[1];
def change = ((close-priorDayClose) / priorDayClose) * 100;
def con1 = change >= 3 or change <= -3;
plot scan = con1;
 
Last edited:
@lowtrade It sounds like you have the aggregation period set to daily. It needs to be set lower. 1 min aggregation should be accurate and shows EVOK at 74.5%. I use 1 hr aggregation because it seems to load slightly faster and I believe it is just as accurate.

The only difference from code that uses daily aggregation is the final closing price for the day might actually be slightly different than the close of the final bar for that day.
 
Last edited:
Hi, does anyone have an issue with this code where gXhigh goes N/A at 10:45am? It's happening to me repeatedly and is repeatable using OnDemand. I'm trying to debug it but I'm not as familiar with thinkscript. @BenTen
 
Hi Ben! First time here. Could this be changed to show only high and low of premarket session, that starts at 4 AM EST? with the option to show only last day or all. Thank you!!
 
@thinky See code above
Hey, @BenTen, I also would like to see fib lines based on the high and low of premarket. You told Thinky to look above, but I tried the two above, yet neither of those were fib drawings based solely on the PM high and lows. Is it possible somebody modified the code after you had posted this?

Thanks,
Jason
 
@CDJay The code in post #1 will do exactly just that. Did you try it out yet? Can you show a screenshot of what is not working?
 
@BenTen

A couple of questions:

Question #1. How can I remove the colored price bubbles on the right side?

I don't know which lines in the code I need to modify.

I am using your code from #1 (Page 1).

4Pze7B6.png


Question #2. How can I change the color of the Fibonacci lines? I couldn't find any color indications for the Fibo lines in the code.

Thank you
 
Last edited:
@twitty_twit You can disable the bubbles by opening the Study Settings Panel, the gear at the right of the Study, and Un-Check the Show Bubble option... I turn them off on most Studies and most Studies have multiple bubbles to turn off...
 
Hello,

I found this indicator but it only plots on the current day. I want every day to have the overnight high and low plotted. Is there some modification I can make to the code so that it shows the levels for all days?
 
@Esminiguu Did you try the code in post #3? If that doesn't work then use the code below:

Code:
# TS_GlobexRange
# http://thinkscripter.wordpress.com
# [email protected]
# Last Update 18 JUL 2009

input Globex_Open = 1630;
input Globex_Close = 0930;

def globexOpen = if(secondsFromTime(Globex_Open) >= 0 or secondsTillTime(Globex_Close)>=0, 1, 0);
def globexReset = if globexOpen and !globexOpen[1] then 1 else 0;

rec globexHigh = compoundValue(1, if((high > globexHigh[1] and globexOpen) or globexReset, high,globexHigh[1]),high);
rec globexLow = compoundValue(1, if((low < globexLow[1] and globexOpen) or globexReset, low,globexLow[1]),low);

plot Globex_High = globexHigh;
Globex_high.SetStyle(curve.SHORT_DASH);
Globex_High.SetDefaultColor(color.pink);
Globex_High.setLineWeight(2);
plot Globex_Low = globexLow;
Globex_Low.SetDefaultColor(color.pink);
Globex_Low.setLineWeight(2);
 
@korygill Nice work on this!!

Is it possible to set this up so it would show previous premarket price channels as well? I've got another set of lines I want to merge with this but keep coming up empty on being able to see the premarket channel for previous days.
 
Here is an update to track prev values like that @autolox asked for.

Vd6HQ0R.png


Code:
#
# see https://usethinkscript.com/threads/how-to-get-current-days-premarket-high.695/
#
declare once_per_bar;

input PlotPreMktLinesHrsPastOpen = yes;
input ShowChartBubbles = yes;

def bar = BarNumber();
def nan = Double.NaN;
def vHigh = high;
def vLow = low;

def PMhrs = RegularTradingStart (GetYYYYMMDD()) > GetTime();
def RMhrs = RegularTradingStart (GetYYYYMMDD()) < GetTime();
def PMStart = RMhrs[1] and PMhrs;
def PMHigh = CompoundValue(1, if PMStart then vHigh else if PMhrs then Max(vHigh, PMHigh[1]) else PMHigh[1], nan);
def PMLow = CompoundValue(1, if PMStart then vLow else if PMhrs then Min(vLow, PMLow[1]) else PMLow[1], nan);
def highBar = if PMhrs and vHigh == PMHigh then bar else nan;
def lowBar = if PMhrs and vLow == PMLow then bar else nan;
def PMHighBar = if bar == HighestAll(highBar) then PMHigh else PMHighBar[1];
def PMLowBar = if bar == HighestAll(lowBar) then PMLow else PMLowBar[1];

plot PMH =  if PlotPreMktLinesHrsPastOpen and PMHighBar != 0
            then PMHighBar
            else nan;
plot PML =  if PlotPreMktLinesHrsPastOpen and PMLowBar != 0
            then PMLowBar
            else nan;
plot PMMid = if PlotPreMktLinesHrsPastOpen and PMHighBar != 0 and PMLowBar != 0
             then (PMHighBar + PMLowBar) / 2
             else nan;


def prevPMHigh = if PMStart[-1] then PMHigh[1] else prevPMHigh[1];
plot pPMH = if !IsNaN(prevPMHigh) and prevPMHigh != 0 then prevPMHigh else nan;
pPMH.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
pPMH.AssignValueColor(PMH.TakeValueColor());

def prevPMLow = if PMStart[-1] then PMLow[1] else prevPMLow[1];
plot pPML = if !IsNaN(prevPMLow) and prevPMLow != 0 then prevPMLow else nan;
pPML.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
pPML.AssignValueColor(PML.TakeValueColor());

def prevPMMid = if PMStart[-1] then ((PMHigh[1]+PMLow[1])/2) else prevPMMid[1];
plot pPMM = if !IsNaN(prevPMMid) and prevPMMid != 0 then prevPMMid else nan;
pPMM.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
pPMM.AssignValueColor(PMMid.TakeValueColor());


AddChartBubble(ShowChartBubbles and bar == HighestAll(highBar),
  PMHigh,
  "PM High",
  Color.GRAY,
  1);

AddChartBubble(ShowChartBubbles and bar == HighestAll(lowBar),
  PMLow,
  "PM Low",
  Color.GRAY,
  0);

AddChartBubble(ShowChartBubbles and bar == Max(HighestAll(highBar), HighestAll(lowBar)),
  (PMHighBar + PMLowBar) / 2,
  "PM Mid",
  Color.GRAY,
  1);

# end of script
 
Last edited:
Does anyone have a scanner that will alert you when a stock breaks above PM highs and break below PM lows? I have been searching through this site and cant seem to find one. Thanks!
 
@lowtrade is correct your scan and the default TOS study for After hours percent change are incorrect they are showing the change from previous day close. How to scan for the difference between Last and Mark? The formula should be (Mark-Last)/Last. For CRIS today the % it gained in the after hours only should be (6.86-6.55)/6.55 = .047%


laTzohy.jpg
 
Does anyone have a scanner that will alert you when a stock breaks above PM highs and break below PM lows? I have been searching through this site and cant seem to find one. Thanks!
go back and read the first or second page of this thread. BenTen lays it out for you.
 
@BenTen

I am using your code from #3 of this thread.

Currently, the automatically drawn pre-market high and low lines only show on today's date. I would like to see it for previous days for the last 10 days.

What parts of the code need to be added or changed?

Thank you
 
@ojtrade You can try this one:

Code:
# TS_GlobexRange
# http://thinkscripter.wordpress.com
# [email protected]
# Last Update 18 JUL 2009

input Globex_Open = 1630;
input Globex_Close = 0930;

def globexOpen = if(secondsFromTime(Globex_Open) >= 0 or secondsTillTime(Globex_Close)>=0, 1, 0);
def globexReset = if globexOpen and !globexOpen[1] then 1 else 0;

rec globexHigh = compoundValue(1, if((high > globexHigh[1] and globexOpen) or globexReset, high,globexHigh[1]),high);
rec globexLow = compoundValue(1, if((low < globexLow[1] and globexOpen) or globexReset, low,globexLow[1]),low);

plot Globex_High = globexHigh;
Globex_high.SetStyle(curve.SHORT_DASH);
Globex_High.SetDefaultColor(color.pink);
Globex_High.setLineWeight(2);
plot Globex_Low = globexLow;
Globex_Low.SetDefaultColor(color.pink);
Globex_Low.setLineWeight(2);
 
Has anyone finally solved this? Is their a functional code that incorporates the latest comments?

Would be most obliged if someone can post😇🙇‍♀️❤️🙏
 

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
314 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