A market scanner or screener is a tool that analyzes the market and look for stocks or other securities that meet a screen criteria. To create a screen, you must define a set of rules, an analysis date, a list of symbols and a time frame. In this post, I will show you how to create a screen that contains the following conditions: - Small capitalized stocks - Stock trading at 30 bar high - The stock's ROI (return on investment) is higher than 20% How to download fundamental data To create the above screen, we must have access to ROI and Market capitalization fundamental data. Fortunately, several downloaders in QuantShare sharing server allow you to get data for these fundamental fields. Steps: - Download the following item: Financial fundamental data for US companies - Once it is added to the download manager, select it then click on "Open Selected Downloader" - Click on "Start Downloading" to get the latest financial data for U.S. Stocks The item will create a new database "fund_financial" and retrieve data for the following fundamental items: Market Capitalization, Dividend, ROA, ROE, ROI, Current ratio (curr), Quick Ratio (Quickr), Long term Debt/Equity (LTdebt-eq), Gross margin (GrossM), Operating margin (OperM) and Net profit margin (ProfitM). To display this data: - Select "Data -> Edit Databases" - Select "Custom" database then "fund_financial" as database name - Select a stock symbol in "Symbols" panel Create a basic screen Let us create our first screen. - Select "Analysis" then "Screener" - Click on "Create a new screen" - If you are in wizard mode, click on "Switch to editor" In order to create a screen, we must save our conditions in a variable named "filter". For example, let us take these two rules: - Relative strength index is higher than 70 - Stock is trading above its 30-bar moving average The implementation of the above rules would be: rule1 = rsi(14) > 70; rule2 = close > sma(30); filter = rule1 and rule2; Fundamental Screen After you create a new screen, select the last date in "Date" field. The analysis will be based on this date. Click on "Select Symbols" then select the stocks that you would like to include in the market scanner. Set the time frame to daily. Our fundamental screen contains three rules or conditions. Small-capitalized stocks Market capitalization is the total value of tradable shares of a company. It is calculated by multiplying the share price with the number of shares outstanding. As a rule of thumb, we consider that a stock belongs to the Small-cap category when its market capitalization is between $250 million and $1 billion dollar. To get the market capitalization of a stock, we use the "GetData" function to retrieve data from a custom database. Our fundamental database name is "fund_financial" and the market cap field name is "mktcap". mktcap1 = GetData("fund_financial", "mktcap", LastData); Tip: After you type "GetData(", click on CONTROL+SPACE to get a list of databases, and after you type "GetData('fund_financial'," click on CONTROL+SPACE to get a list of field for our financial database. The "LastData" option in the last parameter instructs the application to get the last market cap data available in case the database does not contain market cap data for the analyzed bar/date. To get small-capitalized stocks: mktcap1 = GetData("fund_financial", "mktcap", LastData); rule1 = mktcap1 >= 250 and mktcap1 <= 1000; Note that market cap is expressed in millions of dollars. Stock trading at 30 bar high "HHV" function allows you to get a time-series highest high over a specified period. rule2 = close == hhv(close, 30); The above rule generates a signal when the close price is equal to the highest close of the last 30 bars. Stock's ROI (return on investment) is higher than 20% As with the market capitalization, the return on investment is obtained using the "GetData" function. roi1 = GetData("fund_financial", "roi", LastData); This condition consists of comparing the ROI to the 20% threshold rule3 = roi1 > 20; Finally, the complete screen formula is as follows: mktcap1 = GetData("fund_financial", "mktcap", LastData); rule1 = mktcap1 >= 250 and mktcap1 <= 1000; rule2 = close == hhv(close, 30); roi1 = GetData("fund_financial", "roi", LastData); rule3 = roi1 > 20; filter = rule1 and rule2 and rule3;
|