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;
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?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.
Tick_count only works on intraday aggregations. Try using what worked for me on a four hour aggregation: tick_count() > 3000Hey! 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?
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);
# 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
# 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);
Thank you so much! I will check it out and let you know if it works.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
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;
declare lower;
input length = 12;
def V = volume;
def T = Tick_count;
plot VolumePerTick = V / T;
plot MovingVPT = MovAvgExponential(VolumePerTick, length = length);
Here is a tutorial, you might find helpful to do future searches:
https://usethinkscript.com/threads/search-the-forum.12626/
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
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.