Premarket After-market For ThinkOrSwim

Noticed that you've been asking this question several times across more than one different thread. Did you not see my response I posted here?

https://usethinkscript.com/threads/custom-indicator-in-watchlist-opening-range.1457/#post-13525
I spent quite some time looking into the code you provided, and even wrote a separate standalone study to confirm that, there's absolutely nothing wrong with your premarket high/low code that you posted here.

https://usethinkscript.com/threads/custom-indicator-in-watchlist-opening-range.1457/
 
@BenTen I think this is a great indicator but for some reason on the low of premarket its not actually plotting the lowest bar/candlestick? also...is there a way to plot the open and close of the very first bar/candlestick? Thanks in advance. good stuff!
 
@Tally Since @BenTen may not have an opportunity to respond to your query, I looked into the issue you pointed out. Several studies were shared above. My assumption is that you are referring to post #3 above. Looking through the code I can ascertain that it certainly is capturing the high/low of the premarket.

To convince yourself, run the following code on a 1 minute chart of say /ES or whatever equity you're tracking. This was extracted from post#3 and modified slightly to display the GlobeX/overnight period. A reading of 1 denotes the premarket period. Personally I see no issues here. This is always the best way to see if the period under consideration is correct or not.

Code:
declare lower;
plot GlobeX = GetTime() < RegularTradingStart(GetYYYYMMDD());
 
Hi @korygill - I picked up on this premarket Hilo code you built. Awesome.... Is there a way to add a marker or bubble input to it.... just so it can be identified in the midst of multiple lines on a chart?
 
Try this update to put a chart bubble on each line.

rSZuRf8.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], 0);
def PMLow = CompoundValue(1, if PMStart then vLow else if PMhrs then Min(vLow, PMLow[1]) else PMLow[1], 0);
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;

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
 
Thanks @korygill - appreciate it. Can we however have an additional input on where to place the bubble? Something like a "distance from last candle" input..... which allows us input a value and it places the chart bubble where we want it... either to the left,right or center?
 
@BenTen is there a way to put this in a scan for the 15 min chart a candle close above the pre market high ? and a close below pre market low Thanks
 
Last edited:
@Buckbull You would want something like “close crosses above or below pre-market high or low”. Depending on what you need.
 
Hello,

Is there a script that draws a horizontal current price (including pre-market & post-market price) line on a chart that has extended hours off?
Possibly something that uses the last price to plot the line?

Thank you.
 
First of all, thank you very much for the indicator @BenTen, was furiously looking for this. I was wondering if there is a way to plot the indicator for all the previous days on the chart? It would be very helpful to backtest visually. Thank you once again.
 
I wanted to scan for stocks above Premarket High based on the post below that plots the indicator and came up with the following which doesn't pull any stocks when creating a Custom Study scan:

Code:
input PlotPreMktLinesHrsPastOpen = 0;


def PMhrs = RegularTradingStart (GetYYYYMMDD()) > GetTime();
def RMhrs = RegularTradingStart (GetYYYYMMDD()) < GetTime();
def PMStart = RMhrs[1] and PMhrs;
def PMHigh = CompoundValue(1, if PMStart then high else if PMhrs then Max(high, PMHigh[1]) else PMHigh[1], 0);
def bar = BarNumber();
def highBar = if PMhrs and high == PMHigh then bar else Double.NaN;
def PMHighBar = if bar == HighestAll(highBar) then PMHigh else PMHighBar[1];

plot PMH =  close > PMHighBar;
Any help greatly appreciated!
 
plot PMH = close > PMHighBar; Rethink what you are plotting? Does this even plot?
Not a coder by any means and barely crawling at that horserider, it doesnt plot and hence why want to learn why as the indicator is correct to what I want it to do (or look for) but looking for help or guidance to learn
 

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