IPO stocks

I want to create a study to use in the stock scanner that shows stocks trading for less than 200 days (they don't have a 200 moving average yet).
Code:
plot Data = compoundvalue(1, if IsNan(close[200]) then 1 else 0,close);
My attempt to code this shows stocks that have just started trading for 200 days (DOCS for instance), but that's not what I'm looking for. Any help would be greatly appreciated!
https://usethinkscript.com/threads/ipo-stocks.4379/#post-40322
 

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

TOS built in scanner - filtering based on IPO date

How can I add a filter to a scanner for including only companies that have been trading for at least X years?
Thanks
 
Last edited by a moderator:
I am trying to shade the first 90 days of an IPO RED. Then between 90 and 180 days I'd want it shaded BLUE. After 180 days there would be no shading applied on the daily chart.

Ticker CYN would be a good example as it's a recent IPO that just passed the 180 day mark.

I'm currently using the following code to highlight the first 90 bars Red after an IPO begins trading. But the problem is it highlights the first 90 bars (NOT the first 90 days). Any suggestions?

def test = Open()[0];
AddCloud(if highest(test, 1) > 0 then Double.POSITIVE_INFINITY else Double.NaN, if Highest(test, 1) > 0 then Double.NEGATIVE_INFINITY else Double.NaN, Color.RED, Color.GREEN);
AddCloud(if highest(test, 90) > 0 then Double.POSITIVE_INFINITY else Double.NaN, if Highest(test, 90) > 0 then Double.NEGATIVE_INFINITY else Double.NaN, Color.BLUE, Color.CURRENT);

A visual of what I'm looking for. First 90 days shaded red, next 90 days shaded blue, then no shading after 180 days.
ehhxDpe.png


I simplified the code a little. I'm still trying to figure out a way to highlight the first 90 days red as opposed to the first 90 bars though. Any ideas?

Code:
AddCloud(if barnumber()<=90 then Double.POSITIVE_INFINITY else Double.NaN,  Double.NEGATIVE_INFINITY, Color.RED, Color.RED);
AddCloud(if between(barnumber(), 90, 180) then Double.POSITIVE_INFINITY else Double.NaN,  Double.NEGATIVE_INFINITY, Color.BLUE, Color.BLUE);

I created this code that highlights a chart red the first 90 bars after an IPO begins trading. However, I really want the code to highlight the first 90 trading days (and NOT just the first 90 bars). Any ideas how to tweak this code?

Code:
AddCloud(if barnumber()<=90 then Double.POSITIVE_INFINITY else Double.NaN,  Double.NEGATIVE_INFINITY, Color.RED, Color.RED);
 
Last edited by a moderator:
Hi,

Is there a way to find the lowest and highest daily values of any stock since the beginning of its trading period (IPO)?

I tried using a the Lowest(Low, standard input lookback period) but this doesn't work and returns N/A.

Appreciate any help.
Currently, there is no identifications of "IPO".

TOS built in scanner - filtering based on IPO date

How can I add a filter to a scanner for including only companies that have been trading for at least X years?
Thanks
@stock2020 @tradephoric

There is no simple method to identify an IPO.
This thread discusses the suggestions of how to begin your coding quest in attempts to identify IPOs
 
Last edited:
Since I am not aware that IPO dates can be identified in scripts, here is an example of how to use dynamic dates to create verrticallines, labels and/or clouds. The example finds the highest high in the last 252 days and creates a cloud between the date that occurred and the next 90 days.

Capture.jpg
Ruby:
def ymd = GetYYYYMMDD();
def bn  = BarNumber();
def hd  =  GetMaxValueOffset(high, 252);
def begindate = if bn == HighestAll(bn - hd)
                then ymd
                else begindate[1];

input days   = 90;
def enddate  = if bn == HighestAll(bn - hd) + days
               then ymd
               else enddate[1];

input showlabel = yes;
AddLabel(showlabel, " Cloud Range : " + AsPrice(begindate) + " - " + AsPrice(enddate));

input showverticalline = yes;
AddVerticalLine(showverticalline and ymd == begindate, "");
AddVerticalLine(showverticalline and ymd == enddate, "");

DefineGlobalColor("Range", Color.RED);
input showcloud = yes;
AddCloud(if showcloud and Between(bn, HighestAll(bn - hd), HighestAll(bn - hd) + 90) then Double.POSITIVE_INFINITY else Double.NaN, Double.NEGATIVE_INFINITY, GlobalColor("Range"), GlobalColor("Range"));
 
Last edited by a moderator:
Code:
Def Days; Def Date;
    If BarNumber() == 1 {
        Date = getyYYYMMDD();
        Days = highestall(daysFromDate(Date));
    } else {
        Date = Date[1];
        Days = Days[1];   
    }
;
Def Days90 =
    DaysFromDate(Date) <= 90;
;
Def Days200 =
    Days <= 200;
;
AddCloud(
    if Days90 and Days200
        then Double.POSITIVE_INFINITY
        else Double.NaN, 
    Double.NEGATIVE_INFINITY,
    Color.LIGHT_RED
);
 
Is there a way to scan for upcoming end of IPO lockup period?
Since the lockup period ends, I don't want to just scan for x days since IPO. I want to scan for any upcoming expiration of lockup period within x number of days?
or is this info available easily somewhere else?
 
Is there a way to scan for upcoming end of IPO lockup period?
Since the lockup period ends, I don't want to just scan for x days since IPO. I want to scan for any upcoming expiration of lockup period within x number of days?
or is this info available easily somewhere else?
The ToS data feeds do not have expiration of lockup period information available to filter on.
 
Looked at the scanner today. A stock that was IPOed today is not in the list of "All Stocks" or "All Symbols", so whatever code we can come up with is not going to work.
 
Greetings All,

I am trying to work with a scan filter in month aggregation mentioned in the code. However, I see no stocks were scanned using this criteria. Please help. Thank you

Code:
def d = isnaN(open [1]);

plot scan = d;
 
No previous open would be the first and only month bar, so I am assuming you're looking for recent IPOs then? You would be better off just doing something like BarNumber() == 1.
 
I am trying in the following way on a daily aggregation to track IPOs, but it seems not to be working. Can you please suggest @Joshua

Code:
def a = isnan(open[1])==1;

plot scan = a;
It sounds like you are attempting to use barnumber function to find an IPO.
@Joshua provided you with the syntax that you need.
You need to stop leaving barnumber out of your code.

While the following post does not do what you want; it does provide an example of using barnumber to identify IPOs:
https://usethinkscript.com/threads/ipo-stocks.4379/page-3#post-98927


Please read through this thread, to get a better understanding of the trials and tribulations of finding IPOs.
 
Last edited:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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