Ask Your Question
3

What is the method to obtain the current day's open price, high, and low for a script in pine script?

asked 2023-05-05 07:02:03 +0000

devzero gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-05-05 07:19:02 +0000

bukephalos gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-05-05 07:02:03 +0000

Seen: 9 times

Last updated: May 05 '23