It would basically be:
Code:
def X = if !SecondsFromTime(0830) then Close else X[1];
plot Y = X;
Y.SetPaintingStrategy(PaintingStrategy.Horizontal);
Thank you so much for your help. I need your expertise. could you please take a look at the following issue that I have with a watchlist.
I have a watchlist that changes color based on the pivot point. However, it only works during market hours and does not work pre- or after market hours. I was wondering if it could be improved to work both during the regular hours and pre and after market hours. Sometimes it does not change color on certian stocks. I highly appericte it if you could help with fixing it. Below is the code:
# Pivot Points Watchlist Column
input aggregationPeriod = AggregationPeriod.DAY;
def HIGHprev = high(period = aggregationPeriod)[1];
def LOWprev = low(period = aggregationPeriod)[1];
def CLOSEprev = close(period = aggregationPeriod)[1];
def PP = (HIGHprev + LOWprev + CLOSEprev) / 3;
def R1 = PP * 2 - LOWprev;
def S1 = PP * 2 - HIGHprev;
def R2 = PP + (HIGHprev - LOWprev);
def S2 = PP - (HIGHprev - LOWprev);
def R3 = PP * 2 + (HIGHprev - 2 * LOWprev);
def S3 = PP * 2 - (2 * HIGHprev - LOWprev);
# Set background color based on conditions
AssignBackgroundColor(
if close >= PP then Color.CYAN
else if close >= S1 then Color.WHITE
else if close >= S2 then Color.DARK_ORANGE
else if close >= S3 then Color.GRAY
else if close >= R1 then Color.Red
else if close >= R2 Then Color.Yellow
else if close >= R3 then color.Green
else Color.current
);
addlabel(yes, " ", color.current);