Referencing High Only During Market Hours


Hey everyone! I am using a chart study on the 1 minute chart (that also shows extended hours trading). I am using the code below to track the highest high but I would like it not to reference the extended hours high.

I’ve tried a couple different solutions but am running into problems. I am sure I’m missing something obvious. Thank you!
*I have also tried to incorporate the “mkth” variable into the equation but it appears that this randomly causes nothing to be plotted. Example:

rec trackHigh = if mkth ==0 then 0 else (if newDay then high else if high > trackHigh[1] then high else trackHigh[1]);


def mkth = GetTime() > RegularTradingStart(GetYYYYMMDD()) and GetTime() < RegularTradingEnd(GetYYYYMMDD());
def newDay = GetDay() <> GetDay()[1];
rec trackHigh = if newDay then high else if high > trackHigh[1] then high else trackHigh[1];

Marked as spam
Posted by (Questions: 5, Answers: 1)
Asked on March 27, 2024 7:22 am
Private answer

A solution for this has already been published in one of our free tutorial videos. And it provides user inputs to adjust the start and end times as well as alerts for price making new session highs and lows.

Be sure to view the entire video or you will not understand how to adjust the parameters to fit your preferences.

Marked as spam
Posted by (Questions: 37, Answers: 4084)
Answered on March 27, 2024 7:24 am