HamScan User's Guide
HamScan is a program that works with the TC2000 /
TCNet data servers and the TC Software Development Kit. It:
- Provides access to all TCNet data, to TCNet WatchLists and Sorts, and to all PCF calculations for any TCNet list.
- Adds complex calculations that TC can not support in PCFs:
Exponential Moving Average, ADX and DMI Directional Movement, Bollinger Bands, OBV (On Balance Volume),
Wilders Average True Range, CCI (Commodity Channel Index), VHF (Vertical Horizontal Filter) and more.
- Performs complex scans for Fibonacci reversal patterns
- Performs Candlestick patterns scans and identifies common reversal and continuation patterns
- Allows export of all data to text, HTML, Excel spreadsheets, TradeStation files or TC Watchlists.
- Backtesting and Strategy Optimization features of HamScan have their own User's Guide
- Fibonacci Charting that calculates pivot points, and shows retracements for up to 8 Fibonacci percentages.
Contents:
- Downloading and registration, and installation of HamScan
- The first time you run HamScan, you need to Log in, providing your email address and TCNet username.
- The HamScan User's Guide is available while running HamScan
- Quickstart - displaying data for a TCNet/TC2000 watchlist
- Sorting displayed data for the current watchlist
- Using TCNet/TC2000 pre-programmed Sorts
- Viewing other pages of data for the selected watchlist
- Exporting displayed data to Excel, text, or HTML files
- Exporting displayed data to TradeStation files
- Backing up your User PCFs
- Adjusting the number of bars of data to use for calculations
- Surviving the TCNet/TC2000 Update cycle
- Ticker commands: Creating sub-lists of tickers, controlling TCNet and Yahoo
- Creating and modifying column formulae with Formula Builder
- Encoding your formula to protect it, but allow other people to use it
- Creating and using Fibonacci Charts
- Custom programming for HamScan
Downloading, registration and installation of HamScan
The set of files that make up HamScan is packaged is a downloadable, self-installing module. To use
HamScan, you first much Register . After registration,
click here to start installing HamScan, select OPEN, then click SETUP and follow the on-screen
directions.
Logging in to HamScan
The first time that you use HamScan after Registering, you must Log In before it will load and display data. This registration information is used only
for communication and information specifically relating to the HamScan program. For example, by registering, you
automatically are placed on a mailing list that is used to announce updates and other information about HamScan.
When you first start HamScan, a Registration window will pop up. Enter your TCNet user name (if you have one), or
your on-line handle. Also, enter your email address. Please enter a valid email address because that is the only
way that I can contact you regarding your copy of HamScan, for bug fixes, updates, etc. Your email address is
NOT shared. You may also Register from the HamScan menu Settings / Register. The registration window looks like this:

Once you have registered, you can check your account registration status (as well as expiration dates and program
versions) from the HamScan menu, Help / About. This window looks like this:

