chrisj1881
New member
Hello is there a way to get the scanner to look for a full gap including yesterday's candle wicks instead of using a percentage gap?
Pre-Market Gap from Previous Close for ThinkorSwim
Pre-Market Gap from Previous Close for ThinkorSwim
Ruby:
# Scan PreMarket: Scan for 1 Percent gap from Previous Close
# Scan at 5 min aggregation or less
# Mobius
# Chat Room Request
def PrevClose = if SecondsTillTime(1555) == 0 and
SecondsFromTime(1555) == 0
then close
else PrevClose[1];
def ScanActive = if SecondsTillTime(0930) >= 0 and
SecondsFromTime(0730) > 0
then 1
else 0;
def ll = if ScanActive and !ScanActive[1]
then low
else if !ScanActive
then double.nan
else if ScanActive and low < ll[1]
then low
else ll[1];
def hh = if ScanActive and !ScanActive[1]
then high
else if !ScanActive
then double.nan
else if ScanActive and high > hh[1]
then high
else hh[1];
# Comment out (#) Plot NOT wanted
plot gapUP = if ScanActive and ll > PrevClose * 1.01
then 1
else 0;
#plot gapDN = if ScanActive and hh < PrevClose * .99
# then 1
# else 0;
Last edited by a moderator: