Brooks Price Action :: Al Brooks Price Action Website

Brooks Price ActionBrooks Price ActionTOS bar counting help!

#1:  TOS bar counting help! Author: Sozo7 Post You have posted in this forum: Fri Jun 04, 2010 9:43 am

Any TOS platform users that have a bar counting method available?

TOS tech does not know how to modify or add this feature...anybody?...THX

#2:   Author: amazinday Post You have posted in this forum: Fri Jun 04, 2010 5:47 pm

You'll probably have to modify the Tradestation code to use the language for TOS, which should be similar enough.

You might ask here for help:
http://www.thinkscripter.com/forum/

#3:  Re: TOS bar counting help! Author: CaptainKirk Post You have posted in this forum: Sun Jun 06, 2010 8:24 pm

If you can be more clear about what you want, I can probably help. I have written about 30 TOS studies.

There exists a function BarNumber() whch tells you the current bar number...
But I am a bit lost as to the importance of counting bars from an arbitrary bar standpoint.

Also, beware, that if you PAD the right side of a TOS chart with 5 bars, they will be numbered the highest
bar numbers, DESPITE a lack of data for them. But you can plot in that area if you wish.

Kirk Out!

#4:   Author: CaptainKirk Post You have posted in this forum: Tue Jun 22, 2010 6:01 am

Here is a Great Script to do this. Enjoy.

input showOnlyToday = YES;
input percent_above = 0.2;
input show_bars_divisable_by = 2;
input location = {default above, below};
input show_range_bubbles = NO;
input show_odd_bars_above = NO;
input maxbarnum = 81;
input Risk_Ticks_Add = 2;

def ticks_below = if TickSize()== 0.25 then 6 Else 10; #points_below/ticksize();
#def ticks_below = 5;

def Delta = Risk_Ticks_Add*ticksize();
# if TickSize()== 0.25 then Risk_ticks_Add else

def yyyyMmDd = getYyyyMmDd();
def session_duration_bars = (regularTradingEnd(yyyyMmDd) - regularTradingStart(yyyyMmDd)) / getAggregationPeriod();
# the above is useless because we cant use it!

#def T = lowest(low[ - session_duration_bars], session_duration_bars);

def lookback = if !IsNan(low[-81]) Then lowest(low[-81],81) Else
if !IsNan(low[-80]) Then lowest(low[-80],80) Else
if !IsNan(low[-26]) Then lowest(low[-26],26) Else
lowest(low[-79],79);

def percent;
def price;
def direction;

switch(location){
case above:
direction = yes;
price = high;
percent = 1 + percent_above/100;


case below:
direction = no;
price = low;
percent = 1 - percent_above/100;
}


def day = getDay();
def lastDay = getLastDay();
def isToday = day == lastday;
def firstBar = if (day[1] != day, day - 1, 0);
def shouldPlot = if(showOnlyToday and isToday, 1, if(!showOnlyToday, 1, 0));


rec count = if shouldPlot then if firstbar then 1 else count[1]+1 else 0;
rec lowval = if firstbar then lookback else lowval[1];
## lowest(low[-79],80)
#plot llow = lowval;
def barDivByTwo = count/show_bars_divisable_by == round(count/show_bars_divisable_by, 0);
def barDivByFour = count/(2*show_bars_divisable_by) == round(count/(2*show_bars_divisable_by), 0);

def blankBar = isNaN(close[-1]);

addchartbubble(barDivByTwo and !blankbar and shouldPlot and (count<maxbarnum),lowval,
concat(count, ""),
#concat(tickSize(), ""),
color.blue, direction);

addchartbubble(Show_Range_Bubbles and barDivByTwo and !blankbar and shouldPlot and (count<maxbarnum),lowval-(ticks_below*tickSize()), concat("", ((High-Low)+Delta)/TickSize()), color.red, direction);

##addchartbubble(Show_Range_Bubbles and barDivByTwo and barDivByFour and !blankbar and shouldPlot and (count<maxbarnum),lowval-(2*ticks_below*tickValue()), concat("", ((High-Low)+Delta)/TickSize()), color.red, direction);

#5:  Re: TOS bar counting help! Author: Sozo7 Post You have posted in this forum: Tue Jun 22, 2010 12:17 pm

can you post a pic of what this looks like, also are there any other TOS users that had success with this script?
I have been unable to get it to function.
Thanks

#6:   Author: CaptainKirk Post You have posted in this forum: Tue Jun 22, 2010 12:33 pm

This is a NEWER version of the code from the guys at TOS. It works great according to 2-3 people. You should be able to install it and use it as is. TURN OFF extended market hours to be safe. 5 Minute chart only.

I cannot add files to this post or forum...

#7:   Author: CaptainKirk Post You have posted in this forum: Tue Jun 22, 2010 12:34 pm

Please see if you get errors because of the QUOTES being inverted. If the script compiles, you should be fine.

PM me, I will setup a meeting using GoToMeeting after the market and set you up.

Kirk Out!
PS: this way I will know the problem and fix it for others in advance.

#8:   Author: GoodSeed Post You have posted in this forum: Tue Jun 22, 2010 6:47 pm

I am tos user... copied it in to new study and it worked without adjustment. Better to use for open session only.

#9:   Author: CaptainKirk Post You have posted in this forum: Tue Jun 22, 2010 6:53 pm

Yes, it is designed to work for the END OF DAY to be honest. It is very difficult to calculate the lowest bar of the day when the number of bars to look forward (not back) is unknown. there is a HACK I have figured out, but it only works if you OVERLAY the volume on the price chart (you basically assign Weak_Volume_Depency, and plot it at POSITION: Volume/Volume (1 by any other name), and change the bubble to be an TOP bubble. but it is a pain to do this.

I don't care about bar numbers DURING the open session. I care about them after the day is closed.

THANKS for confirming that everything worked. Love to know if there are a lot of other TOS users out there...

#10:  Re: TOS bar counting help! Author: Sozo7 Post You have posted in this forum: Thu Jun 24, 2010 5:44 am

Capt Kirk
Thanks for making the bar counter available on the TOS platform.
You did a nice job!

#11:  Re: TOS bar counting help! Author: chulaihuey Post You have posted in this forum: Fri Feb 04, 2011 12:48 pm

I am also using thinkorswim (at least for now). Dropped your code in and it works fine, just had to disable extended session as you stated. Thanks, good work!

#12:   Author: boilingsnail Post You have posted in this forum: Fri Jun 17, 2011 8:45 am

bar counting is real easy in thinkdesktop, although it took me a while to find this simple solution. It's for a 5min chart as 5*60=300.


# plot bar number using seconds since open at 0930 EST
plot barNum = 1 + (secondsFromTime(0930)/300);
barNum.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
Brooks Price ActionBrooks Price ActionTOS bar counting help!


Generated using printer-friendly.
All times are GMT - 8 Hours
Page 1 of 1


Powered by phpBB © phpBB Group
[ IntegraMOD © 2004 The IntegraMOD Group ]
[Page generation time: 0.1685s (PHP: 70% | SQL: 30%) | SQL queries: 67 | GZIP disabled | Debug off]