| The syntax of the scan we need is relatively simple.
Let's assume in our specific example that we want to find all symbols
that have gapped up at least 5%:
(LAST - CL) / CL >= 0.05
The token "LAST" will give us the current price of the symbols and
the same price that is seen in the quotepage columns "Last". It is
important that the symbol is being monitored so that this "LAST" price
is up-to-date and accurate (more on this below). CL is an
historical token, and will give us the closing price of the last daily
bar in the database. Since today's session hasn't yet started,
there is no daily bar yet for today (there will one as soon as the first
tick comes in after the session opens). Therefore, CL in a daily
scan during the pre-market will give the close of yesterdays' daily bar.
It is important that daily data of the symbols scanned is also
up-to-date and accurate (at least for the previous day). You may
need to run a daily download on the quotepage for the last day (or 2 or
3) just to ensure this.
If the number of symbols which you are trying to scan for gaps is
less than your symbols limit, then your task is relatively simple and
the explanation above is all you need. However, let's say your
symbols limit is 200 symbols, and you would like to monitor 2000 symbols
for gaps. Now your task becomes a little more complicated.
Downloading daily data of the 2000 symbols should not be a problem.
The tricky part is getting current prices during the pre-market on those
2,000 symbols when you are limited to "watching" only 200 at a time.
What we'll need to do in this case is open up a quotepage of maybe
100 symbols at a time, keep that quotepage open just long enough for all
those symbols to get updated with current prices, then close the
quotepage and move on to the next 100. Let's say our ".All
Symbols" quotepage contains the 2,000 symbols. The following scans
will be run on the ".All Symbols" quotepage. We're going to use a
User Variable (in this
example V#1) to help manage which symbols we open each time.
First, we'll run a scan with this syntax:
SET(V#1, 0)
...to initialize the V#1 value for all the symbols to 0. Now,
we'll run this scan:
SEQ > V#1 AND SEQ <= (V#1 + 100)
AND SET(V#1, V#1 + 100)
This scan is doing a few things. First, the SEQ token gives us
the sequence number of each symbol in the .All Symbols quotepage (the
SEQ token is equivalent to the quotepage column "#").
If you open the .All Symbols quotepage, the symbol you see at the very
top has a SEQ value of 1, then next one has a SEQ value of 2, etc.
If there are 2000 symbols in the quotepage, then the symbol at the very
bottom has a value of 2000. The expression:
SEQ > V#1 AND SEQ <= (V#1 + 100)
...will give us the 100 symbols with sequence number 0 to 100 (when
V#1 is 0). Therefore, our resulting quotepage will be the first
100 symbols in our .All Symbols quotepage. The following
expression:
SET(V#1, V#1 + 100)
Will increment V#1 by 100 (changing it from 0 to 100), setting us up
for the next running of the scan to give us symbols 101 to 200. It
isn't really necessary to know or understand all these details, the key
is, you're have a quotepage of 100 symbols, and you'll need to keep it
open for maybe 5-10 seconds so that the datafeed has time to update all
the symbols with the current prices. After prices are updated,
just run the scan
again. You'll get a fresh quotepage of 100 new symbols.
Allow a few seconds for prices to update, then repeat. Continue to repeat this process until no symbols
result from the scan (telling us we've gone through all the symbols).
If you wanted to get really clever, you could change the syntax of
the scan to the following:
SEQ > V#1 AND SEQ <= (V#1 + 100)
AND SET(V#1, (V#1 < (NUM - 100)) * (V#1 + 100))
And then schedule this scan to run continuously from maybe 8:00am to
9:30am (the 1.5 hour period prior to market open). The key change
to this scan is in the SET statement. Using this syntax, the value
of V#1 will be "reset" to zero once we get to the end of our list of
symbols. The token NUM provides the total number of symbols in the
quotepage. Again, the only thing you'll have to change about the
scan syntax in order to fit it to your needs, is to replace the "100"
with whatever number or symbols you want to display in each quotepage.
That number will be dictated by your symbol limit, along with how many
symbols you already are monitoring.
Now you're ready to run the "gap" scan mentioned above.
For more information on dealing with symbol limits, visit:
http://www.linnsoft.com/tips/symLimits.htm
You can also find some good information related to using daily scans
in order to filter down your intraday watchlist in this Q&A:
http://www.linnsoft.com/qa/a/34.htm |