raaven1160
New member
I created a pre-market high/low indicator (code below) that plots the highest high from the pre-market session(4am-9:30am) and the lowest low. The idea is once the market opens at 9:30 you will have a pre-market high line and a pre-market low line that will extend across the chart. As of now, it's working well except for the low plot which is not displaying on the chart at all? any ideas why this may be happening? any help here would be greatly appeciated.
input preMarketStartTime = 400;
input preMarketEndTime = 930;
input marketCloseTime = 1600; # Regular market close time
def isPreMarket = SecondsFromTime(preMarketStartTime) >= 0 and SecondsTillTime(preMarketEndTime) >= 0;
def isRegularSession = SecondsTillTime(marketCloseTime) >= 0;
def highestPreMarketHigh = if isPreMarket and (high > highestPreMarketHigh[1] or IsNaN(highestPreMarketHigh[1]))
then high
else highestPreMarketHigh[1];
def lowestPreMarketLow = if isPreMarket and (low < lowestPreMarketLow[1] or IsNaN(lowestPreMarketLow[1]))
then low
else lowestPreMarketLow[1];
plot PreMarketHigh = if isPreMarket or (isRegularSession and isRegularSession[1]) then highestPreMarketHigh else Double.NaN;
plot PreMarketLow = if isPreMarket or (isRegularSession and isRegularSession[1]) then lowestPreMarketLow else Double.NaN;
PreMarketHigh.SetDefaultColor(Color.GREEN);
PreMarketLow.SetDefaultColor(Color.RED);
input preMarketStartTime = 400;
input preMarketEndTime = 930;
input marketCloseTime = 1600; # Regular market close time
def isPreMarket = SecondsFromTime(preMarketStartTime) >= 0 and SecondsTillTime(preMarketEndTime) >= 0;
def isRegularSession = SecondsTillTime(marketCloseTime) >= 0;
def highestPreMarketHigh = if isPreMarket and (high > highestPreMarketHigh[1] or IsNaN(highestPreMarketHigh[1]))
then high
else highestPreMarketHigh[1];
def lowestPreMarketLow = if isPreMarket and (low < lowestPreMarketLow[1] or IsNaN(lowestPreMarketLow[1]))
then low
else lowestPreMarketLow[1];
plot PreMarketHigh = if isPreMarket or (isRegularSession and isRegularSession[1]) then highestPreMarketHigh else Double.NaN;
plot PreMarketLow = if isPreMarket or (isRegularSession and isRegularSession[1]) then lowestPreMarketLow else Double.NaN;
PreMarketHigh.SetDefaultColor(Color.GREEN);
PreMarketLow.SetDefaultColor(Color.RED);