Pugazh
Pugazh

Reputation: 9561

How to plot only for today?

I'm trying to create a new study in tradingview using Pine Script.

isCurrentMonth = month(timenow) == month(time)
plot(isCurrentMonth ? close : na)

This piece of code could help me display for current month, but I want to display only for current day.

Thanks for any help!

Upvotes: 3

Views: 5171

Answers (1)

Pugazh
Pugazh

Reputation: 9561

I managed to come up with a solution. Hope it could help someone.

isToday = false

if year(timenow) == year(time) and month(timenow) == month(time) and dayofmonth(timenow) == dayofmonth(time) 
    isToday := true

Upvotes: 16

Related Questions