StockWiz 5 Documentation
What follows is the "executive summary" of StockWiz 5.
StockWiz 5 is a desktop application. It runs on all 32-bit and 64-bit versions of Windows (such as Windows 98, WIndows NT, Windows XP and Vista).
StockWiz 5 stores historical end-of-day prices in a database on the user's PC and then allows the user to extract information from that database. That extracted information can be in many forms. Here are some of those forms:
- Generate a report (such as "all companies that have a strong up trend")
- Define and back-test a trading system (such as 'had I bought and sold when a long term moving average had crossed over a short term average, how much money would I have made or lost?")
- Get a chart for a particular company with a number of technical analysis studies on the chart
- Find all companies within a particular Zip code or trading range
StockWiz achieves all of the above by storing a lot of data for most actively traded US stocks and then using a formula language to define the needed calculations.
The StockWiz 5 formula language is easy, modern and powerful. In a sense, the StockWiz 5 formula language is like a spreadsheet formula language but instead of calculating results for a cell at a time, it calculates results for a column at a time. Perhaps this can be best illustrated with an example. In this example, we load some data, make a calculation and display the data on a chart.
RANGE(-70,_LASTDATE)
CLOSE = LOAD(_TICKER,CLOSE)
ICLOSE = INTERPOLATE(CLOSE)
VOLUME = LOAD(_TICKER,VOLUME)
MA20 = MOVAVG(ICLOSE,20)
RANGE(-50,_LASTDATE)
GRAPHTITLE(_TICKER)
GRAPHAREA(75,25,0,0,0,0)
GRAPHLINE(Axis1,CLOSE,RED)
GRAPHLINE(Axis1,MA20,BLUE)
GRAPHBAR(Axis2,VOLUME,GREEN)
The first line sets the size of the each column in a temporary spreadsheet (mathematicians call this spreadsheet a "matrix"). In this case, the size (or height of the matrix) is 70, starting from the last trading day and going back 70 days.
Then we load data into the first column. That data are the CLOSE prices for the current company in the database.
Because that company may contain missing values, we use the INTERPOLATE function to create a new column where the missing values have been replaced using the "nearest neighbor" technique.
Then we load the VOLUME values for the last 70 days into the third column of our spreadsheet.
Then we calculate a new column which holds the 20 day moving average of the interpolated prices of CLOSE.
Then we call the RANGE function again with a smaller range. We do this in order to have values for all fifty values in the moving average (otherwise the first 19 values will not have enough data for the calculation).
Then we tell StockWiz that we want a chart with two "stacked up" areas. The first area will use 75% of the graph's "real-estate" whereas the second part will use the 255 of the graph's area.
Then we add the CLOSE column and the moving average prices as a lines to the top part of the graph, and we add the VOLUME as a bar to the bottom part.
Here is the result:
Although the "spreadsheet" is kept in memory and you cannot manipulate it the way you can manipulate Excel, for example, you can inspect the values in it, by clicking on 'Formulas' and then on 'Formula Data'. While the cursor is hovering over the 'Formula Data' area, you can click the right button on your mouse and select to export the data to an Excel spreadsheet or to a comma-separated-value (CSV) file, which most spreadsheet programs can read. Here is an example of what the "spreadsheet" looks like for the data that were used for the graph above.
StockWiz 5 Formula Functions
Here is the complete list of all StockWiz 5 formula functions. Click on the name of the function to get a detailed description. Please note that most, if not all, of the information for each function can also be found where you will need it most - in the formula editor window of the StockWiz 5 program. Just run StockWiz 5, click on the 'Formulas' tab and then on the 'Edit' button. The window that pops up allows you to edit the current formula. There you will see a 'Help' button. Again, click on the 'Help' button and then browse the description for each function.
What follows is a short description for each function. Click on the name of each function to get a detailed description.
FUNCTION NAME | FUNCTION DESCRIPTION |
LOAD | Loads data from the price table to a vector in the matrix |
INTERPOLATE | Replaces missing values in a vector with reasonable substitutes |
ADJUSTFORSPLITS | Adjust a vector for any splits |
MOVAVG | Calculate a simple moving average |
LINREG | Calculate a linear regression |
SLOPE | Calculate a linear regression but return the slope of it |
DELTA | Calculate how similar (or different) two vectors are |
OUTLIERS | Remove outliers from a vector |
EMA | Calculate the exponential moving average |
UBOLLINGER | Calculate the upper line of a Bollinger band |
LBOLLINGER | Calculate the lower line of a Bollinger band |
VSUB | Subtracts one vector from another (used to caculate MACD indicator) |
VADD | Adds one vector to another |
MIN | Find the smallest value in a vector |
MAX | Find the largest value in a vector |
INIT | Set a Rank field in the summary table to NULL |
UPDAYS | Find the number of up days in a vector |
DOWNDAYS | Find the number of down days in a vector |
CALC | Calculate an expression |
LOOPCALC | Calculate an expression for all rows in the matrix |
VARIABLE | return one of the built-in variables in the formula engine |
RANGE | Define the range of the matrix - and therefore - each vector. You can invoke RANGE multiple times as way to change the size of the matrix. |
GRAPHAREA | Define how many areas a graph is to have |
GRAPHLINE | Add a line to a graph |
GRAPHOHLC | Add a OHLC graph |
GRAPHCANDLESTICK | Display a candlestick graph |
GRAPHBAR | Display a bar graph |
GRAPHLABEL | Add a label to the graph |
GRAPHTITLE | Add a title to a graph |
GRAPHSUBTITLE | Add a subtitle to a graph |
GRAPHTRADES | Display a mark on the chart wherever backtesting bought or sold |
BACKTEST | Define and back your own trading system |
STOPIF | Stop the current formula if the named vector does not have enough values |
STOPIF2 | Stop the current formula if the named expression evaluates to true. |
ADDCOLUMN | Create a new column with all null values |
RUNCODE | Run C++ code from within the formula |