After Hours Only High Price Watchlist


Hello Pete!

First thank you very much for the help that you give!

I wonder if you could please guide me,or if it is not much problem for you write code.

I looking for watchlist column that will display highest price for period from Market Close to Pre Market Open.(16:00 to 20:00)

Thank you very much in advance!

Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on June 27, 2021 2:14 am
Private answer

I'm going to save some time providing this solution by borrowing the first five lines of code from this previous solution:

A couple of very important notes before you try to apply this solution:

  1. You must check the box to included extended hours data in the custom watchlist column
  2. The start time and end time must remain within the same calendar day

input startTime = 1600;
input endTime = 2000;
def startCounter = SecondsFromTime(startTime);
def endCounter = SecondsTillTime(endTime);
def targetPeriod = if startCounter >= 0 and endCounter >= 0 then 1 else 0;
rec trackHighest = if targetPeriod and !targetPeriod[1] then high else if targetPeriod and high > trackHighest[1] then high else trackHighest[1];
rec holdHighest = if targetPeriod[1] and !targetPeriod then trackHighest[1] else holdHighest[1];
plot data = holdHighest;

The value will update only after the end of the after hours session and will remain unchanged through the end of the next day's trading session.

Marked as spam
Posted by (Questions: 39, Answers: 3751)
Answered on June 27, 2021 3:42 pm