You can use the built-in functions open
, high
, and low
to obtain the current day's open price, high, and low for a script in pine script. Here is an example code snippet:
//@version=4
study("Current Day's OHLC")
// Get current day's open, high, and low
ohlc_open = open[1]
ohlc_high = high[1]
ohlc_low = low[1]
// Plot the values on the chart
plot(ohlc_open, color=color.blue, style=plot.style_line, linewidth=2)
plot(ohlc_high, color=color.red, style=plot.style_line, linewidth=2)
plot(ohlc_low, color=color.green, style=plot.style_line, linewidth=2)
In this example, we use the open[1]
, high[1]
, and low[1]
functions to get the open, high, and low prices for the previous day, which essentially gives us the current day's values. We then plot these values on the chart using the plot
function. You can customize the colors and styles of the plots to your liking.
Asked: 2023-05-05 07:02:03 +0000
Seen: 9 times
Last updated: May 05 '23