helanom
helanom

Reputation: 11

how to plot shape only specific time frame in pine script?

I want to have a condition based plot shape only on 1 minute time frame, so the flag only on one minute not even 2 minute or higher or less ?? for example if in on minute time frame

volume > 1000

plot shape()

Upvotes: 0

Views: 1406

Answers (1)

TJalam
TJalam

Reputation: 368

you can use timeframe.multiplier (Return Type is simple int ) Multiplier of resolution, e.g. '60' - 60, 'D' - 1, '5D' - 5, '12M' - 12

or timeframe.period (Return Type is simple string ) Resolution, e.g. '60' - 60 minutes, 'D' - daily, 'W' - weekly, 'M' - monthly, '5D' - 5 days, '12M' - one year, '3M' - one quarter.

in your case any of the following can be used:

plotshape(timeframe.multiplier==1 and your_condition_true , style=shape.triangledown, location=location.abovebar, color=color.red)

plotshape(timeframe.period=='1' and your_condition_true , style=shape.triangledown, location=location.abovebar, color=color.red)

Upvotes: 1

Related Questions