# Help on Bar Number for Today only

#### andreythedon

##### New member
Hey Team. So....I'm deciding to slow down...stop gambling and be smarter/more methodical. In my daily chart studies...It'd be really helpful if I can paint the bar number on the chart...for today only (since I typically assess one day at a time). I gave it a shot..but cannot seem to get the painting to START on today. Please see my attempt. Thanks for any input!

def days= getdayOfWeek(getYYYYMMDD());
def today= days<> days[1];
def barn = BarNumber();

plot barns=if today then barn else 0;

barns.SetPaintingStrategy(paintingStrategy = PaintingStrategy.VALUES_BELOW);

Solution
See if this is what you're looking for.

input Begin = 0930;

def start = SecondsTillTime(Begin) <=0;
def Today = GetDay() == GetLastDay();

def barcount = CompoundValue(1,
if today and start
then barcount[1]+1
else barcount[1],0);

Hey Team. So....I'm deciding to slow down...stop gambling and be smarter/more methodical. In my daily chart studies...It'd be really helpful if I can paint the bar number on the chart...for today only (since I typically assess one day at a time). I gave it a shot..but cannot seem to get the painting to START on today. Please see my attempt. Thanks for any input!

give this a try
# find if today is current day
def istoday = GetDay() == GetLastDay();

Not bad!! Thanks. However, this does create paints for only today. The numbers don't start at 1 however...they are actually including The UNCOUNTED days from the rest of the period. This does get me a little closer to the goal line. So thank you!!

See if this is what you're looking for.

input Begin = 0930;

def start = SecondsTillTime(Begin) <=0;
def Today = GetDay() == GetLastDay();

def barcount = CompoundValue(1,
if today and start
then barcount[1]+1
else barcount[1],0);

See if this is what you're looking for.
Woooooaaa...this is it...Thanks a mil. Now I've got to wrap my head around the syntax....you know what..I get it now. The GetLastDay() is key. It says that the MOST LATEST BAR number is equal (==) to the GETDAY (current calculated Day number). That means we will get only true values when the bars are in TODAY.

Sweet!!!

Thanks @Internet Name and @halcyonguy

Is there a new Bar Number Script? or is this the most current?

87k+ Posts
304 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?