I have an indicator that show where the day's open is compared to the previous day's range. So, if the day's open is at the previous day's high (PDH) then it would be 100% if the open is the previous days low it is 0%. The code below works as I would like after the market opens. But I would like to see were the price is trading relative to the previous day's range in the premarket and but then once the market opens hold the value at the pd_percent_open = ((openprice-prev_low)/(prev_high-prev_low)). How is that done?
input showLabel = yes;
plot DailyHigh = high(period=”DAY”)[1];
plot DailyLow = low(period="Day")[1];
# Label for r/g
def price = high;
def prev_high = high(period=”DAY”)[1];
def prev_low = low(period="DAY")[1];
def openprice = open(period = ”day”)[0];
def pd_percent_open = ((openprice-prev_low)/(prev_high-prev_low));
def bullish = pd_percent_open >= .90;
def bearish = pd_percent_open <= .10;
def neutral = pd_percent_open < .90 and pd_percent_open >.10;
AddLabel(showLabel, aspercent(pd_percent_open), if bullish then Color.GREEN else if bearish then Color.RED else Color.white);
input showLabel = yes;
plot DailyHigh = high(period=”DAY”)[1];
plot DailyLow = low(period="Day")[1];
# Label for r/g
def price = high;
def prev_high = high(period=”DAY”)[1];
def prev_low = low(period="DAY")[1];
def openprice = open(period = ”day”)[0];
def pd_percent_open = ((openprice-prev_low)/(prev_high-prev_low));
def bullish = pd_percent_open >= .90;
def bearish = pd_percent_open <= .10;
def neutral = pd_percent_open < .90 and pd_percent_open >.10;
AddLabel(showLabel, aspercent(pd_percent_open), if bullish then Color.GREEN else if bearish then Color.RED else Color.white);