# Tick Buy and Sell Volume Indicator for ThinkorSwim

#### BenTen

Staff member
Staff
VIP
The follow 2 indicators are best used in situations where one would want to know if the majority of trading is machine-driven or not.

TicksPerVolume: Shows volume divided by ticks or in other words the volume traded divided by the number of trades. Higher means larger lots being traded and lower bar means smaller lots.

### thinkScript Code

Code:
``````declare lower;
declare zerobase;

def MoneyCount = volume;

### thinkScript Code

Code:
``````declare lower;
declare zerobase;
#plot

plot TradeCount = (((tick_count(priceType = PriceType.BID)) + (tick_count(priceType = PriceType.ASK))) / 2) / tick_count();``````

Credit:

Hi @BenTen... Thank you so much for this TicksBuyTicksSell indicator. I love it. Made some adjustment on my end to differentiate the counting of BID and ASK. Gotta use in conjuntion with volume indicator as large block of order supersede the counts.

Here's the code:

Code:
``````declare lower;

declare zerobase;

def TradeCountBID = tick_count(priceType = PriceType.BID);

TCA.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

TCA.SetDefaultColor(Color.RED);

TCA.HideBubble();

TCA.SetLineWeight(4);

TCB.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

TCB.SetDefaultColor(Color.WHITE);

TCB.HideBubble();

TCB.SetLineWeight(4);``````

#### Attachments

• 3to1HFA.png
14.6 KB · Views: 301
Last edited by a moderator:
Its a great find guys! I played a bit and made diff histogram. it is quite interesting. I dont yet have the signal for it, but from first glance its shows some interesting divergence from price action
Code:
``````declare lower;
declare zerobase;
declare hide_on_daily;

input avglen=13;
def TradeCountBID = tick_count(priceType = PriceType.BID);

#TCA.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
TCA.SetDefaultColor(Color.dark_green);
TCA.HideBubble();
#TCA.SetLineWeight(2);

#at the bid is bearish
#TCB.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
TCB.SetDefaultColor(Color.red);
TCB.HideBubble();
#TCB.SetLineWeight(2);

diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
diff.assignValueColor(if diff>0 then color.green else color.red);
plot avg=expaverage(diff,avglen);
avg.setdefaultColor(color.plum);

#plot totaldiff=Sum(diff,50);``````

Cool... Thank you @skynetgen. Gotta check it out when I'm home later

Hi @BenTen... Thank you so much for this TicksBuyTicksSell indicator. I love it. Made some adjustment on my end to differentiate the counting of BID and ASK. Gotta use in conjuntion with volume indicator as large block of order supersede the counts.

Here's the code:

Code:
``````declare lower;

declare zerobase;

def TradeCountBID = tick_count(priceType = PriceType.BID);

TCA.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

TCA.SetDefaultColor(Color.RED);

TCA.HideBubble();

TCA.SetLineWeight(4);

TCB.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

TCB.SetDefaultColor(Color.WHITE);

TCB.HideBubble();

TCB.SetLineWeight(4);``````
Hi,
Sorry about the ignorant question, but I tried your code in think or swim and I am getting a n/a instead of 1,1. Can you help me clarify this? Thank you for your help on this

#### Attachments

• 3to1HFA.png
14.6 KB · Views: 213
@skybillion What do you mean by that? Can you post a screenshot?

@skybillion What do you mean by that? Can you post a screenshot?

Ben, thank you for your reply. do you see how its displaying N/A?

Simple difference bid - ask as skynetgen did but not compressed.

Code:
``````declare lower;

def TradeCountBID = tick_count(priceType = PriceType.BID);
plot Dab = diff;
Dab.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
plot zl = 0 ;

Dab.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Dab.SetLineWeight(3);
Dab.DefineColor("Positive and Up", Color.GREEN);
Dab.DefineColor("Positive and Down", Color.DARK_GREEN);
Dab.DefineColor("Negative and Down", Color.RED);
Dab.DefineColor("Negative and Up", Color.DARK_RED);
Dab.AssignValueColor(if Dab >= 0 then if Dab > Dab[1] then Dab.color("Positive and Up") else Dab.color("Positive and Down") else if Dab < Dab[1] then Dab.color("Negative and Down") else Dab.color("Negative and Up"));``````

Hi @BenTen . The name of the first indicator is TicsPerVolume but the formula is volume/ticks which would make it VolumePerTics. Shouldn't the name be changed?......Thanks for all your posts and codes. I am not new to TOS but definetely a newbie with thinkscript.

Can someone enlighten me on the difference between tick_count() and tick_count(priceType = priceType.MARK)? I thought they would be the same but differ at times. Thanks in advance for any replies!

declare lower;
plot zero = 0;
plot TradeCount_Mark = tick_count(priceType = "MARK");

This tread went quiet. Is anyone using this indicator with success? If you are, which code are you using?

Pardon my ignorance @BenTen How is the second script (TicksBuyTicksSell) different from another linear volume graph like OBV?

@Necr0sis I'm not too familiar with this script either

The above are great for viewing but not for trading inputs. Dont waste too much time.

Following. Want to see what I can do to integrate with a piece of code I have.

What is the difference between volume and tick_count functions?

87k+ Posts
406 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?