New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.

Gap up + Above Gap for 3 days

Hi All,

I'm trying to create a scan that will scan for gap up, and something where the price stays above the low of the initial gap up and stays above there for 3 days. Any suggestions on the syntax? Also I'd like it to be SPX and Nasdaq 100 companies.

thanks!!

Jon

Comments

  • lmkwinlmkwin ✭✭
    In the Pre-Defined Scans this is the code for the Gap Up part

    AND [Daily Low > Yesterday's Daily High * 1.026]

    You would need to modify this to 3 days ago Daily Low and 4 days ago Daily High....
    to get the gap up indication in the scan.

    Then you'd need to check for the subsequent Daily low for the today, 1 and 2 days ago was greater than the 4 days ago Daily High.

  • I'm trying to understand how the 1.026 helps identify a gap? Also - I'm editing the pre made scan and not sure how to change "yesterday's daily high/low " - is there a syntax list of acceptable terms?
  • lmkwinlmkwin ✭✭
    edited January 9
    Today's Low is Greater than Yesterday's daily high wouldn't necessarily be a gap. So by requiring Today's low to be a bit higher than Yesterdays High, a gap is created.

    In this case the "default" on the Pre-defined Scan is there be a gap of 2.6% requirement. The "default" is there for an example. You can modify the characteristics of the Gap to be whatever you decide.

    As to prior days....

    think of it this way
    Today's Low = Daily Low
    Yesterday's is 1 day ago so
    1 day ago Daily Low
    2 days ago Daily Low
    3 days ago Daily Low

    The days ago with Daily indicators. Change Weekly Low for weekly and 1 weeks ago, etc for changing to weekly indicators. Monthly and months ago for monthly data.

    To achieve your scan you will need to add lines to the Default. You will need to select the Indexes you are looking at first. Index dropdown and select the ones you want.

    Then do the gap identification code

    Then do the lookback over prior days to ensure the last few days, the low of the day finished above the gap level identified in your gap identification level.

    Index1
    or
    Index2

    and

    Gap occurred a few days ago

    and
    Today low is above that gap level
    and
    1 day ago low is above that gap level
    and
    2 days ago low is above that gap level
    etc......
  • I'm guessing the 1.026 is there to prevent too many hits. Strictly speaking, today's low > 1 day ago high IS a gap. But, apparently the technicians at SC believe there ought to be a certain distance between them to make a meaningful gap. You can back test yourself to see if there is anything to that.

    As for the stay above the gap low (meaning the top of the gap) condition, I think you would want to say the min 3 low (the lowest of today's low , the 1 day ago low and the 2 days ago low ) is greater than the 3 days ago low.

    So,

    and [min(3, low) > 3 days ago low]

    Note that 3 days ago is actually the FOURTH bar back from the current bar on the chart.
  • Thanks! So here is what I have. Please let me know if you think this will work. Also - if I want to also scan the Nasdaq 100 , I can't seem to figure out the right syntax for that. Would it be or [group is NASDAQ100]?

    [type = stock]
    and [today's low > yesterday's high]
    and [group is SP500]
    and [min(3, low) > 3 days ago low]
  • In theory if I ran the gap scan from the scan editor window and changed the "starting trading days" box to 3, would I have the same result?
  • No.

    When you choose a past date, the scan engine uses the closing data from that date as "today" 's closing data.

    So if you choose Dec 20 as the scan date, Dec 20 is "today", Dec 19 is 1 day ago, Dec 18 is 2 days ago. So 'min(3, low)' would choose the lowest of those 3 lows. And '3 days ago low' would be the Dec 17 low.
  • Your scan still needs the gap part that lmkwin talked about - with 4 days ago high and 3 days ago low.

    [group is NASDAQ100] is correct. You can select various universes (groups and indexes) from the drop downs - Indexes and ETFs, Sectors & Industries and Chartlists.

    Incidentally, you can also specify market caps that have a SCTR ranking. Use one of the SCTR choices under Price, Volume & SCTRs. For instance:

    and [SCTR.small >= 0]

    would limit your results to small cap stocks that have a sctr ranking.
  • Thanks! A follow up question - I was playing with the syntax and I've been using this for my new high syntax
    [type = stock] AND [Daily Low > Yesterday's Daily High]
    and [group is SP500]
    and [today's high > yesterday's daily max(253,high)]

    Is there a benefit from using "today's low" vs "daily low"? It looks like both are correct in terms of the syntax?
  • no difference as far as I know. probably an artifact of upgrades to the scan engine syntax. One of them was first, then, in order not to break any existing scans, they kept the original form when they adopted the upgrade version. just guessing.
  • Okay so a little troubleshooting help on this scan - I ran this after the close and it returned some results it shouldn't have. For example, AAPL may have opened up today but it does not have a gap because it went lower intraday (yet its coming up in this scan). I'm trying to get new high, plus today's low > yesterdays high, plus SP500 group or Nasdaq 100 group. Any ideas?

    [type = stock] AND [Daily Low > Yesterday's Daily High] and [group is SP500] or [group is NASDAQ100] and [today's high > yesterday's daily max(253,high)]
  • It works if I create a separate scan for sp500 and a separate one for nasdaq 100. For some reason it doesn't like the "OR" with the two groups
  • You need a set of brackets around the "or" conditions. Otherwise, only one condition in the whole scan has to be true to return a result. That probably explains the AAPL result.

    So, try this:

    [type = stock]

    and [ [group is SP500] or [group is NASDAQ100] ]

    AND [Daily Low > Yesterday's Daily High] and [today's high > yesterday's daily max(253,high)]

    You may not need the "type = stock", since the indexes only have stocks.
  • When building your scans, think of it as a filtering process. Starting at the top of the scan with the biggest number of results and then filtering it down with each of your scanning criteria.

    So the biggest number of results will be what your pool to look in is.
    Example: I want the SP500 and the Nasdaq100 stocks. So it starts the scan with 600 stocks.

    Then you may want to filter out all of the securities in that pool that are trading above their 100 SMA. It filters those 600 down to 400

    And then filter out those that remain that have an overbought RSI. It filters those 400 down to 200.

    Then filter out .... filters those 200 down to....

    If you create your scan out of order, sometimes it works correctly, sometimes it doesn't. If you create it in order, it always work correctly.
  • Thanks Guys - Mark on your scan suggestion it returned an error "There are mismatched square brackets. Make sure that the number of left and right square brackets are equal." I tried it a couple ways but got the same error. Any suggestions? TIA you guys are a huge help!
  • If you copied and pasted his code text (which passes syntax check) to your scan, you may have created an issue with where you copied it into the scan. Best to post your scan code here for confirmation / correction.
  • Thank you! I must have done something wrong because it's working perfectly now. Thanks again for your help!!
Sign In or Register to comment.