Free intra-day stock sniffer (scanner)
Aug 5, 2009:
Finally I have managed to spend some more time on my favorite project and completed an updated version of a stock sniffer/scanner to monitor intra-day prices.
The scanner should come in handy for anyone who wants to monitor a large number (say 1000) stocks every 20 minutes during the market hours. This is ideal software to run on home computer. You will get an email in office only if a stock falls in your range allowing you to do day trading.
The concept is as follows: You define your own criterion for a price range. Run the software every night to calculate price range. Then run software during market hours. You will get a notification when the stock price falls in the range that you calculated the previous night.
So download the project from http://www.systomatics.net/ (If you get bandwidth exceeded error then please wait for a day and then try downloading again) and come back here to read rest of the story.
Unzip the downloaded file. One of the files is StockSniffer.exe. Double-click on this file and chose run.
Step 1: Go to tools – options – files. Click on select ticker list. This opens a window to select a file that contains the list of stock symbols that you wish to monitor. In the file that you have downloaded, there is a file called Ticker.txt. This contains a list of stocks that I monitor every 20 minutes or so. You can choose this file for the time being to get a feel of the software. Do click on the help button to read further information.
Step 2: On the same page, click on “Calculation director”. You can specify any directory here. For the time being, use the directory where you have unzipped all the files. Click on the help button for further information
Step 3: Now click on tools – options – email. The help button will give you all the information that you need here. When a stock hits the price range that you have defined, the software uses this information to send you an email.
Step 4: Click on Tools – Upload historical data. I usually go to http://www.eoddata.com/ to download the stock prices. Download data in Metadata Ascii (7 column format). Once you have downloaded the files, you can use this page to upload them into this software. (For files from eoddata, make sure to change the sequence to TDOHLCV and check the ‘first row contains headers’ check-box.
For your convenience the zipped file contains sample data for a lot of stocks. On the same page, you have option to view historical data (i.e. data you have uploaded previously). Select TRN and click on the button to see the data.
Step 5: Now comes the fun part. J You will need to define the code that will calculate ‘From price’ and ‘To price’. You can use the following scripts.
From price:
|
float fromPrice = 0;
var list = #A#.Take(2)
select #B#
foreach ( #C# in list)
{
fromPrice += ((history.opening + history.close + history.high + history.low)/4)/2;
}
return fromPrice * 1.20;
|
To price:
|
float toPrice = 0;
var list = #A#.Take(2)
select #B#
foreach ( #C# in list)
{
toPrice += ((history.opening + history.close + history.high + history.low)/4)/2;
}
return toPrice * 1.30;
|
Please ignore #A#, #B# and #C#. I am replacing these variables to generate linq scripts. All you need to know is that the historical data is in descending order on date.
The above scripts calculate range for every stock which is which is 10% below and 10% above the average of pivot point for the last 2 days. So any stock that matches this price and boom! You get a notification.
If you need some help in creating your own script, please drop me a line.
For the time being paste these scripts and click on validate. You will be taken to a new window that displays the script generated. Click on filter again and press calculate. The middle text box shows the stock being processed. You know that the processing is over once the text stops moving, I promise to put some decent message later.
In case you are curious, go to the calculation directory you specified in step 2. You will see a file there called stockFilter.txt. This file contains the range that you calculated above.
Step 6: You will typically be running this step during market hours. Click on sniff. Decide how many times you want to run the scan. (For trial do not use this value) Whether you wish to send an email etc etc. and Click on start. If there is a match then you will a notification in the window. If you do not get a match then try modifying the above script for e.g. try this as the last line in the script that sets the value of fromPrice.
return fromPrice*1.10; (always remember the ; at the end).
Note that as of now the script uses a free webservice with a 20 minute delayed quote. So the prices are not exactly real time but I doubt if 10-15 minutes are going to make any real difference. If you have paid subscription to any webservice then please let me know and I will add the webservice to this scanner.
Coming attractions: The code has become quite ugly, I am planning to re-factor everything classes, variable names, modules etc etc. Next I am also planning to add support for technical parameters for e.g. Bollinger band width etc. I think I should also automatically download historical data.
You can see that I am planning to add a lot of functionality so keep on checking this site to see if there is any update. I will also be publishing the update announcement on twitter (www.twitter.com/harshudeshpande) or yahoogroup TheBullTeam@yahoogroups.com
