Hello, I am trying to create a Gap% column in my watchlist and produce the following code
#hint: Gap % Above 0
#hint: This study calculates the gap % above 0 for stocks that open higher than the previous close.
#hint: The gap % is calculated as (open - close) / close * 100.
input premarketGapPercent = 0;
def premarketHigh = high(period = "premarket");
def prevClose = close(period = "day");
def gapPercent = (premarketHigh - prevClose) / prevClose * 100;
def gapPercentValue = gapPercent / 100;
AddLabel(yes, "Gap %: " + AsPercent(gapPercentValue), Color.CYAN);
AssignBackgroundColor(if gapPercentValue > premarketGapPercent then Color.GREEN else if gapPercentValue < premarketGapPercent then Color.RED else Color.YELLOW); However this code produces the following error of ot valid. Valid values: 1 min, 2 min, 3 min, 4 min, 5 min, 10 min, 15 min, 20 min, 30 min, 1 hour, 2 hours, 4 hours, Day, 2 Days, 3 Days, 4 Days, Week, Month, Opt Exp. what am i doing wrong?
#hint: Gap % Above 0
#hint: This study calculates the gap % above 0 for stocks that open higher than the previous close.
#hint: The gap % is calculated as (open - close) / close * 100.
input premarketGapPercent = 0;
def premarketHigh = high(period = "premarket");
def prevClose = close(period = "day");
def gapPercent = (premarketHigh - prevClose) / prevClose * 100;
def gapPercentValue = gapPercent / 100;
AddLabel(yes, "Gap %: " + AsPercent(gapPercentValue), Color.CYAN);
AssignBackgroundColor(if gapPercentValue > premarketGapPercent then Color.GREEN else if gapPercentValue < premarketGapPercent then Color.RED else Color.YELLOW); However this code produces the following error of ot valid. Valid values: 1 min, 2 min, 3 min, 4 min, 5 min, 10 min, 15 min, 20 min, 30 min, 1 hour, 2 hours, 4 hours, Day, 2 Days, 3 Days, 4 Days, Week, Month, Opt Exp. what am i doing wrong?