Reputation: 1
I'm new to the Pine Script. Is it possible to plot two extra lines on a specific date or multiple dates? For example, I'm interested on the performance of stocks on 5/14/2021 and after. Is there a way to come up with a script that I can option to choose date 5/14/2021 first, then it will plot a top line (102 % at the position of the open price) and a bottom line (99% at the position of the open price). I'm using the 'Short Position' tool from Tradingview to draw a graph for analysis, but once it comes to dozens of stocks, this is too much of work to do.
Thanks.
Upvotes: 0
Views: 426
Reputation: 8789
You could use something like this. It uses a time input so that you can change the starting date:
//@version=4
study("", "", true)
i_date = input(timestamp("2021-05-14"), type = input.time)
var float hi = na
var float lo = na
if time == i_date
hi := open * 1.02
lo := open * 0.99
plot(hi)
plot(lo)
Upvotes: 0