Terry88888
New member
Hi, this is my first post here. I trade QQQ most of the time and the main chart I watch is QQQ's 5min chart, where I plot the premarket high low as key price levels (see chart). In the meantime, I would like to know how SPY, DIA, and IWM trade with respect to their own premarket highs lows and want to use these as confirmation for QQQ. I use the following code to get premarket high low for QQQ (the current ticker):
#========Begin premarket high low (for the current ticker)========
input start = 0930;
input end = 1600;
def p1 = (SecondsFromTime(end) >= 0 and SecondsTillTime(2359) > 0);
def p2 = (SecondsFromTime(0000) >= 0 and SecondsTillTime(start) > 0);
#def pretime = p1 or p2;
def pretime = p2;
def prehi = if !pretime[1] and pretime then high
else if pretime and high > prehi[1] then high
else prehi[1];
def prelo = if !pretime[1] and pretime then low
else if pretime and low < prelo[1] then low
else prelo[1];
AddLabel(yes, "PMH=" + prehi + ", " + "PML=" + prelo, Color.WHITE);
#========End premarket high low (for the current ticker)========
After I modified the above code for a different ticker as follows, it didn't give me any results and there was no error messages . Can someone please help me with this? Thanks very much in advance!!!
#========Begin premarket high low (for a different ticker)========
script PM {
input ticker = "SPY";
input start = 0930;
input end = 1600;
def p1 = (SecondsFromTime(end) >= 0 and SecondsTillTime(2359) > 0);
def p2 = (SecondsFromTime(0000) >= 0 and SecondsTillTime(start) > 0);
#def pretime = p1 or p2;
def pretime = p2;
def prehi = if !pretime[1] and pretime then high(ticker)
else if pretime and high(ticker) > prehi[1] then high(ticker)
else prehi[1];
def prelo = if !pretime[1] and pretime then low(ticker)
else if pretime and low(ticker) < prelo[1] then low(ticker)
else prelo[1];
}
AddLabel(yes, "PMH_SPY" + PM("SPY").prehi + ", " + "PML_SPY" + PM("SPY").prelo, Color.WHITE);
AddLabel(yes, "PMH_DIA" + PM("DIA").prehi + ", " + "PML_DIA" + PM("DIA").prelo, Color.WHITE);
AddLabel(yes, "PMH_IWM" + PM("IWM").prehi + ", " + "PML_IWM" + PM("IWM").prelo, Color.WHITE);
#========End premarket high low (for a different ticker)========
#========Begin premarket high low (for the current ticker)========
input start = 0930;
input end = 1600;
def p1 = (SecondsFromTime(end) >= 0 and SecondsTillTime(2359) > 0);
def p2 = (SecondsFromTime(0000) >= 0 and SecondsTillTime(start) > 0);
#def pretime = p1 or p2;
def pretime = p2;
def prehi = if !pretime[1] and pretime then high
else if pretime and high > prehi[1] then high
else prehi[1];
def prelo = if !pretime[1] and pretime then low
else if pretime and low < prelo[1] then low
else prelo[1];
AddLabel(yes, "PMH=" + prehi + ", " + "PML=" + prelo, Color.WHITE);
#========End premarket high low (for the current ticker)========
After I modified the above code for a different ticker as follows, it didn't give me any results and there was no error messages . Can someone please help me with this? Thanks very much in advance!!!
#========Begin premarket high low (for a different ticker)========
script PM {
input ticker = "SPY";
input start = 0930;
input end = 1600;
def p1 = (SecondsFromTime(end) >= 0 and SecondsTillTime(2359) > 0);
def p2 = (SecondsFromTime(0000) >= 0 and SecondsTillTime(start) > 0);
#def pretime = p1 or p2;
def pretime = p2;
def prehi = if !pretime[1] and pretime then high(ticker)
else if pretime and high(ticker) > prehi[1] then high(ticker)
else prehi[1];
def prelo = if !pretime[1] and pretime then low(ticker)
else if pretime and low(ticker) < prelo[1] then low(ticker)
else prelo[1];
}
AddLabel(yes, "PMH_SPY" + PM("SPY").prehi + ", " + "PML_SPY" + PM("SPY").prelo, Color.WHITE);
AddLabel(yes, "PMH_DIA" + PM("DIA").prehi + ", " + "PML_DIA" + PM("DIA").prelo, Color.WHITE);
AddLabel(yes, "PMH_IWM" + PM("IWM").prehi + ", " + "PML_IWM" + PM("IWM").prelo, Color.WHITE);
#========End premarket high low (for a different ticker)========