• Get $30 off VIP with code SUMMER30. Ends July 27. Happy trading!

Tick Buy and Sell Volume Indicator for ThinkorSwim

BenTen

Administrative
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.

TicksBuyTicksSell: Shows the number of trades on the buy side plus the number of trades on the sell side divided by the number of trades.

ticks.png


thinkScript Code

Code:
declare lower;
declare zerobase;

def TradeCount = tick_count;
def MoneyCount = volume;

plot avgTradeCount = ((MoneyCount[1] + MoneyCount) / 2) / ((TradeCount + TradeCount[1]) / 2);

AvgTradeCount.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
AvgTradeCount.AssignValueColor(if TradeCount >= AvgTradeCount then Color.UPTICK else Color.DOWNTICK);

thinkScript Code

Code:
declare lower;
declare zerobase;
#plot

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

Credit:
 

SolidChiken

New member
2019 Donor
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.

3to1HFA.png


Here's the code:

Code:
declare lower;

declare zerobase;

def TradeCountASK = tick_count(priceType = PriceType.ASK);

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

plot TCA = TradeCountASK;

TCA.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

TCA.SetDefaultColor(Color.RED);

TCA.HideBubble();

TCA.SetLineWeight(4);

plot TCB = TradeCountBID;

TCB.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

TCB.SetDefaultColor(Color.WHITE);

TCB.HideBubble();

TCB.SetLineWeight(4);
 
Last edited by a moderator:

skynetgen

Well-known member
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 TradeCountASK = tick_count(priceType = PriceType.ASK);
def TradeCountBID = tick_count(priceType = PriceType.BID);

#at the ask is bullish
plot TCA = TradeCountASK;
#TCA.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
TCA.SetDefaultColor(Color.dark_green);
TCA.HideBubble();
#TCA.SetLineWeight(2);

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

plot diff=TradeCountASK-TradeCountBID;
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);
 

skybillion

New member
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.

3to1HFA.png


Here's the code:

Code:
declare lower;

declare zerobase;

def TradeCountASK = tick_count(priceType = PriceType.ASK);

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

plot TCA = TradeCountASK;

TCA.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

TCA.SetDefaultColor(Color.RED);

TCA.HideBubble();

TCA.SetLineWeight(4);

plot TCB = TradeCountBID;

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
 

horserider

Well-known member
VIP
Simple difference bid - ask as skynetgen did but not compressed.

Code:
declare lower;
def TradeCountASK = tick_count(priceType = PriceType.ASK);

def TradeCountBID = tick_count(priceType = PriceType.BID);
def diff = TradeCountASK - TradeCountBID;
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"));
 

mudcat

New member
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.
 

Lancier

New member
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 TradeCount = tick_count;
plot zero = 0;
plot TradeCount_Mark = tick_count(priceType = "MARK");
TradeCount.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
 

3AMBH

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

Thanks in advance.
 

cesarword

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

Code:
declare lower;
def TradeCountASK = tick_count(priceType = PriceType.ASK);

def TradeCountBID = tick_count(priceType = PriceType.BID);
def diff = TradeCountASK - TradeCountBID;
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 I have a question, is it ok to cumulative delta volume this way?


input displace =1;
plot data = Sum(diff - displace, 100);
 

cesarword

New member
Hi Ben I have a question I created this code to plot the cumulative delta but I have a problem to differentiate when the ticks are happening at the same price. I have an If condition to separate up tick from down tick, but when it ticks at the same price I don't know what function should I use in order to separate if that tick is happening at the bid or the ask.

Here is the code I will really appreciate if you take a look thanks.

Code:
#----------------------------

declare lower;
declare zerobase;
input length = 900;

def Ask = If( close from 0 bars ago > close from 1 bars ago,volume,0);
def Bid = If( close from 0 bars ago < close from 1 bars ago,volume,0);
def comulative= sum(Ask-Bid,900);

plot z = 0;

plot High = HighestAll(comulative);
plot Low = LowestAll(comulative);

plot Bullish = (comulative);


Bullish.AssignValueColor(if comulative >= 0 then Color.UPTICK else Color.DOWNTICK);
Bullish.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
 

Similar threads

Top