Home
Forums
Blog
Books
Trading Room
Trading Course
Check your PM
Register
Log in
Al's New
Trading Books!
more info here

.
Image 1193

.
Image 1194

.
Image 1195

Board Navigation
Home
Forum
Books
Trading Room
Trading Course
YouTube Channel
Trading Articles
Trading FAQ
Abbreviations
Kiva Project

Calendar
RSS Feed
Board FAQ
Rules&Disclaimer
Staff
Contact Us

My Cookies
Articles


Sozo7
Subject:  TOS bar counting help!
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

amazinday
Subject:  
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/

CaptainKirk
Subject:  Re: TOS bar counting help!
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!

CaptainKirk
Subject:  
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);

Sozo7
Subject:  Re: TOS bar counting help!
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

CaptainKirk
Subject:  
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...

CaptainKirk
Subject:  
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.

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

CaptainKirk
Subject:  
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...

Sozo7
Subject:  Re: TOS bar counting help!
Capt Kirk
Thanks for making the bar counter available on the TOS platform.
You did a nice job!

chulaihuey
Subject:  Re: TOS bar counting help!
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!

boilingsnail
Subject:  
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);


Page 1 of 1


 Jump to:   
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Full Version
Powered by IntegraMOD 2004, 2005 The Integramod Group
[ Forum powered by phpBB 2001, 2005 phpBB Group :: All times are GMT - 8 Hours :: Design by phpBBXS.Com | Lo-Fi Mod ]
[Page generation time: 1.6362s (PHP: 87% | SQL: 13%) | SQL queries: 77 | GZIP disabled | Debug off]