Scan for current price greater than or equal to 50% Fib from premarket



Hi, I'm looking to scan for prices that are >= 50% Fib retracement between the premarket high and previous day close (not premarket low). I've modified and simplified the Fib scan from this forum specifically for these needs but it isn't working. Can someone help regarding what's wrong please?

# GlobeX or Overnight High / Low with Fibonacci Values

# Mobius 

# V01.2012 

input coeff_3 = 0.5;

def o = open;

def h = high;

def l = low;

def c = close;

def v = volume;

def bar = BarNumber();

def GlobeX = GetTime() < RegularTradingStart(GetYYYYMMDD());

def ONhigh = if GlobeX and !Globex[1] then h else if Globex and h > ONhigh[1] then h else ONhigh[1];

def ONhighBar = if GlobeX and h == ONhigh then Bar else double.nan;

def ONlow = if GlobeX and !GlobeX[1] then l else if GlobeX and l < ONlow[1] then l else ONlow[1];

def ONlowBar = if GlobeX and l == ONlow then Bar else double.nan;

def OverNightHigh = if BarNumber() == HighestAll(ONhighBar)

                    then ONhigh

                    else OverNightHigh[1];

def OverNightLow = close (period = AggregationPeriod.DAY)[1];

def MaxBar = Max(HighestAll(ONhighBar), HighestAll(ONlowBar));

def coeff3 = if HighestAll(ONhighBar) == MaxBar and OverNightLow > 0 and OverNightHigh > 0  then ((OverNightHigh - OverNightLow) * coeff_3) + OverNightLow    else if HighestAll(ONlowBar) == MaxBar and OverNightLow > 0 and OverNightHigh > 0  then OverNightHigh - ((OverNightHigh - OverNightLow) * coeff_3)  else double.nan;

plot scan = close >= coeff3;


Similar threads