hi mashume thank you for your reply. i've written a genuine buy/sell/neutral volume indicator for use on the 1-tick chart that i'd love you to take a look at and possibly help me expand. i'm new to thinkscript and still learning but really want to expand this tool.
Code:
declare lower;
#--------------------
def last = close;
#this is just for conceptual clarity. on the 1-tick chart, the close is always the last.
#--------------------
#restrictive buying, selling, and neutral logic:
def buyingTrue = if last > last[1] then 1 else 0;
def sellingTrue = if last < last[1] then 1 else 0;
def neutralTrue = if last == last[1] then 1 else 0;
#--------------------
# buy/sell/neutral volume / plots
plot buyingVol = if buyingTrue == 1 then volume else 0;
buyingVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
buyingvol.setdefaultcolor(color.GREEN);
plot sellingVol = if sellingTrue == 1 then volume else 0;
sellingVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
sellingvol.setdefaultcolor(color.RED);
plot neutralVol = if neutralTrue == 1 then volume else 0;
neutralVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
neutralvol.setdefaultcolor(color.GRAY);
the basic idea is that if the last trade raised the last price at all, it's volume is counted as buying. if the last trade lowered the last price, it's volume is counted as selling, and if the last trade didn't move the last price, it's volume is counted as neutral.
what i want to be able to do is use this as a 1-tick chart indicator but aggregate the data for higher timeframes. want to be able to see the buy/sell/neutral vol for every one minute, every 5 minutes, etc. or higher tick aggregations. i'm trying to work with counting and resetting counts etc so i can aggregate the ticks into bigger bars but i'm having a hard time finding the right way to learn.
this fellow seems to have had success using 1-tick data to do all kinds of things...so i hope what i want is possible.