Reputation: 11
I want to get close of the first morning candle when i enter close it returns last candle close value. How can I get closing price of the first morning candle in five minute chart? (9.15 to 9.20)
Upvotes: 0
Views: 1195
Reputation: 2821
The next code plots close
of a first bar of a session.
//@version=4
study("Close of first bar of a day")
// If start of the daily session changed, then it's first bar of the new session
isNewDay = time("D") != time("D")[1]
var firstBarCloseValue = close
if isNewDay
firstBarCloseValue := close
plot(firstBarCloseValue)
Upvotes: 1