OHLC for only the first 5min bar of the day


Category:
0
0

I was looking for a chart study that plots the OHLC lines of the first 5 min candle only.  The lines should extend across the chart.

Marked as spam
Posted by (Questions: 6, Answers: 17)
Asked on October 30, 2021 2:43 pm
270 views
0
Private answer

The simplest solution requires that you turn off extended hours trading session on your charts. The following code plots the values you requested. The time frame can be set to any intraday time-based aggregation period.

def newDay = GetDay() <> GetDay()[1];
rec firstOpen = if newDay then open else firstOpen[1];
rec firstHigh = if newDay then high else firstHigh[1];
rec firstLow = if newDay then low else firstLow[1];
rec firstClose = if newDay then close else firstClose[1];
plot priceOpen = firstOpen;
plot priceHigh = firstHigh;
plot priceLow = firstLow;
plot priceClose = firstClose;

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on October 30, 2021 3:50 pm