This window displays the following information:
- The main product web page - for updates and other relevent information.
- The email address for technical support. Send email here if you have problems, questions, or suggestions.
- Application Expiration displays the date on which the application expires. Generally, this will be at the
start of each month, since new updates will replace the old versions of the program.
- Account Expiration and Account Type display the date on which your account expires, and the type of account
that you have (Temporary, Trial, Monthly, etc).
- Current Version displays the current version of the HamScan program that is running.
- Latest Version displays the current version of the HamScan program that is publicly available for downloading.
-
The HamScan User's Guide is available while running HamScan
This User's Guide for HamScan is available both on the
HamScan web site as well as locally installed on your machine. To view the local copy, select Help / User Guide
from the HamScan menu.
Quickstart - displaying data for a TCNet/TC2000 watchlist
Start by running HamScan, and then click on the LISTS pulldown. Lists are separated into several
categories. Each category has a header line (all capitalized), followed by the lists in that category.
As you can see, LISTS is a collection of all of the WatchLists that you have defined in TCNet/TC2000.
Select one - a good one for testing is the "Dow Jones 30 Industrial Component Stocks" - scroll all the way
to the bottom, then scroll up to the COMPONENT WATCHLISTS (which start with 8:) to select it. Immediately,
you will see the data from the TCNet/TC2000 databases. Next, click on the PAGES pulldown and select a
different entry to see other data. In addition to the watchlists that you have set up in TCNet, HamScan
scans the TradeStation directory for CSL (Custom Symbol List) files. Any CSL files that are found are added
to the LISTS, so that you can select one to have HamScan display the data for a list of tickers that you
built in TradeStation.
Starting in Version 3.00.01,
you can also select the Watchlist or Stock Group from the menu Data / Choose WatchList. This is a
much easier way to access the full collection of WatchLists, which can number several hundreds. By using
the menu technique, the watchlists are organized by type in sub-menu hierarchies. In addition, the Media
General Industry Groups are sub-categorized for easier use.
Sorting displayed data for the current watchlist
Once you have some data displayed, you can click on the column header buttons at the top of
each column of data to have HamScan sort the data using that column. Click again to reverse
the sort order. HamScan indicates which column is used for sorting by color coding the headers as
Ascending or Descending.
Using TCNet/TC2000 pre-programmed Sorts
Next, click on the SORTS pulldown to see a list of all of the sort orders that you have
defined in TCNet/TC2000. You may select one to change the sort order of the data. Starting in Version 3.00.01,
you can also select the TC Sort from the menu Data / Choose TCSort.
Viewing other pages of data for the selected watchlist
Click on the PAGES pulldown again, and select a different page. Each page has it's own set
of data columns, using the same WatchList that you have selected. You may add a new Page by selecting
Settings / Page Setup / Add Page from the menu. To give the current page a new name, select Data /
Configure Pages / Rename Current Page. If you would like to delete the current page, select
Data / Configure Pages / Remove Current Page. You can also change the name of the current page with
Data / Configure Pages / Rename Current Page. Starting in Version 3.00.01, you can also select
the Page from the menu Data / Choose Page.
The "Criteria" page demonstrates many of the features that HamScan offers:
- The "Volatility" column, refers to the System criterion "Volatility" that comes with TCNet, and displays two digits after the decimal point.
- The "Worden" column displays the Worden Number. This number is used throughout TCNet/TC2000 to
identify tickers. You may need this number to clear a bad cache entry, for example.
- The "BetaRank" column displays where the ticker is ranked (1 to 99) by TCNet, according to it's Beta.
- The "BetaValue" column displays the actual calculated value of Beta
(which you will see on TCNet using Ctrl-V to access the Data Sheet). Notice that this is calculated
by TCNet - it's the average of the BetaLower and BetaUpper values. It's displayed with four digits after
the decimal point
- The "BOP Today" column displays the BOP as calculated by TCNet.
- The "Volume" column displays the last Volume value - in 100's of shares (add two zeroes).
- The "Optionable" column refers to a System PCF that comes with TCNet, and displays as a true/false value
The "True Range" page has High, Low, and Previous Close, the True Range, and two different methods for calculation of the
Average True Range.
- The "TrueRange" column is similar to Range (which is High minus Low, but it accounts for gaps from
yesterday's close. It is calculated as MaximumOf(High, Previous Close) minus MinimumOf (Low, Previous Close)
- The "ATR14" column demonstrates the first method of calculating the Average True Range. It is the
mean average of the True Ranges of the past 14 days: (TR[13] + TR[12] + ... + TR[2] + TR[1] + TR) / 14
- The "ATR14Smooth" column demonstrates the second method of calculating the Average True Range.
It is the original Welles Wilder definition of smoothed ATR, calculated by weighting the previous ATR,
adding the current True Range, and then dividing by the period: (ATR[1] * (Length - 1) + TR) / Length
Note that although the ATR14 method of calculating the Average True Range can be calculated in a
TCNet/TC2000 PCF, the SmoothedATR can not. It is possible to approximate the SmoothedATR value
in a PCF (to with close enough accuracy that it's "correct"), but iterative calculations like this
can not be calculated exactly. HamScan is able to calculate and display these values exactly,
including more complex calculations that would either generate prohibitively long PCFs or would
just not be possible.
The "Dir Movement" page demonstrates the various Welles Wilder Directional Movement indicators,
including DI+ and DI- (which gives indication of direction), the DMI, and ADX (which gives
indication of trend strength - but NOT direction), and the smoothed ADXR average.
The "S+R Pivots" page demonstrates the traditional calculations of Pivot Support and Resistance levels.
NOTE on how TCNet stores Fundamental and System Criteria data, and what information is available:
For System Criteria (including Fundamentals - you'll see them preceded with '*' in the UserPCF/*SystemCriteria
dropdown selector in the Formula Builder), the actual numeric values are not stored. Instead, TCNet/TC2000
ranks all tickers with a value of 1 through 99 (0 indicates that the ticker is not ranked), from lowest to
highest value, and grouping tickers with similar values together in each of the 99 ranking levels. This ranking
level is available in HamScan ("Rank"). HamScan will also calculate a "Value" (which is the same value that TCNet shows on
the Data Sheet) for System Criteria. It does this in the same way that TCNet does, so the value is NOT exact,
but "approximate" (see the TCNet Data Sheet accessed via Ctrl-V to notice that TCNet also lists the values as
approximate). The "Criteria" Page, described above, contains examples of Value, Rank, and Upper data values.
Exporting displayed data to Excel, text, or HTML files
Now that you have some data displayed, you can export it to other program formats. HamScan
currently supports export to text files (using spaces to align the data - so they should be
viewed in a fixed (non-proportional) font), HTML files (exported as an HTML <Table> which
you can easily upload to your web server), and Excel files (XLS spreadsheets). To export the data
for all of the displayed columns, select Data / Export Data from HamScan's menu. When exporting to
Excel, HamScan will create a new spreadsheet file, modify an existing file, or even paste the
data into a spreadsheet that you have open on your screen. HamScan remembers the last directory
that you used for each type of export, and stores each one separately.
You can select one or more pages to export together to a single file. HamScan brings up a selection
window that allows you to choose which page(s) to export. Select a page to export by clicking on it,
and remove it from being selected by clicking on it again. The Page Selection window (with Pages
Criteria and S+R Pivots selected to export) looks like this:
Exporting displayed data to TradeStation files
HamScan has two features that allow you to export to TradeStation files. You can export the list
of tickers currently shown based on a TCNet list or one of your own Easy Scans. In addition, you can
export the values of each of the columns for each symbol. These are exported to an ELX file,
which TradeStation Indicators and Strategies can read. Here are examples of each type of export:
Exporting the list of ticker symbols
- In TCNet or TC2000, select a List or EasyScan that has a relatively small number of members (for
example, "Stocks With Rebounding EPS" EasyScan which has 25 hits as of today).
- Now, in HamScan, select that same List or EasyScan from the LISTS drop-down. EasyScans are in the
EASY SCANS group, all starting with "1:".
- From the HamScan menu, select Data / Export Data / TradeStation CSL. A file selection dialog window
will pop up, automatically pointed to the default TradeStation Custom Symbol Lists directory. If this
is not the correct directory, navigate to the location you prefer. Enter a filename (TCReboundingEPS
for this example) and click Save.
- From TradeStation, open a new RadarScreen (from the menu, select File / New / RadarScreen). Right
click in the Symbol column, Row 1, and select Insert Symbol List. Under "Custom Symbol Lists", find
the file that you just created above (TCReboundingEPS), double click it, then click OK. Your TCNet
watchlist/scan is now displayed on the Radar Screen!
NOTE! There are two issues relating to passing symbol tickers between TCNet and TradeStation. First,
both programs have tickers for stocks that the other program is unaware of. If you create a list in
TCNet that includes unknown tickers, TradeStation will display that row as Invalid Symbol. Second, some
tickers (particularly indices and calculated values like TRIN) differ between TCNet and TradeStation.
For example, the Dow Jones Industrial Average is $INDU on TradeStation, but DJ-30 on TCNet.
Importing a list of ticker symbols into HamScan from TradeStation
- While in TradeStation from the above Export example, delete a few of the tickers. For example, I
deleted the Invalid Symbol, and all Hard-to-Borrow symbols (which have "(HB)" as part of their name).
- Select all remaining rows with ticker symbols on the Radar Screen. Right click, and select "Append
Selected Symbols To Custom Symbol List", then Create List, name it TCReboundingEPSNew and click OK.
- Start HamScan, and in the LISTS dropdown, scroll to the bottom where all TRADE STATION CUSTOM SYMBOL
LISTS are listed, finding the newly created TCReboundingEPSNew, and select it. As you can see, the
changes that you made in TradeStation have been reflected in this new LIST!
Exporting ticker data from HamScan to TradeStation ELX files
TradeStation has an add-on DLL called ELX.DLL. This is not part of the regular release. It is not
automatically installed when you install TradeStation. You need to install the DLL and a series of
support Functions to use the ELX features. ELX is Easy Language eXtensions. Using ELX allows you
to pass data and settings between Indicators, Charts, Strategies, etc. By exporting HamScan data
(including calculated PCF values and System Criteria) via ELX, you can provide this data to TradeStation
so that it can display it or use it for calculation of Strategies or Indicators.
To install TradeStation's ELX extensions, go to TradeStation World
and log in (join if you haven't - it's free, and there is a *huge* amount of information there). Scroll
down to TradeStation 7 Support Discussions, then select EasyLanguage-DLL Questions. Click on the first
"sticky" topic, "ELX", and follow the directions. You may be able to get to the ELX download by a
direct link.
The example below assumes that you have already installed the ELX.DLL file and that you have imported the
ELX Functions.
- In TradeStation, create a new indicator (from the menu, File / New / EasyLanguage / Indicator), name
it TCCapitalization, no template, and click OK. Copy the code below (you can copy and paste from your web
browser), and insert it into the Indicator.
inputs: ForceUpdate (0);
variables: ELXGroup (""), hRecord (0);
variables: TCValue (0);
ELXGroup = GetSymbolName + "_" + "test.txt";
if CurrentBar = 1 then begin
Value1 = UseELX (true);
hRecord = OpenRecord (ELXGroup);
if hRecord > 0 then
Value1 = ReadRecord.f (hRecord, "Capitalization", TCValue);
end;
Plot1 (TCValue, "Capitalizatn", red);
Save and Verify by pressing the F3 key.
Use the Radar Screen from the above example, showing the TCReboundingEPSNew custom symbol list.
Insert this new indicator by right clicking on the header of the last current
column, selecting Insert Analysis Technique, then double clicking on TCCapitalization, then click OK.
- In HamScan, make sure that TCReboundingEPSNew.CSL is the selected LIST. Right click in the empty
space to the right of the last column to create a new column. In the UserPCF/*SystemCriteria drop-down,
select *Capitalization. In the Formula Editor, delete the "C", then click the Value button. Change the
label to "Capitalization" (NOTE! This MUST match the text in the TradeStation ReadRecord.f function call!)
Click Save ALL And Exit to see a new column displayed in HamScan with the Capitalization values.
- In HamScan, from the menu select Data / Export Data / TradeStation ELX. Type a unique file name, such as
"test.txt" and click Save. (NOTE! This file name MUST match the text in the ELXGroup line in the TradeStation
indicator!)
- Back in TradeStation, refresh the Radar Screen to see the Capitalization values passed from TCNet!
Note - a Ctrl-R reload may not work, so there's an input parameter to the Indicator. To force a refresh,
right click on the TCCapitalization column header on the Radar Screen, select "Format TCCapitalization For
All Symbols", go to the Inputs tab, and change the value of ForceUpdate. The value does not matter,
just make it different - for example, alternate between 1 and 0.
Backing up your User PCFs
Often in TCNet/TC2000, you will create or acquire PCFs and get a collection of many more
than you actually use. These extra PCFs slow down the update process significantly. By
"backing up" your PCFs, you can remove them, and speed up the update process. You can also
preserve them in case of loss of TC data. HamScan will dump all of your User PCFs to a
text file (editable with WordPad). This format is NOT compatible with TC, and can not be
imported. It's only purpose is to save the PCFs, one per line, including the PCF name. The
format of each line is PCFName=Formula. After you have backed up and removed the unused PCFs from your
system, you can bring individual ones back by copy-and-paste from the HamScan dump file.
Adjusting the number of bars of data to use for calculations
Just like TCNet/TC2000, HamScan looks at historical data to calculate function values. The more data needed,
the longer the calculation takes. The Settings / Max Bars Back menu item lets you adjust the number of bars
of data that HamScan will use. You can select Fast, Medium, or Slow settings. Slow settings are necessary
for calculations that use long moving averages, or use BOP. HamScan will automatically test your settings,
and inform you if there are not enough bars of data - and then it will adjust the setting for you. These
menu items are only provided so that you can test your own optimizations, to try and speed up the calculations
Surviving the TCNet/TC2000 Update cycle
If a TC Update cycle is started while HamScan is running, TC will change the data that
HamScan needs to do it's calculations. To handle this issue, HamScan detects a TC Update
cycle, and pops up a message window. This window tells you that TC is updating, and gives
you instructions for reloading the data. In addition, HamScan changes the color of the
Update field (in the upper right of the main window) to Red to indicate that data has changed,
and needs to be reloaded. Note that you may continue to use HamScan while TC is doing the
update, but that the data will not be updated until you specifically tell HamScan to
reload it. To reload the data, wait until the TC update is
completely finished. Then, from the menu of HamScan, click Data / Reload TC Data.
This will cause a restart of the TC data interface, and will reread the data for the current
screen, and all other screens. The formulae will be recalculated. After you have done this
Reload, the Update field on the main screen will be changed from Red back to the default color.
Ticker commands: Creating sub-lists of tickers, controlling TCNet and Yahoo
With the Tickers that are displayed in HamScan, you can right click on any of the displayed
tickers (not hidden), and perform several operations. These operations include hiding and showing
groups of tickers (to narrow your list down), as well and the ability to control TCNet, TC2000,
and Yahoo with the ticker you select.
After selecting a LIST from the Lists drop-down, you may wish to eliminate some of the tickers based on the data
displayed. This will trim your list to make it easier to evaluate the remaining tickers, and will also make the list
smaller if you export it. For example, you might sort on column "BullishTrend" (with your own formula in it), and
identify 25 out of 100 stocks that have this condition as "TRUE". To further examine only the matching tickers,
you can right-click on a ticker symbol to bring up a pop-up menu. You can select a ticker by left-clicking on it.
You can select a group of tickers by left-clicking and dragging - or by using the SHIFT key with a mouse click.
The popup menu includes the following options:
- Hide current and above removes the current ticker and all tickers above it from the display
- Hide current and below removes the current ticker and all tickers below it from the display
- Hide selected removes any highlighted tickers that have been selected from the display
- Unhide all restores all previously hidden tickers that are in the current LIST to the display
- Save tickers for TC watchlist import After you have hidden the ticker symbols that are not part of your current
search criteria, you can save the list of remaining tickers to a file. This file immediately shows up in the
LISTS drop-down for future reference. In addition, the file is compatible with TCNet/TC2000,
and can be imported as a new watchlist. To do this (after saving a list of tickers in HamScan
to a file), from the TC menu, select File / Create New Watchlist / Import from a file / Text File,
and then select the file that you just saved in HamScan.
- Ticker info from Yahoo brings up a Yahoo Finance web page showing information for the
ticker that you just selected in HamScan.
- Select ticker in TCNet/TC2000 causes TC to "Jump" to the ticker you just selected
in HamScan, and displays the chart and other information in TC.
- Show chart brings up a new window that charts the ticker price, identifying Pivot points, and then
evaluating the chart with Fibonacci patterns and retracement values. Details
Using the advanced Formula Builder features
Select the Personal choice from the PAGE pulldown on the main HamScan screen. This displays
an (initially) empty page, containing only the Ticker column. Right click on the Ticker
header and select Add to create a new column with a calculated formula that you specify.
To change a formula, right click on the column header.
To add a new column, right click in the blank space to the right of the last column,
or right click on any column header and select Add.
After choosing Formula Builder, a new window (see above) will pop up to allow you to edit the formula for that
column of data.
- The "Formula Editor" displays your current calculation formula.
- You can use the UserPCF/*SystemCriteria drop-down to select System Criteria or User PCF values
(see Formula Editor features) to have HamScan display or use these values in
calculations.
- The "Label" entry specifies the text for the column header (and also the text if you Save the Formula)
- The "Display as:" entry lets you choose what format to have HamScan display the data. Options:
- 0.00 Displays numeric data as a decimal number with two digits following the decimal point.
- 0.0000 Displays numeric data as a decimal number with four digits following the decimal point.
- 0 Displays numeric data as an integer number.
- true/false Displays the calculation as a Boolean value (True or blank for False).
- LeftText Displays the text value (for company name, etc.) left-justified (all data lined up to the left).
- RightText Displays the text value (for company name, etc.) right-justified (all data lined up to the right).
- P(+)/N(-) Interprets the numeric value as Positive or Negative, displaying P for positive and N for negative.
- Bullish(+)/Bearish(-) Interprets the numeric value as Positive or Negative, displaying Bullish for positive and Bearish for negative.
- Choice This selection is used for System Criteria that return a text value that identifies one of several
"choices." For example, the Exchange System Criterion displays "New York Stock Exchange", "NADSAQ", etc.
Use this display format when selecting one of these choice System Criteria.
- DLLString This selection is used by external DLLs for custom builds of HamScan - and lets the
external functions provide the text to display. This can be used for features like Fibonacci and Candlestick
pattern recognition functions.
- Buy/Short At or Above Signals that the Strategy Optimization code will use this formula as a trade
entry to enter a Long Stop trade or a Short Limit trade
- Buy/Short At or Below Signals that the Strategy Optimization code will use this formula as a trade
entry to enter a Long Limit trade or a Short Stop trade
- Buy/Short At Market Signals that the Strategy Optimization code will use this formula as a trade
entry to enter a Long or Short trade at the Market price
- Date YYYY/MM/DD This selection is used to format the display value as a date - it would be used for
the Date() function as well as any other functions that provide a date (such as PivDate)
the data as a number with 0, 2, or 4 digits after the decimal point, or you may display the data as a true/false
value. Also, you can display a "P" or "N" (or "Bullish" or "Bearish") depending on whether the value is Positive or Negative.
- The "Text Export Width:" entry allows you to specify how many character spaces this particular formula
will use when exported to a TXT text file. This provides some simple formatting capability.
- The "HTML Export Width:" entry allows you to specify how wide this particular formula column
will be when exported to an HTML web file. This value is used in the "width=" specifier in the HTML code.
This provides some simple formatting capability.
- "Sort with column:" lets you specify a second column to be used in addition to the
current column for sorting of tickers. For example, you may want to sort by Price, but
when the Price is the same, you sort within all equal Prices by Volume. This value specifies
the column number (left to right, 0=Ticker, 1, 2, 3, ...) of the secondary sort. A value
of zero means that only the primary (current column) sort is used.
- "Sort algorithm index:" specifies which of the internally coded sorting algorithms will
be used. This was designed for custom versions of HamScan. However, the subscription HamScan
version includes one Custom Sort - where the tickers are sorted by the primary sort column,
but when the primary values are equal, they are sorted within that group by the secondary
sort column (specified with "Sort with column"). This custom sort has an index of "1".
- To remove a column from the HamScan display, click the Remove Column button.
- The Formula Builder window also allows you to save Formulae. All controls for this are in the "Saved Formulae"
group box. These allow you to save copies of each formula that you create for later reloading,
so that you don't have to manually retype it each time. To save a formula, enter a formula in Formula Editor,
and give the formula a name in the Label box, then click the "Save as Label" button.
Formulae that you have saved are listed in the "Saved Formulae" dropdown. You may remove a saved formula
by selecting it in the "Saved Formulae" dropdown, and clicking "Delete Saved Formula".
To copy a formula to the Formula Editor, select the formula from the "Saved Formulae" dropdown, then click "Load to Editor".
If you make changes to the Formulae, be sure to click the "Save ALL and exit" button to save the changes, or click "Cancel ALL" to ignore
the changes.
- Formula Builder also allows you to import TCNet/TC2000 PCF formulae (using the "Formula" button).
HamScan converts the TC format to HamScan format. Since HamScan
calculates each formula whenever you change a stock list, you may want to put most of your formulae in TC,
so that they are only calculated once. Create PCFs in TC, then reference these PCFs in the Formula Builder.
- In FormulaBuilder, if you select a User PCF, then click the Formula button, the
complete TC formula is copied (and converted) - and is fully supported. When HamScan reads in a TCNet
PCF formula, it converts it to HamScan language, with the
idea that the parameters are more flexible. For example, it converts AVGC20.5 (the average of the 20
preceding Close prices, starting 5 bars back) to Avg(C,20,5). Note that the 20 and 5 can be variable or
calculated values, and don't need to be hardcoded. Also, for the Avg, Min, Max, and Sum functions, the
first parameter can be ANY PCF calculation. An easy way to calculate the mean average of True Range for 5
bars, for example, is with Avg(TR(0),5) ... or you could use SUM(TR(0),5)/5. If you want the average of
the last 20 Typical Price values, starting 8 bars ago, you can use Avg((H+L+C)/3,20,8).
Creating your own Formula
A HamScan Formula consists of:
- Variables representing data values (Close price, Volume, etc.)
- PCF specifiers represent calculated PCF values obtained from TCNet
- Arithmetic operators used to combine the data arithmetically (+, -, *, /, etc.)
- Comparison operators used to compare data values (<, >, etc.)
- Boolean operators used to test multiple conditions (AND, OR, XOR, etc.)
- Function calls used to perform complex calculations on data (Avg(), Stoch(), etc.)
- Symbol modifiers allow you to use additional tickers in a formula ('DJ-30', etc.). In general,
the Symbol Modifier can precede any Variable or Function to specify the ticker to use for the calculation
instead of the current ticker. For example, 'DJ-30'C1 provides the Close of the Previous Bar of DJ-30.
- Numeric values used as constants (2, -5, 1.618, etc.)
- Comments You may insert one or more comments into your formula (they are ignored during
calculation) by surrounding the comment in {} curly brackets. HamScan does not support comment nesting.
Variables may be optionally followed by an "offset" which specifies how many bars back (C1 is Close of Previous Bar)
- C specifies Closing Price of bar
- H specifies High Price of bar
- L specifies Low Price of bar
- N specifies the Company Name - note - this should be displayed with LeftText or RightText formatting
- O specifies Open Price of bar
- V specifies Volume (in 100's) of bar
- W specifies Worden Number of current ticker (offset is not used for W)
- HamScan supports user-defined variables. These variables are #A through #Z. They may be used in formulae
to provide a previously calculated value. You may assign the value of any calculated Column on the HamScan
spreadsheet to a variable, and then use that value in calculating another column. To do this, right click on
a column, and select Edit. The HamScan Formula Wizard will come up. In the upper left, find "Refer to the value
of this column with variable", and select one of the variables (A through Z - for example, Q), then Save the changes. In a
different column, you may now use that variable (in this example, #Q), in a formula to get the value already
calculated in the first column. For example, instead of this (extra parentheses for clarity):
(C + ((C2+C3+C5+C8+C13+C21+C34)/7)) / (C - ((C2+C3+C5+C8+C13+C21+C34)/7))
you could create a new column labelled FibAverage, with formula ((C2+C3+C5+C8+C13+C21+C34)/7), and assign the
column to variable #Q. Then the above formula will run faster (only calculating once), and can be written as:
(C + #Q) / (C - #Q)
PCF Specifiers provide access to all PCF and System Criteria values as calculated by TCNet. In the
following PCF Specifiers, the 'xxxx' is a code used internally by TCNet to identify which PCF or Criterion.
HamScan will determine the value of xxxx for you. Select the PCF or System Criterion (preceded by '*')
from the UserPCF/*SystemCriteria drop-down. Then click the Value (or other) button to paste the
corresponding PCF Specifier into the formula editor. HamScan will also include a comment that provides
the name of the PCF or Criterion, so that you can remember which PCF/Criterion you selected.
- Pxxxx provides the Value (Use the Value button) calculated by TCNet for User PCFs and System Criteria.
- Rxxxx provides the Rank (Use the Rank button) of the current ticker, compared to all other tickers.
The Rank value is a number from 1 to 99, or 0 for not-ranked.
Arithmetic operators: HamScan follows standard algebraic order of precedence rules, that is,
Multiplication and Division are calculated before Addition and Subtraction. For example, 2*3+4*5 is
calculated as (2*3)+(4*5).
- ( ) parentheses may be used to explicitly state the order of operation, for example (1 + 2) * 3 is 9.
- + adds two values
- - subtracts the second value from the first
- * multiplies two values
- / divides the first value by the second
- - can also be used as a unary minus sign to negate a value
- ^ provides exponentiation: X^Y is X raised to the power of Y
Comparison operators:
- < returns a true/false value, true if the left value is Less Than the right value
- <= returns a true/false value, true if the left value is Less Than or Equal To the right value
- > returns a true/false value, true if the left value is Greater Than the right value
- >= returns a true/false value, true if the left value is Greater Than or Equal To the right value
- = returns a true/false value, true if the left value is Equal To the right value
- <> returns a true/false value, true if the left value is Not Equal To the right value
Boolean operators:
- AND returns a true value only if the values on both sides of it are true
- OR returns a true value if either of the values on both sides of it are true
- XOR returns a true value only if the value on one side is false and the value on the other side is true
- The Boolean NOT capability is implemented as a function - see below
Function calls: perform complex calculations on values. Parameters for Functions are contained in
parentheses. Parameters may be constants, variables, or other complete formulae. In the following functions:
- 'p' indicates the "period" of the function (generally, the number of bars back of data that the function uses),
default value is 1 except for Bollinger and Standard Deviation functions where default is 20
- 'o' indicates the "offset" which specifies how many bars back to go before starting the calculation, default value is 0
- 'calc' indicates an arbitrary calculation such as (O+H+L+C)/4
Note that you do not need to supply all parameters to functions - only from left to right the ones that are needed.
- Abs(calc) returns Absolute Value
- ADX(p,o) provides Welles Wilder's Directional Movement value of ADX
- ADXR(p,o) provides Welles Wilder's Directional Movement value of ADXR
- Aroon Up - in Formula Builder, click on Formula Components /
Custom, Select Aroon Up, enter a value in the p field to specify
how many bars of data, and click Insert. This function is provided from a custom DLL.
Aroon Up gives a percentage indication of how many bars back the Highest High bar was. For
AroonUp(20), if the bar containing Highest High of the last 21 bars is the most recent
bar, AroonUp is 100 (%). If the bar containing the Highest High is 10 bars back, AroonUp is
50 (%). If the bar containing the Highest High is 21 bars back, AroonUp is 0 (%).
- Aroon Down - in Formula Builder, click on Formula Components /
Custom, Select Aroon Down, enter a value in the p field to specify
how many bars of data, and click Insert. This function is provided from a custom DLL.
Aroon Down gives a percentage indication of how many bars back the Lowest Low bar was. For
AroonDn(20), if the bar containing Lowest Lowof the last 21 bars is the most recent
bar, AroonDn is 100 (%). If the bar containing the Lowest Lowis 10 bars back, AroonDn is
50 (%). If the bar containing the Lowest Low is 21 bars back, AroonDn is 0 (%).
- ATR(p,o) calculates the mean Average True Range
- ATRW(p,o) calculates the Wilder Average True Range
- Avg(calc,p,o,step) calculates mean Average, p is Length. 'step' optionally lets you specify the increment between values, e.g.,
Avg(C,3,0,10) gives the average Close value for the three Closes C, C10, and C20.
- AvgX(calc,p,o) calculates Exponential Average, p is Length
- AvgVA(calc,p,o) calculates Richard Arms' Volume Adjusted Average, p is Length
- AvgVW(calc,p,o) calculates Volume Weighted Average, p is Length
-
- BBbot(calc,p,SDev,o) returns the Bottom Bollinger Band (using Standard Deviation SDev) of the calculated formula
- BBpctB(calc,p,SDev,o) returns the Bollinger %B (using Standard Deviation SDev) of the calculated formula
- BBtop(calc,p,SDev,o) returns the Top Bollinger Band (using Standard Deviation SDev) of the calculated formula
- BBwidth(calc,p,SDev,o) returns the Bollinger Band Width (using Standard Deviation SDev) of the calculated formula
- BOP(p,o) returns the Worden proprietary BOP value
- CCI(p,o) returns the Commodity Channel Index value
- CandleStick Patterns - in Formula Builder, clear the Formula from Formula Editor, then click on Formula Components /
Custom, Select CandleStick, and click Insert. This function is provided from a custom DLL,
and has no parameters. Documentation of candlestick patterns is available from my
candlestick web page.
Also, change the Display As setting to "DLL String". This function normally would
be used by itself in a formula. This function identifies these patterns:
- 3 Black Crows
- 3 Inside Down
- 3 Inside Up
- 3 Outside Down
- 3 Outside Up
- 3 White Soldiers
- Engulfing (Bullish and Bearish)
- Harami (Bullish and Bearish)
- Kicker (Bullish and Bearish)
- Dark Cloud Cover
- Evening Star
- Falling 3 Methods
- Hammer
- Hanging Man
- Inverted Hammer
- Morning Star
- Piercing Line
- Rising 3 Methods
- Shooting Star
- Date(o) returns the Date of the bar 'o' bars back - recommend to display in the DateYYYYMMDD display format
- DIDiff(p,o) provides Welles Wilder's Directional Movement difference of the values of DI+ and DI-
- DIMinus(p,o) provides Welles Wilder's Directional Movement value of DI-
- DIPlus(p,o) provides Welles Wilder's Directional Movement value of DI+
- DMI(p,o) provides Welles Wilder's Directional Movement value of DMI
- Exp(calc) returns e^x
- Fibonacci Patterns - in Formula Builder, clear the Formula from Formula Editor, then click on Formula Components /
Custom, Select Fibonacci, and click Insert. This function is provided from a custom DLL,
and has no parameters. Also, change the Display As setting to "DLL String". This function normally would
be used by itself in a formula. The following patterns (Bullish and Bearish for each) are identified by this function:
- AB=CD
- Bat
- Butterfly
- Crab
- Gartley
- StackZone
Documentation of Fibonacci patterns is available as part of the
documentation for the HamRadar01 RadarScreen tools for TradeStation from
here.
- Frac(calc) returns the fractional part of the number, e.g., Frac (1.93) = .93
- Historical Volatility - in Formula Builder, click on Formula Components /
Custom, Select Historical Volatility, enter a value in the p field to specify
how many bars of data, and click Insert. This function is provided from a custom DLL.
- IF(calc,TrueCalc,FalseCalc) is a conditional test. It evaluates 'calc'. If the value is True (non-zero),
then IF() returns the evaluation of 'TCalc'. If 'calc' evaluates to False (zero), then IF() returns the
evaluation of 'FCalc'. For example, a 5-day OBV value is OBV(5) or, using IF, Sum(IF(C>C1,V,-V),5) - that
is, adding Volume each day the ticker closes up, otherwise subtracting Volume, for the last 5 days.
- Int(calc) returns the integer part of the number, e.g., Int (1.93) = 1
- KeltBot(calc,p,f,o) returns the Keltner Bottom Band indicator value of formula 'calc' for 'p' data points
(length), with a Keltner Factor of f (default 1.5), and optionally starting 'o' bars back.
- KeltTop(calc,p,f,o) returns the Keltner Top Band indicator value of formula 'calc' for 'p' data points
(length), with a Keltner Factor of f (default 1.5), and optionally starting 'o' bars back.
- LReg(calc,p,e,o) calculates the Linear Regression of formula 'calc' for 'p' data points (length),
with the right endpoint 'e' bars back. Then, it projects the LR value 'o' bars back. A value of 0
for 'o' will give you the LR value for the current bar.
- Log(calc) returns Natural Logarithm
- MACDDiff(p1,p2,o) returns the MACD difference of two exponential moving averages, e.g. MACDDiff(12,26),
of the Close price for each ticker. 'p1' is traditionally the "fast" MA period, 'p2' is traditionally the
slow MA. The MACDDiff can also be calculated for 'o' bars back.
- MACDHist(p1,p2,p3,o) returns the MACD Histogram difference of two exponential moving averages, smoothed
by an additional EMA, subtracted from the MACD Difference, e.g. MACDHist(12,26,9), of the Close price for
each ticker. 'p1' is traditionally the "fast" MA period, 'p2' is traditionally the slow MA, 'p3' is the
smoothing MA period. The MACDHist can also be calculated for 'o' bars back.
- MACDSig(p1,p2,p3,o) returns the MACD Signal Line of two exponential moving averages, smoothed
by an additional EMA, e.g. MACDSig(12,26,9), of the Close price for each ticker. 'p1' is traditionally the
"fast" MA period, 'p2' is traditionally the slow MA, 'p3' is the smoothing MA period. The MACDSig can also
be calculated for 'o' bars back.
- MACDVW(p1,p2,o) returns the MACD difference of two Volume Weighted moving averages. The MACDVW can also
be calculated for 'o' bars back.
- Max(calc,p,o) finds the largest value, p is Length
- MaxL(a,b,c,d) gives the highest value of two or more values separated by commas
- Min(calc,p,o) finds the smallest value, p is Length
- MinL(a,b,c,d) gives the lowest value of two or more values separated by commas
- Mod(calc1,calc2) returns the remainder of dividing calc1 by calc2, e.g., Mod (100,7) = 2
- MS(p,o) returns the Worden proprietary MS value - note that these are raw SDK numbers,
and are not scaled, so they should generally be used in comparison with other MS values for the same ticker
- NRB(p,o) is a Boolean function for NarrowRangeBar, returning True if the current (or offset) bar is NRB compared to the p bars before it
- NOT(calc) is a Boolean function that returns True if calc evaluates to zero, or False if calc evalutes to anything other than zero
- OBV(p,o) provides the On Balance Volume for the specified number of bars, optionally starting at offset number of bars back
- PivDate(p,s) provides the Date of the specified Pivot as used in the Fibonacci function. Pivots are
from 0 to 4, right to left, and specified by required variable 'p'. The "strength" (optional parameter s -
values 1 to 10 - default is 5) specifies how many bars are required on each side to identify a Pivot Point.
For example, a Pivot High must have the highest High for s bars left and s bars right. Recommended display
format is "Date YYYY/MM/DD".
- PivotR(x,o) provides Resistance Pivots where x is pivot level (R1, R2, etc)
- PivotS(x,o) provides Support Pivots where x is pivot level (S1, S2, etc)
- QStick(p,o) provides Tusher Chande's OStick calculation value for a period of 'p' bars,
starting 'o' bars back. This function is provided in a custom DLL.
- ROC(calc,p,o) calculates the Rate Of Change ratio of formula 'calc'. This value is a percentage value indicating how much the current value of 'calc' is compared to the 'calc' of 'p' periods ago.
- ROCA(calc,p,o) calculates the Average Rate Of Change ratio of formula 'calc'. This value is the difference of the current value of 'calc' minus the value of 'calc' of 'p' periods ago, averaged (divided by) over 'p' periods.
- RSI(p,y,o) returns Wilder's RSI, y is smoothing period
- SDev(calc,p,o) returns the Standard Deviation of the calculated formula, p is length
- Sign(calc) returns -1 if x<0, 0 if x=0, or 1 if x>0
- Sqr(calc) returns Square Root
- Stoc(p,y,o) returns a Stochastics value, y is smoothing period
- Sum(calc,p,o,step) adds all values together, p is Length. 'step' optionally lets you specify the increment between values, e.g.,
Sum(C,3,0,10) gives the sum of the Close values for the three Closes C, C10, and C20.
- TP(o) calculates the Typical Price of specified bar
- TR(o) returns True Range of specified bar
- TSV(p,o) returns the Worden proprietary TSV value - not functional - no SDK support.
- VHF(p,o) returns the Vertical Horizontal Filter value
- WmAD(p,o) calculates the Williams A/D value. Note that this is an accumulative value,
so the absolute value changes depending on where you start the calculation. Specify the
'p' parameter to supply the number of bars back where the calculation will always
begin. Specify the 'o' parameter to specify which bar to calculate the Williams A/D value
for - 0 is the current bar, 1 is previous bar, etc. This function is provided in a custom
DLL.
- WRB(p,o) is a Boolean function for WideRangeBar, returning True if the current (or offset) bar is WRB compared to the p bars before it
Encoding your Formula
HamScan has the ability to encode your formula. This lets you create your own proprietary formula, and
provide it to other users (you may sell it, give it as part of a membership, etc.). The users can see
the results of your formula - but they can not see the formula itself - and they can not modify
it. To encode your formula, bring it up in Formula Builder. Next, determine whether you want to allow
everyone to use your formula, or just a specific user. If you choose a specific user, you need to have
the user provide you with their TC User Number (they can get this from the TCNet/TC2000 menu, Reports /
Account Information). Enter the user's number in the TC User Number (blank for "ALL") input field.
If you leave this field blank, then all users will be able to use it. If you specify a User Number, then
only that user can use your formula. You can make special versions for each user, if you want to give
your formula to several people, but not allow everyone to use it.
After entering the User Number (or
leaving that field blank to allow any user to use your formula), click the Encode Formula button.
HamScan will encode your formula, and then copy it to the Windows Clipboard. You may now change to your
email program and Paste (Edit/Paste from the menu, or Ctrl-V from the keyboard) to send your encoded
formula to a user. Alternatively, you may wish to save the encoded formula in a Text Document.
When the
other user gets your email (or file), they simply mark and copy the complete encoded text - and then
paste it in to their Formula Editor as the formula. Note that if you specified a User Number, then that
particular version of your formula can only be used on a TC machine which has the same User Number - so
if you sell a formula, users can not share the formula with each other (unless you left the User Number
field blank - which allows any TC user to use (but not view or change) the formula.
Fibonacci Charting
Right clicking on a ticker, then selecting "Show Chart" will bring up a new window that displays the price
information for the ticker, as well as Swing high and low Pivot points, and Fibonacci retracement and extension
values based on the pivots. HamScan shows eight retracement percentages (which you can change). It also
shows four line segments that you can adjust. HamScan will draw Fibonacci support and resistance lines on the
chart for you automatically. If you have any patterns that you would like to save, you can tell HamScan to
save your color settings, Fibonacci retracement settings, and line segment selection - for easy use at a later
time. Once the Charting window is visible, you can use a shortcut to select a different ticker: simply
left-click on the ticker in the watchlist to change charts. Feel free to move the charting window to a location
that makes the viewing easier. The charting window looks like this:
This window provides a lot of information:
- Price data on the chart, one bar per day, showing High to Low prices.
- Pivot points are shown on the Price Data: red bars of price data are Pivot Lows, and green bars are Pivot Highs.
- Pivot points are labelled from right (most recent) to left as A,B,C,D,E. These labels are used in the tables
below to identify the points. Note that point "A" is always the most recent bar Closing price.
- The Pivot points are connected with a set of Fibonacci pattern lines. These lines are red if the most recent
segment (from pivot points B to A) was rising, green for falling. This provides a visual cue as to expected
direction, assuming that the Fibonacci patterns indicate support and resistance levels for reversals.
- The range of prices on the chart is displayed in the right upper (high) and lower (low) corners of the chart.
These prices are the highest high and lowest low on the displayed chart.
- There may be zero or more horizontal colored lines. These lines (as specified below) are the Fibonacci
retracement or extension values - intending to show significant support and resistance levels, or price objectives.
- In the bottom half, on the left, a table lists Pivot Points A through E, with the date of the bar on which
they appeared, and also the price. The price is the High for a Pivot High, and the Low for a Pivot Low. Point
A is always the most recent Close price..
- The Redraw button will recalculate the Fibonacci retracement table, and redraw the chart. In most cases,
this will be automatic.
- When you have finished using the charting window, click the Exit button. Note that you can leave the charting
window visible, and go back to HamScan to select other tickers to be charted.
- In the bottom left is a user-configurable Strength value. HamScan uses a Strength of "5" for its Fibonacci
pattern scanning. The Strength specifies how many bars are needed to define a Pivot point. A value of 5 means
that for a bar to qualify as a Pivot High, the high of that bar must be higher or equal to the high of each of
the five bars to the right and to the left of the bar.
- The table in the lower right of this window calculates the Fibonacci retracement and extension price values.
- The white column on the left specifies the Fibonacci percentages. To change one, enter a new value, then press
ENTER or click the Redraw button. With Templates (see below), you can have different sets of Fibonacci percentages,
so that changing the value of a Fibonacci percentage on one template does not affect other templates.
- The white row across the top specifies the Pivot Points that make up each of the line segments for the Fibonacci pattern
of interest. Each of these is a 2-letter combination of any letters from A through E, specifying the Pivot
Point label. For example, ED specifies the line segment from Pivot Point E to Pivot Point D. These line segment
labels are changed if you would like to calculate (and chart) different Fibonacci retracement prices.
- The grey or colored boxes in the middle of this table are calculated values. For example, in the ED column,
the 61.80 row shows a value of 34.84. This is the price of a 61.8% retracement from Pivot Point E to Pivot
Point D. Black numbers are not charted. To chart one of the numbers, simply click on it with the mouse,
then select the color. The color will be shown in the table, and also shown as a line on the chart. To
remove the line, click CANCEL on the color selection window.
- HamScan has several built-in pattern templates. These templates specify the Fibonacci retracement percentages,
the line segments, and also the colors for lines to be charted. The built-in patterns include AB=CD, Bat,
Butterfly, Crab, Gartley, and StackZone. You can make your own Fibonacci pattern templates by changing any of
the values or colors in the Fibonacci table, then click the Save/Del button to Save your template (give it a
new name). Save/Del is also used if you would like to remove one of the templates. To select different Fibonacci
pattern templates, click on the Template arrow button and click the template of your choice. HamScan will
automatically change templates if you click on a ticker that scans as one of the built-in patterns.
- In the bottom right, the Legend specifies the recommended colors for support and resistance lines. These
are the colors that the built-in Fibonacci patterns use. The "A" Zone identifies the zone or area where the
current price must be, in order to identify a particular pattern. This may be one line (A must be "near"), or
two lines (A must be in between the lines or very near). Objective1 is used to identify where you might
consider taking a partial or full exit from the trade. Objective2 is an additional price level specified for an exit.
Custom programming for HamScan
If you have special needs for calculations of strategies or indicators, and want to display them
in HamScan, please contact me (HamFon) for a price quote. I
will need your specifications and any calculation methods that I don't already have. Customized versions
of HamScan are written for YOU only - the techniques and calculations do not become part of the
public version. Other people may ask for a similar calculation, of course. Also, HamScan can do
additional specialized calculations like comparing two or more tickers or indices, or even accessing
external databases such as calculation of Volatility Bands based on Put and Call data from
www.ivolatility.com.
All discussions of your methods remain private between you and me, even if you decide to not pursue
a customized version.
Thanks for your continued support!
HamFon