Number Of Trades In ThinkOrSwim

Eli

New member
Hi,
Is there a filter for "a number of trades" in the Scan?
I did find any Post or Script for it.
 
Does anyone have a script that can show the number of traders the stock has on the day? For example, when it's 11:30 am, I want to see the number of trades it's traded so far on the day like I see the volume.

9EVElC0.png
 

Based upon the above chart, the 'Trades Pre_Breakout' are determined by use of the function 'tick_count'.
TOS defines 'tick_count() as : Returns the number of trades corresponding to an intraday bar.
I have made some code to show how this is determined in your posted chart.
Upper chart code
Code:
input timezone = {default "ET", "CT", "MT", "PT"};

def starthour  = (if timezone == timezone."ET"
                        then 9
                        else if timezone == timezone."CT"
                        then 8
                        else if timezone == timezone."MT"
                        then 7
                        else 6) ;
def hour = Floor(((starthour * 60 + 30) + (GetTime() - RegularTradingStart(GetYYYYMMDD())) / 60000) / 60);
def minutes = (GetTime() - RegularTradingStart(GetYYYYMMDD())) / 60000 - ((hour - starthour) * 60 + 30) + 60;

#Highest High during RTH
def hi         = CompoundValue(1, if GetTime() crosses above RegularTradingStart(GetYYYYMMDD())
                                       then high
                                       else if high > hi[1]
                                       then high
                                       else hi[1]
                                  , hi[1]);
def hbar       = if GetDay() == GetLastDay()
                 then if high == hi
                      then BarNumber()
                      else hbar[1]
                 else 0;

def phbar      = if hbar != hbar[1] then hbar[1] else phbar[1];
def phigh      = HighestAll(if BarNumber() == HighestAll(phbar) then high else Double.NaN);

def cond       = if high crosses above phigh then high else double.nan;
plot hdcross   = if high == highestall(cond) then high else double.nan;
hdcross.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_DOWN);

def hihr    = if high crosses above phigh then hour    else hihr[1];
def himin   = if high crosses above phigh then minutes else himin[1];
AddLabel(1, "Breakout Time "
            + (hihr + ":") +
           (if himin < 10
            then "0" + himin
            else  "" + himin ) , Color.WHITE);

def trades      = if GetDay() != GetLastDay() then 0 else tick_count() + trades[1];
def trades_cond = if high crosses above phigh then trades[1] else Double.NaN;
AddLabel(1, "#Trades Pre_Breakout " + HighestAll(trades_cond), color.yellow);
Lower Chart code
Code:
def Data = if GetDay() != GetDay()[1] then 0 else Data[1] + tick_count();
plot trades = Data;
 
Last edited:
Based upon the above chart, the 'Trades Pre_Breakout' are determined by use of the function 'tick_count'.
TOS defines 'tick_count() as : Returns the number of trades corresponding to an intraday bar.
I have made some code to show how this is determined in your posted chart.
Hey! sorry to bother, but Im trying to set up a scan that allows me to see the stocks that had more than 3000 trades on a day. I tried using the tick_count function but its not working. Could you help me?
 
Hey! sorry to bother, but Im trying to set up a scan that allows me to see the stocks that had more than 3000 trades on a day. I tried using the tick_count function but its not working. Could you help me?
Tick_count only works on intraday aggregations. Try using what worked for me on a four hour aggregation: tick_count() > 3000
 
Hi! I am trying to get a label on my chart for the number of trades that occurred on the current trading day.

Thinkscript isn't letting use tick_count for some reason

This is what i have:
def TradeCount = tick_count;
AddLabel (yes,"# of Trades" + TradeCount, Color.Cyan);
 
@SleepyZ - Thank you for sharing!

I added the following code to a watchlist column to enable sorting based off 'trade' count; results yielded 0.0 or NaN -

def Data = if GetDay() != GetDay()[1] then 0 else Data[1] + tick_count();
plot trades = Data;

Hoping it isn't a platform limitation and someone knows of a solution.


*EDIT - Google search result...

Code:
# Total Trades Scan
# Mobius
# V01

def RTHo = getTime() crosses above RegularTradingStart(getYYYYMMDD());
def Ticks = if RTHo
then Tick_Count()
else Ticks[1] + Tick_Count();

plot ScanCond = Ticks > 500; # Adjust this value for whatever comparison you want

Code:
# Total Trades Label for WatchList Column or Chart Study
# Mobius
# V01

def RTHo = getTime() crosses above RegularTradingStart(getYYYYMMDD());
def Ticks = if RTHo
then Tick_Count()
else Ticks[1] + Tick_Count();

AddLabel(1, "Total Trades = " + Ticks, color.white);
 
Last edited:
I wouldn't think this hard to find, but I can't find how to find out the number or actual trades that make up the volume for a given period? You may have good volume, but if there is a relatively small number of trades it would indicate institutional buying and you could get fooled on liquidly. HELP!
 
perhaps something in this, though it is do do with renko charts
https://usethinkscript.com/threads/renko-wave-volume.10005/#post-89852
might be of interest.

You can divide volume by tick_count
https://tlc.thinkorswim.com/center/...ts/FundamentalType/FundamentalType-TICK-COUNT
to perhaps see a pattern in the volume per trade taking place. If the volume per trade is high, it may be larger traders moving in or out. If the volume per trade is low or constant, it may be non-institutional traders. But those are certainly only guesses.

-mashume
 
perhaps something in this, though it is do do with renko charts
https://usethinkscript.com/threads/renko-wave-volume.10005/#post-89852
might be of interest.

You can divide volume by tick_count
https://tlc.thinkorswim.com/center/...ts/FundamentalType/FundamentalType-TICK-COUNT
to perhaps see a pattern in the volume per trade taking place. If the volume per trade is high, it may be larger traders moving in or out. If the volume per trade is low or constant, it may be non-institutional traders. But those are certainly only guesses.

-mashume
Thank you so much! I will check it out and let you know if it works.
Thanks @mashume I like what I see, can you extrapulate a bit on how you visualize and interpet the lower study.
 
Last edited by a moderator:
I threw this together back a while:
Code:
declare lower;

input length = 12;

def V = volume;
def T = Tick_count;

def tvb = (close - low) + (close - open) - (high - close);

def sign = if HL2 + tvb > HL2 then 1 else -1;

plot VolumePerTick = sign * V / T;
VolumePerTick.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
VolumePerTick.AssignValueColor(if VolumePerTick > 0 then Color.DARK_GREEN else Color.DARK_RED);

plot MovingVPT = MovAvgExponential(VolumePerTick, length = length);
AddCloud(MovingVPT * 3.14,  0,  Color.GREEN,  Color.RED);

plot zero = 0;

it provides some interesting notion of movements as it tries to use the true value of a bar to determine the direction of most of the trades.


a much simplified version that looks at just v/t and a moving average works like this:
Code:
declare lower;
input length = 12;

def V = volume;
def T = Tick_count;

plot VolumePerTick = V / T;

plot MovingVPT = MovAvgExponential(VolumePerTick, length = length);

No screen shots today, just some code.

-mashume
 
i was in a chatroom with someone sharing the screen of their paid scanner that show number of trades (not volume of trades) but a number of actual trades.

so i wanted to create the same scanner in TOS but i dont know if its possible if they even give access to number of trades through the platform

ideally i would like to set up number of trades within the price range i want. because i wont be trading tesla or amazon stock
 
Last edited by a moderator:
Last edited:

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