How would I get the previous day's close line to start at 13:00 instead of 22:00? (I'm on the West Coast.) Here's the code I'm currently using:
# PreviousDayClose
declare upper;
# The following time condition doesn't help
# Define time condition for 1pm (13:00)
def currentTime = GetTime();
def is1PMOrLater = currentTime >= 1300; # 1300 represents 1:00 PM in military time
def lastDayToday = if GetLastDay() == GetDay() and GetLastYear() == GetYear() then yes else no;
# Get previous day's close only once
def previousDayCloseValue = if lastDayToday then close(period = "DAY")[1] else Double.NaN;
# Plot only when time is 1pm or later
plot PrevDayClose = if is1PMOrLater and lastDayToday then
previousDayCloseValue
else
Double.NaN;
def CurrentClose = if lastDayToday then close else Double.NaN;
#===============================[ Look & Feel ]================================
PrevDayClose.SetDefaultColor(Color.ORANGE);
PrevDayClose.SetLineWeight(2);
PrevDayClose.SetStyle(Curve.MEDIUM_DASH);
# PreviousDayClose
declare upper;
# The following time condition doesn't help
# Define time condition for 1pm (13:00)
def currentTime = GetTime();
def is1PMOrLater = currentTime >= 1300; # 1300 represents 1:00 PM in military time
def lastDayToday = if GetLastDay() == GetDay() and GetLastYear() == GetYear() then yes else no;
# Get previous day's close only once
def previousDayCloseValue = if lastDayToday then close(period = "DAY")[1] else Double.NaN;
# Plot only when time is 1pm or later
plot PrevDayClose = if is1PMOrLater and lastDayToday then
previousDayCloseValue
else
Double.NaN;
def CurrentClose = if lastDayToday then close else Double.NaN;
#===============================[ Look & Feel ]================================
PrevDayClose.SetDefaultColor(Color.ORANGE);
PrevDayClose.SetLineWeight(2);
PrevDayClose.SetStyle(Curve.MEDIUM_DASH);