LPAOriginal
LPAOriginal

Reputation: 11

Pine Script: Plot Only Selected Range

I'm trying to allow a user to set a specified range of candles back from the current candle, then plot an area graph only from 'close' values in that range.

I can't figure out how to make the new plot start only from the selected candle.

User sets range range = input(title="Range Window", type=input.integer, defval=20, minval=1)

Volume from previous close long_volume = iff(overridesym == true, long_security("1",close), close)

This is the part I don't know... plot(long_volume, (over the length of 'range'), style=plot.style_area,)

Upvotes: 0

Views: 740

Answers (1)

vgladkov
vgladkov

Reputation: 554

You can use the show_last parameter

//@version=5
indicator("My Script")
i = input.int(20)
plot(close, show_last=i)

Upvotes: 1

Related Questions