home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / busi / tas2091.zip / TAS.TXT < prev    next >
Text File  |  1991-02-26  |  91KB  |  2,087 lines

  1. 1 Introduction
  2.  
  3. "Technical Analysis Scanner(tm)" (TAS) is a software program that gives
  4. you control of your MetaStock (or ChartPro) data base using Technical
  5. Analysis Indicators and conditional relationships to "scan" all, or a
  6. portion, of your data files. TAS also contains an optional Profit Testing
  7. Facility (referred to as TAS/PT).
  8.  
  9. TAS is a generalized Technical Analysis scanning tool. It is not a "black
  10. box" system. You have complete control over the indicators chosen, their
  11. interpretation, and the output format for your reports.
  12.  
  13. With TAS, you can combine many Technical Indicators, compare their values
  14. against other indicators or values, make decisions based on the result of
  15. those comparisons, and ultimately, create a report which shows you what
  16. you want to see.
  17.  
  18. TAS is designed to enable you to go beyond the MetaStock Pro "Custom
  19. Formulas" by applying similar analysis to all or any part of the data in
  20. your Metastock (or ChartPro) Data Base. If you have a profit formula you
  21. believe is appropriate, but you do not have the time to chart all of your
  22. stocks everyday, then TAS is the tool you need. It runs your customized
  23. formula on selected groups of your stocks, and can be used to notify if
  24. your buy or sell trigger is "crossed".
  25.  
  26. TAS can also be used to create custom reports on your stocks. For example,
  27. you can use it to notify you when a particular stock has reached a certain
  28. price, volume or Technical Indicator value.
  29.  
  30. When the optional Profit Tester feature (TAS/PT) is enabled, you can
  31. confirm the profitability of your system using TAS/PT.
  32.  
  33. 2 Taking Care of Business
  34.  
  35.    2.1 Registration
  36.  
  37.    TAS is distributed as a TRIAL version. The TRIAL version of TAS has the
  38.    following restrictions:
  39.  
  40.         1)      Only 20 TICKER symbols will be accessed from a "TICKER
  41.                 LIST"
  42.  
  43.         2)      TAS cannot be run from a batch file as a DOS command
  44.  
  45.         3)      You cannot redirect the output from the TAS reports into a
  46.                 file or to the printer.
  47.  
  48.         4)      Only one TICKER will be allowed to be used with the Profit
  49.                 Test feature (TAS/PT).
  50.  
  51.         5)      The functions listed below may not be available in the
  52.                 TRIAL version.
  53.  
  54.                   Directional Movement - PDI, MDI, DX, ADX, ADXR
  55.  
  56.                   Linear Regression - LINREG, CORRCOEF, ANGLE, SLOPE
  57.  
  58.                   Intersection    - OVER, ISECT
  59.  
  60.                   Profit Tester   - BUY, SELL, STOP, TOTAL
  61.  
  62.                   Miscellaneous  - MACD, MACDTRIGGER, CCI, VOL(atility)
  63.                                    PEAK, TROUGH
  64.  
  65.    When you register TAS, you will receive a "REGISTRATION CODE" that will
  66.    enable the full set of TAS features. If you register TAS/PT, there is
  67.    no limit on the number of TICKERs on which you can run the Profit Test
  68.    feature.
  69.  
  70.    You will find that running TAS from a batch file and placing the
  71.    reports into a file for inspection is more convenient on a day-to-day
  72.    basis than running the program interactively. This particular feature,
  73.    as well as the ability to scan up to 2000 stocks in one run, should
  74.    encourage you to register your version of TAS.
  75.  
  76.    Your registration entitles you to continuous updates for new TAS
  77.    features, support for TAS problems, questions and requests for new
  78.    indicators.
  79.  
  80.       2.1.1 How to Register
  81.  
  82.       In order to become a registered user of TAS or TAS/PT, please send a
  83.       check (made out to FlexSoft) for the amount of the registration fee
  84.       to:
  85.           FlexSoft
  86.           7172 Regional St, #276
  87.           Dublin, CA 94568
  88.  
  89.       2.1.2 Registration Fee
  90.  
  91.       If you register TAS alone, the registration cost is $45. If you want
  92.       TAS to include the Profit Testing support, the cost is $75.
  93.  
  94.       If you have registered PML (another product of the author's)
  95.       directly through the author (rather than in a co-sponsored package),
  96.       your TAS registration cost is $35 and the cost for TAS/PT is $60.
  97.  
  98.       If you wish to register PML and TAS together, the cost for both is
  99.       $60. Finally, the cost for PML and TAS/PT is $85.
  100.  
  101.       TAS/PT is the TAS program with the Profit Test feature enabled.
  102.       There is no separate program for TAS/PT. I could have created a
  103.       separate program for the Profit tester feature, in which case, there
  104.       would have been a separate registration required for it. For the
  105.       convenience of everyone, I chose to include the Profit Tester in TAS
  106.       with a different Registration Code to enable it. This means you
  107.       don't have to download multiple files to get both features. Also,
  108.       you can upgrade your TAS to TAS/PT by just sending me the difference
  109.       in the Registration Cost. If you do not want the Profit Tester
  110.       feature, then the price for TAS is the same as it always has been.
  111.  
  112.       The following table summarizes the registration pricing for TAS and
  113.       TAS/PT according to the discussion above.
  114.  
  115.                       TAS             TAS/PT (profit tester)
  116.                       -----           ------
  117.       Non-PML User    $45             $75
  118.       PML User        $35             $60
  119.       plus PML        $60             $85
  120.  
  121.    2.2 Support
  122.  
  123.    You can get support for TAS problems or questions by contacting me at
  124.    my mailing address (above) or by Email on the following services:
  125.        GEnie       : M.MOORE41
  126.        Prodigy     : JBMD65A
  127.        Compuserve  : 76447,2367
  128.        MCI         : M.MOORE
  129.  
  130.    If you need a new version of TAS, it will be available on the FlexSoft
  131.    BBS at 415-829-2293 (HOURS 4-7 a.m. and 3:30-7 p.m. Pacific Time or by
  132.    special arrangement). You are entitled to free updates to TAS from this
  133.    BBS or by U.S. Mail (not including shipping and handling). If you need
  134.    an update by U.S. Mail, please send $5 for shipping and handling.
  135.  
  136.    2.3 Redistribution of TAS
  137.  
  138.    You may (and are encouraged to) re-distribute TAS to other BBS systems
  139.    as long as you redistribute the entire unmodified package as you
  140.    received it. You may not redistribute your registration code along with
  141.    the package, nor may you give it away as long as you are currently
  142.    using it.
  143.  
  144.    2.4 Credits
  145.  
  146.    MetaStock Professional is a stock charting program from Equis Inc.
  147.  
  148.    ChartPro is a stock charting program written by David Rettger.
  149.  
  150.    2.5 Disclaimers
  151.  
  152.    The author claims no responsibility for any damages caused by the use
  153.    or misuse of this product.  This product is distributed "as is" with no
  154.    warranty expressed or implied.  The author will not be responsible for
  155.    any losses incurred, either directly or indirectly, by the use of this
  156.    product.  The author reserves the right to make modifications at any
  157.    time.  Prices are subject to change without notice.
  158.  
  159. 3 Installation
  160.  
  161. TAS is distributed as a .ZIP format collection of files. The name of the
  162. .ZIP file will be based on the version and release level of TAS. For
  163. version 1, release 1, the name will be 'TAS101.ZIP', and in general, the
  164. name will be 'TASvrr.ZIP' where 'v' is the Version and 'r' is the Release.
  165.  
  166.  
  167.    3.1 Quick Start Installation
  168.  
  169.    The following "quick start" documentation shows how to get TAS up and
  170.    running on your system initially. The file name for the TAS ZIP file is
  171.    referred to as "TASvrr.ZIP".
  172.  
  173.    In order to install TAS, you should perform the following steps
  174.  
  175.    1) Create a directory to contain TAS software. It can be any name you
  176.    choose. The following instructions assume the subdirectory name is
  177.    "\TAS".
  178.  
  179.    2) PKUNZIP TASvrr.ZIP into directory \TAS
  180.  
  181.    3) CD \TAS
  182.  
  183.    4) Type TAS
  184.  
  185.    5) You will be presented with a menu.
  186.  
  187.    6) Select "Configure TAS"
  188.  
  189.         Fill in the MSP directory names you want to scan. You can enter up
  190.         to 5 subdirectories
  191.  
  192.         Hit F3
  193.  
  194.    7)   Go to the "Define Ticker List" Menu
  195.         Select "Create New Ticker List"
  196.         Give the name "MYTICKS"
  197.         Move the cursor to each ticker symbol you want to run a script
  198.         against.
  199.         Hit the SPACE bar on the symbol.
  200.         It should highlight (indicating it is selected).
  201.         Hit F3 when all desired symbols are selected.
  202.  
  203.    8)  At the Main Menu, select Build or Run Selection by typing "B"
  204.  
  205.    9)  Reply to the New/Old prompt by typing "O" (for 'old').
  206.       Pick the selection MSURANK.SEL (by typing "M" or moving the
  207.        cursor to it) and hitting ENTER.
  208.        Pick the ticker list you just created "MYTICKS.TCK"
  209.  
  210.    10) You will see the MSURANK selection values. This particular
  211.       selection  will create a report like the one Metastock Utility (MSU)
  212.       creates when you select "Rank" using a 26 day Rate of Change and a
  213.       10 day Moving Average.
  214.  
  215.    11) Hit the F4 Key to run the selection. As each ticker is processed,
  216.       you will see a line in the "run" window. Once all tickers are
  217.       processed, the report will be presented on the screen, sorted by
  218.       ticker.
  219.  
  220.    12) Hit F1 now to see the choices you have. By hitting F1, you can read
  221.       the help and see what you can do from here. You can sort your
  222.       tickers on the value of any column shown, either ascending or
  223.       descending order. To sort on the values in the second column, press
  224.       the key sequence "Alt-2" (hold the ALT key and hit the number 2).
  225.  
  226.    13) To exit from the report screen, hit the ESC key.
  227.  
  228.    The documentation for the system is currently in the online help file
  229.    available by hitting the F1 key at any time.
  230.  
  231. 4 TAS Invocation
  232.  
  233. You can start TAS in "MENU MODE" by simply typing "TAS" by itself. TAS has
  234. switches available which you can specify on the command line. They are:
  235.  
  236.      -c   Eliminate CGA "snow"
  237.  
  238.      -b   Use BIOS to write to video screen. This may be necessary on some
  239.           systems which are not 100% compatible.
  240.  
  241.      -m   Use Monochrome color scheme
  242.  
  243. If you are a registered user of TAS, you can also start TAS in "batch
  244. mode" by specifying the name of a SCRIPT and the Ticker file on the
  245. command line. So, if you had a TAS script named "SELECT.TAS" and a Ticker
  246. List named "MYSTOCK.TCK", you could run the SELECT script against the
  247. stocks in the list MYSTOCK by typing:
  248.  
  249.                                TAS SELECT MYSTOCK
  250.  
  251. If you wanted TAS to process all of the stock symbols (Tickers) in your
  252. data base, you can omit the Ticker List name.
  253.  
  254. If you need to use the video flags mentioned above, they should be
  255. specified prior to the name of the script file.
  256.  
  257. 5 TAS Menu Functions
  258.  
  259. The TAS Main Menu contains a screen which has all the options you can choose
  260. when you work with TAS. The Main Menu looks like the figure below.
  261.  
  262. The following sections will describe each of the options accessible from the
  263. Main Menu.
  264.  
  265.  ╔════════Technical Analysis Scanner (TAS 2.5) Copyright 1990, FlexSoft══════╗
  266.  ║                               TRIAL VERSION                               ║
  267.  ║                                                                           ║
  268.  ║                                                                           ║
  269.  ║                  ┌───────────────Main Menu───────────────┐                ║
  270.  ║                  │                                       │                ║
  271.  ║                  │                                       │                ║
  272.  ║                  │    Configure TAS                      │                ║
  273.  ║                  │                                       │                ║
  274.  ║                  │    Define Ticker List                 │                ║
  275.  ║                  │                                       │                ║
  276.  ║                  │    Build or Run Selection             │                ║
  277.  ║                  │                                       │                ║
  278.  ║                  │    Edit A TAS Script                  │                ║
  279.  ║                  │                                       │                ║
  280.  ║                  │    Run TAS Script                     │                ║
  281.  ║                  │                                       │                ║
  282.  ║                  │    Quit                               │                ║
  283.  ║                  │                                       │                ║
  284.  ║                  └───────────────────────────────────────┘                ║
  285.  ║                                                                           ║
  286.  ║                                                                           ║
  287.  ╚═══════════════════════════════════════════════════════════════════════════╝
  288. ░[F1]=Help░░░░░░░░░░░░░░░░░░░░░Select Choice░░░░░░░░░░░░░░░░░[ESC]=Quit░░░
  289.  
  290.  
  291.    5.1 Special Keys within TAS
  292.  
  293.    The F1 key is the HELP KEY and the ESC key QUITS whatever you are doing
  294.    (without saving or processing your last request). These keys have the
  295.    same meaning throughout TAS.
  296.  
  297.    There is one other key that is always available with TAS and that is
  298.    the ALT-X key. The ALT-X key will exit from TAS to DOS. This will allow
  299.    you to do a few things outside of TAS. Because TAS is a large program,
  300.    you won't have a a great deal of storage left when you exit to DOS. To
  301.    return to TAS from DOS, type "EXIT".
  302.  
  303.    5.2 CONFIGURE TAS - Configuration and Setup
  304.  
  305.    The Configuration Menu is the place where you tell TAS the location of
  306.    your Metastock or ChartPro Data Directory(ies). Up to five directories
  307.    can be processed at one time.
  308.  
  309.    The configuration menu looks like this:
  310.  
  311.                    TAS Configuration and Setup
  312.    |
  313.    |
  314.    |    1st Data DIRECTORY  \MSPTEST\DATA
  315.    |    2nd Data DIRECTORY
  316.    |    3rd Data DIRECTORY
  317.    |    4th Data DIRECTORY
  318.    |    5th Data DIRECTORY
  319.    |
  320.    |    Symbol Table Size  9000  Quotes per Symbol    150
  321.    |
  322.    |    Your Name          Martin Moore
  323.    |    Registration Code  xxxxx
  324.  
  325.  
  326.    You should fill in the names of your Metastock or ChartPro Directories,
  327.    one per line above. Be sure to include the full path name, including
  328.    the first backslash character. If you have more than one directory of
  329.    data files, you can enter the other directory names on the second thru
  330.    fifth lines.
  331.  
  332.    Note that you cannot intermix directories across products. In other
  333.    words, all your directories must be either Metastock format or ChartPro
  334.    format. TAS determines the type of directory by first looking for a
  335.    file named "MASTER". If found, it assumes the directory is Metastock
  336.    format. If not found, it looks for files ending with ".PRO". If these
  337.    are found, it assumes that the directory is ChartPro data. If neither
  338.    search is satisfied, TAS issues an error message and requests that you
  339.    change the directory name.
  340.  
  341.    The SYMBOL TABLE SIZE parameter is a "tuning" value which determines
  342.    the size of the internal tables for TAS. You may need to increase the
  343.    value if you write a particularly long or complex selection script.
  344.  
  345.    The QUOTES PER SYMBOL parameter specifies how many quotes you want TAS
  346.    to read into memory when performing the selection. The higher this
  347.    number, the longer the selection will take.
  348.  
  349.    NOTE : This parameter has a very significant impact on the processing
  350.    time that TAS uses for each symbol. It should be set to as low a value
  351.    as possible (based on the time periods you use in your indicators) so
  352.    that the TAS processing is minimized.
  353.  
  354.    When you register TAS or TAS/PT, you will receive a REGISTRATION CODE
  355.    based on your Name. Whatever name you include in the file REGISTER.DOC
  356.    will be used to form an encryption code. Use the same form of your name
  357.    as sent to me in your REGISTER.DOC file. Place the REGISTRATION CODE
  358.    sent to you in the appropriate field.
  359.  
  360.    5.3 DEFINE TICKER LIST
  361.  
  362.    You can create "ticker lists" with TAS. A "ticker list" is a list of
  363.    stock or ticker symbols which you can name as a group. This allows you
  364.    to create individualized lists of symbols against which you can run
  365.    your TAS scripts. As an example, you could create a ticker list
  366.    containing the Dow Jones 30 Industrials, or a list containing only
  367.    stocks you hold.
  368.  
  369.    When you choose the TICKER LIST menu, you are asked if you want to
  370.    create an new list or modify an existing one.
  371.  
  372.    When you select this menu item, you will be asked if you want to create
  373.    a New Ticker List or Modify an Old Ticker List.
  374.  
  375.    If you request a new Ticker List, you will be prompted for the Ticker
  376.    List name. Enter only the filename portion, not the .TCK extension. The
  377.    file will be created in the \TAS directory.
  378.  
  379.    If you want to modify an old Ticker List, a File Name Selection Screen
  380.    will appear which contains the names of all the files in the current
  381.    directory ending with ".TCK". Move the cursor or mouse over to the
  382.    correct file name and press Enter (or double-click).
  383.  
  384.    The Ticker List screen will then appear with all the ticker symbols
  385.    contained in the MSP directories you have configured. Each symbol that
  386.    is highlighted in YELLOW has been "selected" for inclusion in the
  387.    ticker list. To select or unselect a symbol, move the cursor to the
  388.    symbol and hit the SPACE Bar. If the symbol is selected, it becomes
  389.    unselected or vice versa.
  390.  
  391.    If you want to SELECT ALL TICKERS, hit the F9 (SELECT ALL) Key. To
  392.    UNSELECT ALL TICKERS, hit the F8 (UnSELECT ALL) Key.
  393.  
  394.    Once you have created the ticker list, hit the F3 (Save) Key to save
  395.    it. If you do not want to save the list, hit the ESC (Abort) Key.
  396.  
  397.    If you want to run a TAS script against all of your data, create a new
  398.    Ticker List called "ALL". Hit the F9 Key to select all symbols. Then
  399.    hit the F3 Key to save the list.
  400.  
  401.    5.4 BUILD OR RUN SELECTION
  402.  
  403.    Using the BUILD SELECTION screen of TAS, you can create your own report
  404.    containing up to 7 columns of calculated formulas or data values. In
  405.    addition, you can use the Condition entry areas (below the Formulas) to
  406.    specify which conditions must be satisfied for a ticker to be included in
  407.    the report output.
  408.  
  409.    The figure below shows the equivalent of the MetaStock Utility "Rank"
  410.    option where the first formula is the Current Price ("C" is the Closing
  411.    Price), the second formula is the 26 day Rate of Change (ROC). The
  412.    third formula is the 10 day Simple Moving Average of the price. The
  413.    fourth is the 10 day Simple Moving Average of "F2", where "F2" is the
  414.    26 day ROC. Finally, the last formula F5 is the percentage by which the
  415.    Price is above or below the moving average contained in F3.
  416.  
  417.    ┌──────────────────────────TAS Selection Creation──────────────────────────┐
  418.    │                                                             Column       │
  419.    │              Enter Formulas Below, e.g. CCI(14)              Title       │
  420.    │ Formula F1  C                                               CURR PRC     │
  421.    │ Formula F2  ROC(C,26,'%')                                   %ROC/PRC     │
  422.    │ Formula F3  MOV(C,10,'S')                                   MOV AVG      │
  423.    │ Formula F4  MOV(F2,10,'S')                                  MA %ROC      │
  424.    │ Formula F5  (F1/F3-1)*100                                   %PRC MA      │
  425.    │ Formula F6                                                               │
  426.    │ Formula F7                                                               │
  427.    │                                                                          │
  428.    │                   Enter Conditions Below, e.g. F1 > F2                   │
  429.    │ Condition 1                                                              │
  430.    │ Condition 2                                                              │
  431.    │ Condition 3                                                              │
  432.    │ Condition 4                                                              │
  433.    │ Condition 5                                                              │
  434.    │ Condition 6                                                              │
  435.    │                                                                          │
  436.    │                                                                          │
  437.    │                                                                          │
  438.    └──────────────────────────────────────────────────────────────────────────┘
  439.    F1]=Help░░░[F3]=Save░░░[F4]=Run Selection░░[F7]=Formula Builder░░[ESC]=Quit░
  440.  
  441.  
  442.    You can place any formulas or data value in each of the Formula areas.
  443.    If you hit the "F7" key, a list of functions included in TAS will be
  444.    shown on the screen and you will be prompted for the parameters of the
  445.    function.
  446.  
  447.    The CONDITION entries are used to "select" only those tickers that
  448.    match the condition. The conditions are specified in terms of the
  449.    formulas given above. In the example above, if you only wanted to see
  450.    tickers whose ROC (Formula 'F2') was greater than 50, then you could
  451.    set
  452.        CONDITION 1    F2 > 50
  453.  
  454.    Also, if you had another condition, for example the current price of
  455.    the ticker is greater than $5, you could place that condition as
  456.    follows
  457.        CONDITION 2    C > 5
  458.  
  459.    and that would now select only tickers whose ROC is greater than 50 and
  460.    whose price is greater than $5.
  461.  
  462.    5.5 EDIT TAS SCRIPT - Editing TAS Scripts
  463.  
  464.    TAS has a built-in text editor which can be used to create and modify
  465.    TAS script files. All TAS script files end with the suffix ".TAS".
  466.  
  467.    When you select this menu item, you will be asked if you want to create
  468.    a New Script or Modify an Old Script.
  469.  
  470.    If you request a new script, you will be prompted for the script name.
  471.    Enter only the filename portion, not the .TAS extension. The file will
  472.    be created in the \TAS directory.
  473.  
  474.    If you want to modify an old script, a File Name Selection Screen will
  475.    appear which contains the names of all the files in the current
  476.    directory ending with ".TAS". Move the cursor or mouse over to the
  477.    correct file name and press Enter (or double-click).
  478.  
  479.    The editor screen will then appear with the contents of the file
  480.    displayed.
  481.  
  482.    NOTE:
  483.    The TAS editor cannot handle lines larger than 76 characters long. If
  484.    the line is longer than that, it will be broken at column 76 and
  485.    continued onto the next line. If the total length of the line is more
  486.    than 256 characters, the last part of the line will be lost if the file
  487.    is saved.
  488.  
  489.       5.5.1 Editor Function Keys
  490.  
  491.          5.5.1.1 Help Key - (F1)
  492.  
  493.          If you need help with the editor, hit the F1 (Help) Key. You will
  494.          see a list of editor commands.
  495.  
  496.          5.5.1.2 Save Script File Key - (F3)
  497.  
  498.          When you are done with your editing, you can save the file by
  499.          hitting the F3 (Save) Key. If you do not want to save the file,
  500.          hit the ESC (Abort) Key.
  501.  
  502.          5.5.1.3 CHECK SCRIPT Key - (F4)
  503.  
  504.          If you wish to check your script file for errors in syntax, press
  505.          the F4 (CHECK SCRIPT) key. If there are errors in the script
  506.          which can be detected by the Check Script function, an error
  507.          message showing the type of error encountered and the line and
  508.          column number on which the error occurred will appear in a window
  509.          at the bottom of the screen. This window will disappear after a
  510.          few seconds or when you hit a key. Then the script file will be
  511.          positioned so that the cursor is on the line WHERE THE ERROR WAS
  512.          DETECTED. It is usually the case that the error is somewhere
  513.          either on that line or on the previous line. Use the column
  514.          number to determine which.
  515.  
  516.          5.5.1.4 FORMULA BUILDER Key - (F7)
  517.  
  518.          One key available in the editor is the F7 (Formula Builder) Key.
  519.          This key will bring up a list of Technical Indicator functions
  520.          and Pre-defined Data Arrays. If you select one of the functions
  521.          or arrays, the subsequent parameters of the function (e.g. MOV
  522.          "Moving Average" requires 3 additional parameters) will be
  523.          prompted. Enter each parameter. When you are done, the formula
  524.          and parameters will be placed into your script file at the
  525.          location of the cursor when you hit F7.
  526.  
  527.    5.6 RUN TAS SCRIPT - Running TAS Scripts
  528.  
  529.    If you have created a script (or are using one of the example scripts)
  530.    and you want to run it against a specific Ticker List, you should
  531.    choose the "RUN TAS Scripts" option from the Main Menu. (You must have
  532.    created at least one Ticker List before you can run TAS)
  533.  
  534.    When this option is chosen, you will be asked for the TAS script name
  535.    and the Ticker List name. Each choice will be from a list of filenames
  536.    ending with the appropriate extension (".TAS" or ".TCK"). Move the
  537.    cursor to the correct file name for each choice and hit ENTER.
  538.  
  539.    5.7 QUIT
  540.  
  541.    This option will exit from TAS. If you want to go to DOS and return to
  542.    what you were doing within TAS, use the ALT-X key.
  543.  
  544. 6 TAS Selection Scripts -  Description
  545.  
  546. TAS Selection reads each ticker in the TICKER LIST from the MSP data file.
  547. It reads the quotes for the file into the pre-defined data arrays up to
  548. the lower of either (1) the number specified in the QUOTES PER SYMBOL (in
  549. the Configure TAS Menu) (2) the number specified in #MAX_QUOTES in the
  550. script file itself, or (3) all the quotes in the file.
  551.  
  552. Once all the price history has been read into the data arrays, TAS
  553. "executes" the statements in the TAS script file. Once all statements in
  554. the file have been executed, TAS moves on to the next ticker symbol in the
  555. TICKER LIST.
  556.  
  557. This process continues until all the symbols in the TICKER LIST have been
  558. read or until an error is encountered in the script file.
  559.  
  560. 7 TAS Script Language
  561.  
  562. The TAS package contains numerous examples of TAS Scripts. You should
  563. print them and look at them while reading the next section. The sample
  564. scripts contain "comments" which explain what the script is doing at each
  565. point of the script.
  566.  
  567.    7.1 Syntax
  568.  
  569.    TAS Script Language (TASSL) syntax is similar to the programming
  570.    language "PASCAL". If you are fortunate enough to already know PASCAL,
  571.    then the language should be familiar to you. However, if you don't, the
  572.    following topics will give an explanation of the language.
  573.  
  574.    In the subsequent discussion, the word "statement" is used. A
  575.    "statement" is like a sentence in English. Like a sentence, it is
  576.    composed of "words" ("tokens" in computereze). There are only two kinds
  577.    of statement in TASSL, the "assignment statement" and the "IF
  578.    statement".
  579.  
  580.    A semi-colon (;) is used to tell TAS that the statement you just
  581.    entered is done. EVERY STATEMENT MUST BE TERMINATED WITH A SEMI-COLON.
  582.  
  583.    Also, in the syntax descriptions below, words you must use are in UPPER
  584.    CASE, and parts of the statement that are up to you are in lower case.
  585.  
  586.       7.1.1 Building Blocks
  587.  
  588.       The "Building Blocks" of TASSL are the following types of items:
  589.  
  590.       1)      "VARIABLES". Variables are where you put values or, in the
  591.               case of "pre-defined" variables, where you get them. The
  592.               names are anything you choose, but they have to start with a
  593.               letter of the alphabet.
  594.  
  595.       2)      "ASSIGNMENT STATEMENT". The ASSIGNMENT statement (":=") is
  596.               how you can move a value from one place to another.
  597.  
  598.       3)      "ARITHMETIC Operators". These are the usual ADD(+), SUBTRACT
  599.               (-), MULTIPLY(*) and DIVIDE(/).
  600.  
  601.       4)      "FUNCTIONS". A "function" is a built-in Technical Indicator
  602.               or "output" function which usually returns a value.
  603.  
  604.       5)      IF statements. An "IF" statement is used to test a condition
  605.               or value. Once the condition is tested, you can perform
  606.               certain actions "if" it is TRUE or "if" it is false.
  607.  
  608.       6)      "BEGIN-END Blocks". A "BEGIN-END" block is a way to "group"
  609.               several statements into one. For example, the IF statement
  610.               only allows you to execute the following "statement".
  611.               However, if you use a BEGIN followed by multiple statements,
  612.               followed by an END, the whole series of statements from the
  613.               BEGIN through the END is considered to be ONE statement. It
  614.               is similar to putting parentheses around an arithmetic
  615.               expression.
  616.  
  617.       7)      "Logical AND". The AND word takes a left-hand side and a
  618.               right-hand side. If both are TRUE, the whole is TRUE.
  619.  
  620.       8)      "Logical OR". The OR word also has a left and right side. If
  621.               either is TRUE, the whole is TRUE.
  622.  
  623.       9)      "RELATION Operator". These are how you test the "relation"
  624.               between two values. The operators are:
  625.  
  626.                   EQUAL                       =
  627.                   GREATER THAN                >
  628.                   GREATER THAN OR EQUAL       >=
  629.                   LESS THAN                   <
  630.                   LESS THAN OR EQUAL          <=
  631.                   NOT EQUAL                   <>
  632.  
  633.       10)     Comments. These are used to "document" the TASSL script.
  634.               They perform no function, but only help to understand what
  635.               is going on in the general area of the script. They are good
  636.               to use and should be included in the script to make it
  637.               easier to understand.
  638.  
  639.       7.1.2 Variables
  640.  
  641.       The concept of a "variable" is difficult to communicate to anyone
  642.       who hasn't programmed before. Loosely speaking, it is a name given
  643.       to a "place" to put a "value". Think of it as a "name for a value".
  644.       Except for "pre-defined" variables (see below) you can make up the
  645.       names for the variables in your script.
  646.  
  647.       A variable name must start with an alphabetic letter, contain only
  648.       letters, numbers and underscores ("_"). Some valid names are:
  649.  
  650.           my_stuff, my_122999, my999, m9, M32_togo, Beethoven, etc
  651.  
  652.       Generally, you first use variables in "assignment statements", that
  653.       is, you first "put" something into them. Subsequently, you can use
  654.       them as values passed to functions or in an IF statement.
  655.  
  656.       7.1.3 TAS Variable Types
  657.  
  658.          7.1.3.1 "String" Variables -
  659.  
  660.          These are variables to hold text information, like "IBM", or
  661.          "THIS IS A STICK-UP".
  662.  
  663.          7.1.3.2 "Numeric" Variables
  664.  
  665.          These are variables that hold numbers, like 32, or -75.69, or
  666.          10000034.
  667.  
  668.          There are two types of numeric variables, INTEGERS and REAL
  669.          numbers. An INTEGER is a number which has no decimal point. An
  670.          INTEGER can be NO LARGER THAN 32,767 in value. If you need to use
  671.          a number larger than 32,767 then you must include a decimal point
  672.          followed by at least one zero in the number. For example, if you
  673.          want to use the number 1 million in your script, you cannot say
  674.          10000000 because the number is larger than 32,767 and it does not
  675.          contain a decimal point. In this case, you must say 1000000.0 to
  676.          tell TAS that the number is a REAL number.
  677.  
  678.          7.1.3.3 "Numeric Array" Variables
  679.  
  680.          These are variables that hold many numbers in an "array". All of
  681.          the numbers in the array have the same variable name; however,
  682.          you cannot "look" at them all at once.
  683.  
  684.          You must pick out one of the numbers of the array by specifying
  685.          its location in the array. The pre-defined data arrays, like H,
  686.          L, C, V (for High Price, Low Price, Closing Price and Volume) are
  687.          examples of arrays.
  688.  
  689.          If you want to refer to a closing price 10 days ago, you need to
  690.          say C[-10]. Each time you refer to an "element" of an array, you
  691.          must provide the "subscript" in square brackets, e.g. [-10],
  692.          which means "subscript minus ten".
  693.  
  694.          You can define your own variable array by "declaring" it (prior
  695.          to first using it) as follows:
  696.  
  697.                  variable_name : ARRAY;
  698.  
  699.          where 'variable_name' is the name by which you want to refer to
  700.          the array.
  701.  
  702.       7.1.4 Assignment Statement
  703.  
  704.       The Assignment Statement is used to set the contents of a variable
  705.       to the result of an "expression". An "expression" is another of
  706.       those computereze terms, but it means sequence of mathematical
  707.       operations and/or the result of a "function".
  708.  
  709.       It might help to give some examples of assignment operations:
  710.  
  711.               a := b + 3 / 4;
  712.  
  713.       The ":=" (colon-equal) is the operator that says "assign to". So,
  714.       reading the above assignment, in English, it says "add the contents
  715.       of variable 'b' to the result of dividing 3 by 4. Place this result
  716.       in variable 'a'". If variable 'b' contained 6 when this statement
  717.       was encountered, then variable 'a' would contain 6.75 (6 + 3/4).
  718.  
  719.       Another example is:
  720.  
  721.               a := (c[-1] + c[0]) / 2;
  722.  
  723.       In this example, the array 'c' is pre-defined as the "closing price
  724.       array". So, the statement is adding the closing price yesterday
  725.       (c[-1]) to the closing price today (c[0]). It is then dividing the
  726.       total of this addition by 2 and placing the result in variable 'a'.
  727.       Note the use of the parentheses to "group" the addition so that it
  728.       would be done before the division by 2. If there were no
  729.       parentheses, the result would have been considerably different.
  730.       Instead, it would have divided today's closing price by 2, added it
  731.       to yesterday's closing price, and placed the result in 'a'.
  732.  
  733.       Another example of an assignment is the result of a "function" call.
  734.       All Technical Indicators available in TAS are created by making a
  735.       "function" call. In other words, the Technical Indicator is referred
  736.       to by its name (the "function"). So, for example,
  737.  
  738.               a := mov(c,21,'E');
  739.  
  740.       calculates the 21 day exponential moving average ("mov" function) of
  741.       the closing price array. If variable 'a' has been declared to be an
  742.       ARRAY prior to this point, then 'a' contains all the moving average
  743.       "points". If 'a' has not been declared as an ARRAY, then 'a' will
  744.       contain the value of the moving average AT THE LAST POINT of the
  745.       range, i.e., today's value.
  746.  
  747.       7.1.5 Arithmetic Operators
  748.  
  749.       Arithmetic Operators are addition (plus sign '+'), subtraction
  750.       (minus sign '-'), multiplication (asterisk '*') and division (slash
  751.       '/'). When you write an arithmetic expression, you should use
  752.       parentheses to guarantee the order in which the operations are
  753.       performed. In general, division and multiplication are performed
  754.       first, then addition and subtraction.
  755.  
  756.       7.1.6 Functions
  757.  
  758.       A "function" is a reference to a "built-in" Technical Indicator
  759.       function (like "MOV(...)"), an output function (like WRITE or
  760.       WRITELN), or an array manipulation function (like DIVBY). See the
  761.       individual descriptions of each function in the MSP User's Guide for
  762.       a more complete definition of the meaning of the various Technical
  763.       Indicators.
  764.  
  765.       7.1.7 IF Statements
  766.  
  767.       The IF statement is the most powerful scanning feature of TAS. It
  768.       enables you to create complex relationships between indicators based
  769.       on their relationship with other indicators and values.
  770.  
  771.       An IF statement is written as follows:
  772.  
  773.               IF expression THEN
  774.                   statement to execute if the 'expression' is true
  775.               ELSE
  776.                   statement to execute if the 'expression' is false;
  777.  
  778.       The ELSE part of the IF statement is optional, but sometimes it is
  779.       convenient to make a two way decision about something. You could
  780.       alternatively say:
  781.  
  782.               IF expression THEN
  783.                   statement to execute if the 'expression' is true;
  784.  
  785.       The TAS language does not require you to include the word THEN after
  786.       the IF part of the statement. You must terminate each IF statement
  787.       with a semi-colon. Note, however, that IF statements containing an
  788.       ELSE part are terminated __after__ the ELSE part. For example,
  789.  
  790.               IF a > b THEN
  791.                   WRITELN('a is greater than b, hurray!')
  792.               ELSE
  793.                   WRITELN('a is not greater than b, sorry.');
  794.  
  795.       Note how there is a semi-colon on the last line, but not after the
  796.       first WRITELN. However, if you wanted to print a message only if "a"
  797.       is greater than "b", then you would say
  798.  
  799.               IF a > b THEN
  800.                   WRITELN('a is greater than b, hurray!');
  801.  
  802.       Note the semi-colon after the last line.
  803.  
  804.       7.1.8 BEGIN..END Statement
  805.  
  806.       Suppose you want to do more than one thing if the condition "a is
  807.       greater than b" is true. In that case, you would need to use a BEGIN
  808.       .. END block. A "BEGIN..END" block "groups" all statements between
  809.       the BEGIN and the END so that the entire "group" is treated as if it
  810.       were one statement.
  811.  
  812.       This is useful in the case of the IF statement, because the action
  813.       to be taken following the THEN or ELSE part of the IF can only be
  814.       one statement. But if you use the BEGIN..END block to group several
  815.       statements, the entire block is treated as a "single" statement.
  816.       Think of BEGIN..END blocks in the same way you would think of
  817.       parenthesized arithmetic expressions. You use parentheses to "group"
  818.       some operations so that they are treated as a group.
  819.  
  820.       An example of the use of the BEGIN..END block in an IF statement is
  821.       shown below:
  822.  
  823.               IF a > b THEN
  824.               BEGIN
  825.                   a := a - 1;
  826.                   b := mov(c,21,'E');
  827.                   WRITELN('New values for a and b are: ',a,' ',b);
  828.               END;
  829.  
  830.       All three statements following the BEGIN will be executed (acted
  831.       upon) if the value of "a" is greater than the value of "b". If you
  832.       had left out the BEGIN..END section, only the first statement ("a :=
  833.       a - 1") would have been done if "a > b" was true. The following two
  834.       statements would have ALWAYS been done, since they were not part of
  835.       the IF.
  836.  
  837.       7.1.9 Profit Test Statements
  838.  
  839.       Profit Test Statements are used to:
  840.  
  841.           1) Define which Technical Indicators are to be computed.
  842.  
  843.           2) Define BUY conditions
  844.  
  845.           3) Define SELL conditions
  846.  
  847.           4) Define STOP conditions
  848.  
  849.       The statments used to describe the situations above are described in
  850.       the next 4 sections.
  851.  
  852.          7.1.9.1 PLOT statement: Define Technical Indicators
  853.  
  854.          The PLOT statement is used to create the formulas or indicators which
  855.          will be used in the subsequent profit test. The PLOT statement is
  856.          executed once per ticker symbol, and must be placed prior to any of
  857.          the BUY/SELL/STOP WHEN conditions.
  858.  
  859.          The format of the PLOT statment is:
  860.  
  861.                      PLOT stmt;
  862.  
  863.          where 'stmt' can be a single statement or a BEGIN..END block. For
  864.          example, if your profit test is to test the Commodity Channel Index
  865.          (CCI) for 14 days, you could say:
  866.  
  867.                      CCI_ARRAY : ARRAY;    { Define the cci array}
  868.                      PLOT CCI_ARRAY := CCI(14);
  869.  
  870.          In the example, only one indicator is computed, so there was no need
  871.          to use the BEGIN..END block. Suppose, however, that we want to
  872.          incorporate Wilder's RSI in the profit test as well. Then we would
  873.          say:
  874.  
  875.                      CCI_ARRAY : ARRAY;    { Define the cci array}
  876.                      RSI_ARRAY : ARRAY;    { Define the rsi array}
  877.                      PLOT BEGIN
  878.                          CCI_ARRAY := CCI(14);
  879.                          RSI_ARRAY := RSI(14);
  880.                      END;   { of PLOT statement}
  881.  
  882.          7.1.9.2 BUY WHEN - Define BUY Conditions
  883.  
  884.          The BUY WHEN condition causes the profit tester to 'buy' the stock if
  885.          the condition is true.
  886.  
  887.                      BUY WHEN expression;
  888.  
  889.          where 'expression' can be any combination of logical or relational
  890.          operators.
  891.  
  892.          For example, using the last PLOT statement in the previous example, we
  893.          will issue a BUY signal when the CCI rises above -100 and the RSI is
  894.          less than 40:
  895.  
  896.                      BUY WHEN cci_array[-1] < -100
  897.                           AND cci_array[0] > -100
  898.                           AND rsi_array < 40;
  899.  
  900.          7.1.9.3 SELL WHEN - Define SELL Conditions
  901.  
  902.          The SELL WHEN condition causes the profit tester to 'sell' the stock
  903.          if the condition is true.
  904.  
  905.                      SELL WHEN expression;
  906.  
  907.          where 'expression' can be any combination of logical or relational
  908.          operators.
  909.  
  910.          For example, using the last PLOT statement in the previous example, we
  911.          will issue a SELL signal when the CCI drops below 100 and the RSI is
  912.          greater than 60:
  913.  
  914.                      SELL WHEN cci_array[-1] > 100
  915.                           AND cci_array[0] < 100
  916.                           AND rsi_array > 60;
  917.  
  918.          7.1.9.4 STOP (LONG or SHORT) Condition
  919.  
  920.          The STOP LONG and STOP SHORT statements close a "long" position or a
  921.          "short" position, respectively, but either selling or buying to cover
  922.          an open position.
  923.  
  924.          To close out a long position (by selling), the statement is:
  925.  
  926.                      STOP LONG WHEN expression;
  927.  
  928.          where 'expression' can be any combination of logical or relational
  929.          operators.
  930.  
  931.          To close out a short position (by buying), the statement is:
  932.  
  933.                      STOP SHORT WHEN expression;
  934.  
  935.          where 'expression' can be any combination of logical or relational
  936.          operators.
  937.  
  938.          Adding a long stop to the example built in the prior sections, we
  939.          could say that we want to issue a stop if, after having gone long, the
  940.          CCI drops below -100 again. In that case, we could say:
  941.  
  942.                      STOP LONG WHEN cci_array < -100;
  943.  
  944.       7.1.10 Logical Operators
  945.  
  946.       You can combine relations by using the words "AND" and "OR". They
  947.       have the same sense as in English. Whenever you use AND and OR, you
  948.       can use parentheses to group your relations to be sure they are
  949.       computed the way you want them to be understood. For example:
  950.  
  951.               IF a > b AND b = 1 THEN
  952.                   WRITELN('a is greater than b and b is equal to 1');
  953.  
  954.       This example compares "a" to "b". If "a" is greater than "b", then
  955.       it compares "b" to the number 1. If "b" is equal to 1, then the
  956.       message
  957.           a is greater than b and b is equal to 1
  958.       will be printed. If either of the "relations" (a in "relation" to b
  959.       AND b in "relation" to 1) is not true, then the WRITELN will not be
  960.       done.
  961.  
  962.       On the other hand, suppose we want to print the message if either of
  963.       the conditions is true. Then we would say:
  964.  
  965.               IF a > b OR b = 1 THEN
  966.                   WRITELN('a is greater than b OR b is equal to 1');
  967.  
  968.       In this case, it would print the message if "a" were greater than
  969.       "b" or if "b" were equal to 1.
  970.  
  971.       7.1.11 Relational Operators
  972.  
  973.       Relational Operators describe a "relationship" between the
  974.       expression on the left of the operator and the expression on the
  975.       right of the operator. For example, "a > b". 'a' is on the left
  976.       side, 'b' is on the right side, and the operator is '>' which means
  977.       "greater than".
  978.  
  979.       The operators you can use in your TASSL script are shown on the
  980.       right below:
  981.  
  982.           EQUAL                       =
  983.           GREATER THAN                >
  984.           GREATER THAN OR EQUAL       >=
  985.           LESS THAN                   <
  986.           LESS THAN OR EQUAL          <=
  987.           NOT EQUAL                   <>
  988.  
  989.       7.1.12 Comments
  990.  
  991.       Comments are surrounded on both sides by "curly braces". These are
  992.       the characters at the right of your keyboard. They look like this:
  993.           {           - Left "curly brace"
  994.           }           - Right "curly brace"
  995.  
  996.       You can place these "curly braces" around any thing in your script
  997.       file that you do not want TAS see. It is only for your eyes and the
  998.       eyes of other humans.
  999.  
  1000.    7.2 Pre-Defined Variables
  1001.  
  1002.    Predefined Variables are variables that are "filled in" when each MSP
  1003.    TICKER is processed or at specific times during the processing of
  1004.    ticker files.
  1005.  
  1006.         TICKER            The 'ticker' symbol, e.g., AXP
  1007.  
  1008.         FULLNAME          The 'full name', e.g., AMERICAN EXPRESS
  1009.  
  1010.         QUOTE_COUNT       The number of quotes in the file
  1011.  
  1012.         FIRST_TICKER      Variable, which, if equal to 1 (one), indicates
  1013.                           this ticker is the first to be processed.
  1014.  
  1015.         LAST_TICKER       Variable, which, if equal to 1 (one), indicates
  1016.                           this ticker is  the last to be processed.
  1017.  
  1018.         DATE              The date of the latest quote in the file
  1019.                           in the format YYMMDD.
  1020.  
  1021.         O                 The OPEN "data array"
  1022.  
  1023.         H                 The HIGH "data array"
  1024.  
  1025.         L                 The LOW  "data array"
  1026.  
  1027.         C                 The CLOSE "data array"
  1028.  
  1029.         V                 The VOLUME "data array"
  1030.  
  1031.         OI                The OPEN INTEREST "data array"
  1032.  
  1033.         P                 The "last computed" array. For example,
  1034.                           X := MOV(C,30,'E')
  1035.                           places the last day's 30day EMA in 'X' and
  1036.                           the entire EMA array is in 'P' until another
  1037.                           function is called.
  1038.  
  1039.         PLOT_PHASE        Variable which is set to 1 when the Profit Test
  1040.                           Script is entered for the first time for a
  1041.                           ticker. (TAS/PT only).
  1042.  
  1043.         TEST_PHASE        Variable which is set to 1 when the Profit Test
  1044.                           Script is entered for the EACH quote for a
  1045.                           ticker. (TAS/PT only).
  1046.  
  1047.         END_PHASE         Variable which is set to 1 when the Profit Test
  1048.                           Script is entered for the last quote for a
  1049.                           ticker. (TAS/PT only).
  1050.  
  1051.    7.3 Pre-defined Functions
  1052.  
  1053.    TAS functions which are also available in MetaStock have the same names
  1054.    and (nearly the same) parameters as those documented in the MSP Custom
  1055.    Formulas Section of the MSP "User's Manual".
  1056.  
  1057.    Functions which are unique to TAS (not shared by MetaStock) are
  1058.    described in detail in this document. The MetaStock functions are only
  1059.    summarized. Please refer to the Metastock documentation for a complete
  1060.    description of the functions and their parameters.
  1061.  
  1062.    In some instances, the parameter to an MetaStock named function has to
  1063.    have single quotes around it. This is the case with any function that
  1064.    passes a single character as a parameter, such as the last parameter in
  1065.    the "mov" (Moving Average) function.
  1066.  
  1067.       7.3.1 MSP Technical Indicators
  1068.  
  1069.       ad()         Accumulation/Distribution Array
  1070.  
  1071.       adx(p)       Average Directional Movement
  1072.  
  1073.       adxr(p)      Average Directional Movement Rating
  1074.  
  1075.       add(a,b)     Add each element of array "a"
  1076.                    to the corresponding element of
  1077.                    array "b".
  1078.  
  1079.       cci(p)       Commodity Channel Index Array
  1080.                      p = number of periods
  1081.  
  1082.       co()         Chaikin's Oscillator Array
  1083.  
  1084.       cum(a)       Cumulative Sum of Array "a"
  1085.  
  1086.       div(a,b)     Divide each element of array "a"
  1087.                    by an element of array "b".
  1088.  
  1089.       dx(p)        Directional Movement Index
  1090.  
  1091.       hhv(a,p)     Returns Highest High Value in the array 'a' for the
  1092.                    period 'p'
  1093.  
  1094.       llv(a,p)     Returns Lowest Low Value in the array 'a' for the
  1095.                    period 'p'
  1096.  
  1097.       macd()       Moving Average Convergence/
  1098.                    Divergence
  1099.  
  1100.       mdi(p)       Minus Directional Movement
  1101.                    Indicator
  1102.  
  1103.       mo(p)        Momentum Array
  1104.                      p = number of periods
  1105.  
  1106.       mov(d,p,t)   Moving Average Array
  1107.                      d = Data Array
  1108.                      p = number of periods
  1109.                      t = Moving Average Type
  1110.                           'E' - Exponential
  1111.                           'S' - Simple
  1112.                           'W' - Weighted
  1113.  
  1114.       mul(a,b)     Multiply each element of array "a"
  1115.                    by the corresponding element of
  1116.                    array "b".
  1117.  
  1118.       neg(a)       Negative of Array "a"
  1119.  
  1120.       nvi()        Negative Volume Indicator
  1121.  
  1122.       obv()        On Balance Volume
  1123.  
  1124.       pdi(p)       Positive Directional Movement
  1125.                    Indicator
  1126.  
  1127.       pvi()        Positive Volume Indicator
  1128.  
  1129.       rsi(p)       Wilder's Relative Strength Indicator
  1130.                      p = number of periods
  1131.  
  1132.       roc(d,p,r)   Rate Of Change Array
  1133.                      d = Data Array
  1134.                      p = number of periods
  1135.                      r = ROC Type
  1136.                           '%' - percentage ROC
  1137.                           '$' - Unit ROC
  1138.  
  1139.       sar(i,m)     Wilder's Parabolic Stop and Reverse (SAR) indicator.
  1140.                    Create a parabolic stop line either over or under the
  1141.                    price graph.
  1142.                      where  'i' = increment value and initial
  1143.                             'm' = maximum acceleration factor
  1144.  
  1145.                    Wilder's explanation uses the values of
  1146.                      i=0.02 and m= 0.20
  1147.  
  1148.                    Note : In ChartPro, this indicator is referred to as
  1149.                    Technical Study 'PTP'
  1150.  
  1151.       stoch(p,s)   Stochastic Oscillator
  1152.                      p = number of periods
  1153.                      s = k slowing periods
  1154.  
  1155.       sub(a,b)     Subtract each element of array "b"
  1156.                    from the corresponding element of
  1157.                    array "a".
  1158.  
  1159.       vol(pm,pr)   Volatility Indicator. This is the 'pr' day Rate Of
  1160.                    Change Oscillator of a 'pm' day exponential Moving
  1161.                    Average of the difference between each day's high and
  1162.                    low price.
  1163.  
  1164.       7.3.2 TAS Functions
  1165.  
  1166.       angle(a)      returns the angle in degrees of the line described by
  1167.                     the array 'a'.
  1168.  
  1169.       corrcoef()    returns the "correlation coefficient" of the last
  1170.                     linear regression performed. This value ranges from
  1171.                     -100 to +100. If the data points match the points in
  1172.                     the linear regression approximation, the correlation
  1173.                     coefficient will be 100. If the points show no
  1174.                     correlation with the approximation, the correlation
  1175.                     coefficient will be zero.
  1176.  
  1177.       divby(a,x)    Divide each element of array "a" by the value of "x".
  1178.                     In this case, "x" is a single number.
  1179.  
  1180.       int(x)        Turns the number "x" into the nearest "integer". An
  1181.                     integer is a number without a fractional part (the
  1182.                     part after the decimal). The maximum number that you
  1183.                     can turn into an integer is 32,767.
  1184.  
  1185.       isect(a,b)    Find the latest intersecting point of the two arrays
  1186.                     "a" and "b". Returns the number of days since the two
  1187.                     arrays intersected or -1 (negative one) if they have
  1188.                     never intersected.
  1189.  
  1190.                     NOTE:
  1191.                     Since the graph of the two arrays actually crosses
  1192.                     BETWEEN two days, the value returned will be the later
  1193.                     day AFTER the crossing. For example, if the arrays
  1194.                     crossed between yesterday and today, the value
  1195.                     returned will be zero. If they crossed between two
  1196.                     days ago and yesterday, the value returned will be 1,
  1197.                     and so forth.
  1198.  
  1199.       linreg(a,s,e) Create a linear regression line using "least-squares"
  1200.                     method to find the mathematical average of the values
  1201.                     in the array "a" starting at entry "s" and ending at
  1202.                     entry "e". If "s" is zero, it refers to the first
  1203.                     value in the array. If "e" is zero, it refers to the
  1204.                     last value in the array. Positive values for "s" or
  1205.                     "e" refer to the appropriate array entries (counting
  1206.                     from 0).
  1207.                     A negative number in the "s" or "e" index is
  1208.                     subtracted from the total number of entries in the
  1209.                     array to get the appropriate positive array index.
  1210.                     For example,
  1211.                       x : array;
  1212.                       x := linreg(c,-50,-10);
  1213.                     will find the line passing most closely through the
  1214.                     closing prices from 50 days before the last day in the
  1215.                     file to 10 days before the last day in the file.
  1216.  
  1217.       mulby(a,x)  - Multiply each element of array "a" by the value of
  1218.                     "x". In this case, "x" is a single number.
  1219.  
  1220.       over(a,b)     If array "a" is "over" array "b", this function
  1221.                     returns the number of days since array "a" crossed
  1222.                     above array "b".  See the note under the "isect"
  1223.                     function.
  1224.  
  1225.       peak(a,n)     returns the index of the 'n'-th peak value in array
  1226.                     'a'. A 'peak' is defined as a high value surrounded by
  1227.                     lower values. The value returned from this function is
  1228.                     the array index to the peak value.
  1229.                     --------------------
  1230.                     Plot of price array
  1231.                     --------------------
  1232.                           1
  1233.                        2  /\
  1234.                        /\/  \
  1235.                       /
  1236.                     /
  1237.                     In the figure above, the peak(H,2) call would return
  1238.                     the index of the point marked '2'. If you consider the
  1239.                     joining of each of the /\ lines a day, then the value
  1240.                     returned in this example would be '-5', or 5 days
  1241.                     prior to the last day.
  1242.  
  1243.       slope(a)      will return the mathematical "slope" of the line whose
  1244.                     points are contained in array "a". This array must
  1245.                     have been created with the "linreg" function.
  1246.  
  1247.       trough(a,n)   returns the index of the 'n'-th "trough" value in
  1248.                     array 'a'. A 'trough' is defined as a low value
  1249.                     surrounded by higher values. The value returned from
  1250.                     this function is the array index to the trough
  1251.                     value.
  1252.                     --------------------
  1253.                     Plot of price array
  1254.                     --------------------
  1255.                     \
  1256.                      \  /\  /
  1257.                       \/  \/
  1258.                       2    1
  1259.                     In the figure above, the trough(L,2) call would return
  1260.                     the index of the point marked '2'. If you consider the
  1261.                     joining of each of the /\ lines a day, then the value
  1262.                     returned in this example would be '-6', or 6 days
  1263.                     prior to the last day.
  1264.  
  1265.  
  1266.       7.3.3 TAS Profit Tester Functions
  1267.  
  1268.       The Profit Tester feature of TAS uses the following functions to
  1269.       indicate the buy/sell transactions controlled by a Profit Testing
  1270.       script. Refer to the script 'RSIPT.TAS' for an example of the use of
  1271.       the Profit Test functions.
  1272.  
  1273.       pt_buy()      Profit Tester - Buy the stock at the current closing
  1274.                     price if not already held. If testing Short positions,
  1275.                     buy to 'cover' the short sale.
  1276.  
  1277.       pt_sell()     Profit Tester - Sell the stock at the current closing
  1278.                     price if it has been bought. If testing Short
  1279.                     positions, sell the stock short.
  1280.  
  1281.       pt_stop(t)    Profit Tester - Issue either a Long Stop or a Short
  1282.                     Stop. The parameter 't' is either 'L' for a Long Stop,
  1283.                     or 'S' for a Short Stop.
  1284.  
  1285.       pt_price()    Profit Tester - Returns the share price at which the
  1286.                     last transaction was executed. The function is useful
  1287.                     if you want to set a STOP based on the change in
  1288.                     price.
  1289.  
  1290.       7.3.4 Output Functions
  1291.  
  1292.          7.3.4.1 WRITE and WRITELN Output Functions
  1293.  
  1294.          There are two direct output functions, WRITE and WRITELN. The
  1295.          WRITELN function is identical to the WRITE function, except that
  1296.          WRITELN causes a NEW LINE to be added at the end of the last
  1297.          field.
  1298.  
  1299.          The parameters to WRITE (and WRITELN) are either text strings,
  1300.          like 'this is a text string', surrounded by single quotes ('), or
  1301.          "variable values". A variable value is a value that you have
  1302.          assigned to a name by use of a formula or constant setting. There
  1303.          are "pre-defined" variables, such as H, L, C, V, O, TICKER,
  1304.          FULLNAME. These pre-defined variables are "filled in" when TAS
  1305.          reads the data values for each symbol.
  1306.  
  1307.          You can control the formatting of your output to some extent by
  1308.          using the characters sequence "\t" (backslash tee) in your text
  1309.          string. This will place a "tab" character in the output. TAS
  1310.          places "tab stops" every 4 columns of the output line.
  1311.  
  1312.          In addition, the sizes of the two types of "numbers", are
  1313.          constant. If you are printing an INTEGER value, it is five
  1314.          characters wide, left-justified. If you are printing a number
  1315.          with a decimal point, it is eight characters wide (99999.999).
  1316.          This will allow you to line up the output with column headings.
  1317.  
  1318.       7.3.5 SORT Functions
  1319.  
  1320.       TAS contains functions which can be used to sort your report output.
  1321.       Rather than doing WRITE and WRITELN, you can call the SORTOUT
  1322.       function to place the report data in a "sort buffer". Once all the
  1323.       tickers have been processed (when LAST_TICKER is 1), you can then
  1324.       sort the data using the SORTON function. Finally, the SORTPRINT
  1325.       function gives a "format" string which describes how you want the
  1326.       sorted fields to be displayed.
  1327.  
  1328.       If you want to experiment with the SORT commands, you should start out
  1329.       simply and then work toward more complex combinations. These are VERY
  1330.       ADVANCED functions and are not necessarily appropriate for the person who
  1331.       doesn't want to plan their requirements.
  1332.  
  1333.          7.3.5.1 SORTOUT
  1334.  
  1335.          The SORTOUT function takes up to 40 parameters which are fields
  1336.          to be placed in the 'sort buffer'. As each ticker is processed,
  1337.          you can place the computed results in the 'sort buffer'.
  1338.  
  1339.          For example, suppose you wanted to create a report of tickers in
  1340.          order by their volume. You wanted the report to contain the
  1341.          TICKER, the High, Low and Closing prices as well. For each ticker
  1342.          you would say
  1343.                  SORTOUT(TICKER,H,L,C,V);
  1344.  
  1345.  
  1346.          7.3.5.2 SORTON
  1347.  
  1348.          Once all tickers have been processed, and their data has been
  1349.          placed in the sort buffer using the SORTOUT function, you can
  1350.          sort the data with the SORTON function. The SORTON function
  1351.          requires two parameters as follows:
  1352.  
  1353.               SORTON(column_number, direction)
  1354.                         where:
  1355.                         'column_number' is the parameter position of the
  1356.                         data field in the SORTOUT command
  1357.                         'direction' is either 'a' for ASCENDING or 'd' for
  1358.                         DESCENDING sort.
  1359.  
  1360.          Using the example given in the SORTOUT description above, since
  1361.          the report was to be sorted by VOLUME, that is the 5th parameter
  1362.          position ("column") in the SORTOUT function shown.
  1363.  
  1364.          7.3.5.3 SORTPRINT
  1365.  
  1366.          The trickiest part of using the SORT feature is the specification
  1367.          of the 'format string' used by the SORTPRINT function. If you
  1368.          have access to a C Programming book, you will find the format
  1369.          specifications under the PRINTF() function description. Short of
  1370.          that, a summary of the types of format specifiers follows:
  1371.  
  1372.          A format specifier is formed as follows:
  1373.              % [width] [.prec] [type]
  1374.  
  1375.          The [width] is the minimum number of characters to print.
  1376.  
  1377.          The [.prec] is the maximum number of characters to print or the
  1378.          minimum number of digits to print.
  1379.  
  1380.          [type] is one of three values:
  1381.                'ld'        for INTEGER values (result of INT() function)
  1382.                'f'         for REAL numbers (most results)
  1383.                's'         for a STRING CONSTANT (like TICKER or DATE)
  1384.  
  1385.          So, to print the results of the SORTOUT request given above,
  1386.          there must be five format specifiers (since there are five
  1387.          parameters to SORTOUT). The first parameter is the TICKER (which
  1388.          is a 'string') so its format specifier would simply be '%s'. The
  1389.          next three fields are all 'real' numbers (that is, they have
  1390.          decimal points), so their format could be '%7.3f' which would
  1391.          say, make the field 7 characters wide, and include three decimal
  1392.          places, like this '999.999', so this will work fine unless the
  1393.          price is greater than 1000. If it were, you could make the field
  1394.          '%8.3f' to add more room at the left. Finally, the last field, V
  1395.          (VOLUME) does not contain any portion beyond the decimal point.
  1396.          That is, shares are reported in whole numbers. But, because
  1397.          Volume is typically larger than the maximum value of an "integer"
  1398.          field (32,767) , it is also a 'REAL' number. To make the volume
  1399.          field report in whole units, without a decimal point, you would
  1400.          say '%8.0f' which would place volume in an eight character field
  1401.          with no decimal.
  1402.  
  1403.          So, the format string for the SORTPRINT would be:
  1404.                SORTPRINT('%s %7.2f %7.2f %7.2f %8.0f\n');
  1405.  
  1406.          The '\n' at the end of the SORTPRINT format string is to start a NEW
  1407.          LINE after printing this line.
  1408.  
  1409.       7.3.6 Column Headings
  1410.  
  1411.       For an example of controlling the printing of 'headings' in your TAS
  1412.       output, go to the section describing the pre-defined variable
  1413.       FIRST_TICKER. Using this variable, you can determine when to print a
  1414.       heading initially in your report.
  1415.  
  1416.       In addition, since all variables are initially set to zero before
  1417.       the first TICKER file is processed, you can use a variable to
  1418.       accumulate a "line count". You can test this variable and generate a
  1419.       new heading each time it is greater than the number of lines on your
  1420.       page (e.g. 66). An example of how to place a heading on each page of
  1421.       the report follows:
  1422.  
  1423.            IF FIRST_TICKER OR (LINE_COUNT > 65) THEN
  1424.            BEGIN
  1425.               LINE_COUNT := 0;
  1426.               WRITELN('YOUR REPORT HEADING WOULD GO HERE');
  1427.            END;
  1428.  
  1429.  
  1430.       Then, each time you wrote a line in your script you would execute
  1431.       the statement: LINE_COUNT := LINE_COUNT + 1;
  1432.  
  1433.    7.4 Putting Them Together
  1434.  
  1435.    If the script has the statements:
  1436.  
  1437.              todays_ma := mov(c,21,'E');
  1438.              diff  := c[0] - todays_ma;
  1439.              if diff > 0 then
  1440.                  writeln(TICKER, ' IS ABOVE 21 DAY EMA BY ',diff);
  1441.              else
  1442.                  writeln(TICKER, ' IS BELOW 21 DAY EMA BY ',diff);
  1443.  
  1444.    The script will print out the ticker name followed by the message
  1445.    indicating whether the latest close is above or below the 21 day EMA,
  1446.    and by how much.
  1447.  
  1448.    In this particular example, let's take a closer look at what is going
  1449.    on. In the first line,
  1450.  
  1451.        todays_ma := mov(c,21,'E');
  1452.  
  1453.    we are computing the 21 day Exponential Moving Average of the Closing
  1454.    Price Array. Once computed, we are assigning the latest value of this
  1455.    moving average to the "variable" named 'todays_ma'. You could call it
  1456.    anything you want, but giving it a name that reminds you of what it
  1457.    contains is useful.
  1458.  
  1459.    If you wanted to keep the 21-day EMA in its own array. You could
  1460.    declare the variable as follows (before using it the first time):
  1461.                big_ma_array : ARRAY;
  1462.    This tells TAS that "big_ma_array" is an array of values, not just one
  1463.    value. So, if you now said:
  1464.                big_ma_array := mov(c,21,'E');
  1465.    the contents of big_ma_array would be ALL of the Moving Average values
  1466.    up to the latest day. To refer to the value of the 21 day EMA
  1467.    yesterday, we would write "big_ma_array[-1]" where the "[-1]" refers to
  1468.    the contents of the array "-1" days from now (in other words, one day
  1469.    ago). If you wanted to refer to the 21 day EMA 10 days ago, it would be
  1470.    "big_ma_array[-10]". If you wanted to refer to the latest day's 21 day
  1471.    EMA, it would be "big_ma_array[0]" (zero days ago).
  1472.  
  1473.    The next statement in the example is:
  1474.                diff  := c[0] - todays_ma;
  1475.    which assigns to the variable "diff" the value of the latest closing
  1476.    price, "c[0]", minus the latest 21 day EMA as computed and assigned to
  1477.    the variable "todays_ma" in the previous statement.
  1478.  
  1479.  
  1480.    7.5 Pre-defined Data Arrays
  1481.  
  1482.    The Data Array field is one of the fields within
  1483.    the quote for a symbol. The names of the fields are:
  1484.        Name    Description
  1485.         H      High Price
  1486.         L      Low Price
  1487.         C      Closing Price
  1488.         V      Volume
  1489.         OI     Open Interest
  1490.         O      Open
  1491.  
  1492.    7.6 Pre-defined Values
  1493.  
  1494.       7.6.1 TICKER
  1495.  
  1496.       This is the TICKER name, left justified and padded with blanks to be
  1497.       8 characters long.
  1498.  
  1499.       7.6.2 FULLNAME
  1500.  
  1501.       This is the long name of the symbol, left justified and padded with
  1502.       blanks to be 16 characters long.
  1503.  
  1504.       7.6.3 QUOTE_COUNT
  1505.  
  1506.       This is a pre-defined value which contains the total number of
  1507.       quotes in the current data file.
  1508.  
  1509.       7.6.4 DATE
  1510.  
  1511.       The DATE variable is set to the date of the LAST quote in the file.
  1512.       It is a 'string' variable in the format YYMMDD. For example, if the
  1513.       last quote in the MSP ticker file is for Jan 4, 1991, the value of
  1514.       DATE will be '910104'.
  1515.  
  1516.       7.6.5 FIRST_TICKER
  1517.  
  1518.       This variable is set by TAS. It has a value of 1 (one) if the
  1519.       current ticker being processed is the first ticker for this script.
  1520.       This variable can be used to control the printing of headings for
  1521.       your script output. See the example below:
  1522.  
  1523.          if first_ticker then {write a heading line next }
  1524.            writeln('TICKER\t\tHIGH\tLOW\tCLOSE\tVOLUME\tDATE');
  1525.          { now, for all tickers, write the high,low,close,volume and date }
  1526.          vol := int(v[0]);     { get volume in integer format }
  1527.          writeln(ticker,'\t',h[0],'\t',l[0],'\t',c[0],'\t',vol,'\t',date);
  1528.  
  1529.       The above example will create a report that looks like the
  1530.       following:
  1531.  
  1532.       TICKER          HIGH    LOW     CLOSE   VOLUME  DATE
  1533.       ABX             21.625  21.125  21.625  2315    910103
  1534.       AAPL            44.250  43.000  43.000  13409   910103
  1535.       ARIX            0.625   0.531   0.562   33      910103
  1536.       CMNT            2.500   2.375   2.500   191     910103
  1537.       GR              38.500  37.750  38.000  517     910103
  1538.       SWZ             12.000  11.875  11.875  57      910103
  1539.       LA              13.875  13.375  13.750  2696    910103
  1540.       PCG             25.125  24.750  24.875  5592    910103
  1541.       TX              59.375  58.250  58.625  3899    910103
  1542.       UAL             113.125 111.250 112.000 2354    910103
  1543.       MXTR            5.250   5.000   5.062   2783    910103
  1544.       BP%             8.000   7.625   7.625   658     910103
  1545.  
  1546.    7.7 TAS "POUND" (#) Commands
  1547.  
  1548.    TAS "POUND" commands are used to control special script processing.
  1549.    They must begin with a "pound sign" ('#') in the first column of the
  1550.    line, and they must be completed on the same line.
  1551.  
  1552.       7.7.1 OUTPUT_FILE command
  1553.  
  1554.       You can direct the output of a script to a file by placing an
  1555.       #OUTPUT_FILE command in the script file. The #OUTPUT_FILE command
  1556.       must start in the first column of the line. It should be followed by
  1557.       the output file name surrounded by single quotes.
  1558.  
  1559.       For example,
  1560.  
  1561.            #OUTPUT_FILE 'select.lst'
  1562.  
  1563.       would place the output text of the script into the file
  1564.       'select.lst'.
  1565.  
  1566.       7.7.2 MAX_QUOTES Command
  1567.  
  1568.       You can use the #MAX_QUOTES command to limit the number of quotes
  1569.       read into a script. This value will "override" the MAXIMUM QUOTES
  1570.       you specified in the TAS Configuration Menu, for the script in which
  1571.       it is contained only.
  1572.  
  1573.       The format of the #MAX_QUOTES command is:
  1574.  
  1575.            #MAX_QUOTES nnn
  1576.  
  1577.       where "nnn" is the number of quotes to read into TAS when this
  1578.       script is processed.
  1579.  
  1580.       7.7.3 SCAN_DATE Command
  1581.  
  1582.       You can use the #SCAN_DATE command to force TAS to not process
  1583.       quotes after the date given in the command. This enables you to go
  1584.       back to a prior date and look at what the TAS script would have done
  1585.       on that date.
  1586.  
  1587.       The format of the #SCAN_DATE command is:
  1588.  
  1589.            #SCAN_DATE 'yymmdd'
  1590.  
  1591.       where yymmdd is the year, month, and day of the last quote to be
  1592.       read into TAS before the script is run. Note that you must use
  1593.       single quotes around the date given.
  1594.  
  1595.       7.7.4 PROFIT_TEST Command
  1596.  
  1597.       The #PROFIT_TEST command informs TAS of the type of profit test you
  1598.       want to run, whether you want to test "LONG" or "SHORT" positions,
  1599.       and the amount of "money" you want your position to start with. This
  1600.       command must be placed in the front of the TAS script, prior to any
  1601.       statements which do not begin with a # sign.
  1602.  
  1603.       TAS runs the profit test in two phases. The first phase, called 'PLOT
  1604.       PHASE' is when the script should compute the arrays to be tested during
  1605.       the next phase. This next phase is the 'TEST PHASE'. This phase is
  1606.       entered for the data points of the ticker file. After all data points
  1607.       have been processed, the 'END PHASE' indicator is set. Each 'phase' of
  1608.       the Profit Test process is indicated by a variable being equal to 1.
  1609.  
  1610.       The two phases are analogous to the steps you might run in Metastock
  1611.       to do the Profitability Test. First, you would plot an indicator,
  1612.       moving average, or custom formula. This is similar to the 'PLOT
  1613.       PHASE' in TAS. Next, you would run the Profit Tester specifying your
  1614.       Buy/Sell conditions. Metastock then applies your Buy/Sell signals to
  1615.       each plotted point on the graph, proceeding left to right until it
  1616.       reaches the last day loaded. This is the 'TEST PHASE' in TAS.
  1617.  
  1618.       When the TEST PHASE is entered with the last day of the ticker file,
  1619.       a variable, called 'END_PHASE' is set to 1. Testing this variable
  1620.       will allow you to print out the results for the Profit Test.
  1621.  
  1622.       For each ticker, the script is entered once for the PLOT Phase, and
  1623.       then as many times as there are data points for the TEST Phase.
  1624.  
  1625.       The format of the #PROFIT_TEST command is:
  1626.  
  1627.            #PROFIT_TEST type money
  1628.  
  1629.       where 'type' is either LONG or SHORT (for a "long" position test or
  1630.       a "short" position test) and "money" is the amount of money with
  1631.       which to start the test for each symbol.
  1632.  
  1633.                           NOTE:
  1634.       If you use the PT_BUY, PT_SELL, PT_STOP, PT_PRICE functions, you
  1635.       will need to understand the different phases for the Profit Tester.
  1636.       However, if you use the BUY WHEN, SELL WHEN, STOP ... WHEN and PLOT
  1637.       forms of the Profit Test, you do not need to be concerned about the
  1638.       different Profit Tester phases, since the script generates the
  1639.       appropriate phase testing automatically.
  1640.  
  1641. 8 TAS Script Examples
  1642.  
  1643. Included with the TAS package are several sample .TAS script files. Check
  1644. your directory after you install TAS to see the samples included.
  1645.  
  1646.    8.1 New High/New Low Example
  1647.  
  1648.    The following script is contained in file "NHNL.TAS".
  1649.  
  1650.       8.1.1 Script Contents
  1651.  
  1652.       { NHNL.TAS-
  1653.          This script example will show the 52 week high and low for each
  1654.          ticker. If the current day's high is equal to the highest high
  1655.          or the current low is equal to the lowest low, then we have a
  1656.          probable new high or new low. It might also be the case that today's
  1657.          high or low is just equal to the previous high or low.
  1658.  
  1659.          Just to make the script slightly more interesting, we will also
  1660.          compute the "percentage off from high", a frequently used metric
  1661.          seen in financial tables.
  1662.       }
  1663.       if first_ticker then
  1664.       begin
  1665.          writeln('              - CURRENT -       - 52 WEEK -     OFF');
  1666.          writeln('TICKER       HIGH      LOW     HIGH      LOW    HIGH');
  1667.       end;
  1668.       high_value := HHV(h,52*5);        { compute high over 52 weeks }
  1669.       low_value  := LLV(L,52*5);        { compute low over 52 weeks }
  1670.  
  1671.       off_high_value := ((high_value - c) / high_value) * 100;
  1672.       write(TICKER,' ',h,' ',l,' ',high_value,' ',low_value,
  1673.             '\t',INT(off_high_value),'%');
  1674.  
  1675.       if (high_value <= h) then       { today's high is new high  }
  1676.           write(' New High ');
  1677.  
  1678.       if (low_value >= l) then        { today's low is new low }
  1679.           write(' New Low  ');
  1680.  
  1681.       write('\n');        { end the line with a 'newline'}
  1682.  
  1683.       8.1.2 Script Output
  1684.  
  1685.                     - CURRENT -       - 52 WEEK -     OFF
  1686.       TICKER       HIGH      LOW     HIGH      LOW    HIGH
  1687.       ABX        21.875   21.375   24.750   15.875    13%
  1688.       AAPL       28.000   26.000   50.375   26.000    47% New Low
  1689.       ARIX        1.062    0.938    5.625    0.875    81%
  1690.       BP%        12.500   11.125   14.500    6.000    17%
  1691.       CMNT        2.312    2.188    3.500    2.063    33%
  1692.       GR         32.125   31.875   57.500   29.500    44%
  1693.       SWZ        12.125   11.750   17.500   10.875    32%
  1694.       LA         11.625   10.375   50.375    9.750    77%
  1695.       MXTR        5.625    5.250   16.500    5.250    66% New Low
  1696.       PCG        22.375   22.000   23.500   18.750    4%
  1697.       TX         61.625   60.125   68.500   49.875    12%
  1698.       UAL       110.000   99.000  286.750   87.250    64%
  1699.  
  1700.    8.2 TICKER Symbol Processing
  1701.  
  1702.    The following example shows how you could create a special script to
  1703.    notify you when certain stocks had reached prices you had set. This
  1704.    script is in "LIMIT.TAS".
  1705.  
  1706.       8.2.1 Script Contents
  1707.  
  1708.       { limit.tas
  1709.               This is an example of using a TAS script to watch your
  1710.               stocks.
  1711.  
  1712.               It checks the ticker symbol against one of several
  1713.               which you might (and I do) own. If the current close
  1714.               (shown as 'c[0]' is greater than the limit for profit
  1715.               or less than the stop loss, a message is generated.
  1716.       }
  1717.  
  1718.       stop_loss := 0;
  1719.       sell_profit := 0;
  1720.       if ticker = 'aapl' then
  1721.           if c > 47 then
  1722.               sell_profit := 1;
  1723.           else
  1724.           if c < 41 then
  1725.               stop_loss := 1;
  1726.       if ticker = 'gr' then
  1727.           if c > 43 then
  1728.               sell_profit := 1;
  1729.           else
  1730.           if c < 38 then
  1731.               stop_loss := 1;
  1732.       if ticker = 'la' then
  1733.           if c > 27 then
  1734.               sell_profit := 1;
  1735.           else
  1736.           if c < 10 then
  1737.               stop_loss := 1;
  1738.  
  1739.       if stop_loss = 1 then
  1740.           writeln(ticker, ' has reached your STOP LOSS limit. SELL');
  1741.       if sell_profit = 1 then
  1742.           writeln(ticker, ' has reached your Profit target. SELL');
  1743.  
  1744.    8.3 Directional Movement Example
  1745.  
  1746.    The following script is contained in file "DM.TAS".
  1747.  
  1748.    NOTE : This script will only work with the REGISTERED VERSION of TAS.
  1749.  
  1750.       8.3.1 Script Contents
  1751.  
  1752.       #output_file 'dm.lst'
  1753.       { DM.TAS
  1754.          Wilder's Directional Movement Trading Example
  1755.          This script will indicate
  1756.             a BUY signal
  1757.                if the +DI(14) crosses above -DI(14) and ADXR > 25
  1758.             a SELL signal
  1759.                if the -DI(14) crosses above +DI(14) and ADXR > 25
  1760.       }
  1761.       pdi_array : array;{ declare the +DI (Positive Directional Movement array}
  1762.       mdi_array : array;{ declare the -DI (Negative Directional Movement array}
  1763.  
  1764.       pdi_array := pdi(14);   { calculate +DI}
  1765.       mdi_array := mdi(14);   { calculate -DI}
  1766.       adxr_14 := adxr(14);
  1767.       adx_14  = adx(14);
  1768.       dx_14   = dx(14);
  1769.       if first_ticker then
  1770.       begin
  1771.           writeln('TICKER     ADXR   DX  ADX  +DI  -DI     ACTION');
  1772.       end;
  1773.  
  1774.       write(ticker,'  ',int(adxr_14),
  1775.                 int(dx_14),
  1776.                 int(adx_14),
  1777.                 int(pdi_array[0]),
  1778.                 int(mdi_array[0]));
  1779.       action = '';
  1780.  
  1781.       if (adxr_14 > 25)   then        { AVG DX Rate of Change > 25 }
  1782.       begin
  1783.  
  1784.          if (over(pdi_array,mdi_array) = 0) then
  1785.             action = '** BUY SIGNAL';
  1786.          else
  1787.          if (over(mdi_array,pdi_array) = 0) then
  1788.             action = '** SELL SIGNAL';
  1789.       end;
  1790.       writeln(action);
  1791.  
  1792.       8.3.2 Script Output
  1793.  
  1794.       TICKER     ADXR   DX  ADX  +DI  -DI     ACTION
  1795.       AA           33   28   33   25   14
  1796.       ALD          22   15   22   30   22
  1797.       AXP          34   59   34   39   10
  1798.       T            30   41   30   29   12
  1799.       BS           26   42   26   32   13
  1800.       BA           22    8   22   27   23
  1801.       CHV          17    4   17   27   29
  1802.       KO           27   49   27   32   11
  1803.       DD           21   23   21   29   18
  1804.  
  1805.    8.4 Modified "Binary Wave"
  1806.  
  1807.    The file "SELECT.TAS" contains a rather lengthy script which contains
  1808.    the logic for computing a 6 point "binary wave". The first 4 "points"
  1809.    of the wave are those described in the "MetaStock User's Manual" in
  1810.    Chapter 7, section 7.7.2 "Example Binary Waves".
  1811.  
  1812.    The final 2 points of the "binary wave" are included to show how you
  1813.    can extend the original example to compute additional indicators
  1814.    (Chaikin's Oscillator and Commodity Channel Index) which are used to
  1815.    further refine the selection.
  1816.  
  1817.    Since the file is large, it is not included in this documentation, but
  1818.    the file is included in the TAS package.
  1819.  
  1820.    NOTE : This script may only work with the REGISTERED VERSION of TAS.
  1821.  
  1822.    8.5 Profit Test Example Using RSI(14)
  1823.  
  1824.    The TAS Script file 'RSIPT.TAS' shows a Profit Test using the 14-day
  1825.    RSI.  It serves as an example of the kind of profit testing available
  1826.    with TAS/PT.
  1827.  
  1828.    NOTE : This script may only work with the REGISTERED VERSION of TAS/PT.
  1829.  
  1830.       8.5.1 Script Contents (RSIPT.TAS)
  1831.  
  1832.       {
  1833.               RSIPT.TAS
  1834.                       RSI PROFIT TEST SCRIPT EXAMPLE
  1835.                       This script will signal a SELL when the
  1836.                       RSI(14) crosses under 'rsi_upper' and a BUY when
  1837.                       RSI(14) crosses above 'rsi_lower'.
  1838.       }
  1839.       #PROFIT_TEST LONG 1000          { long positions with $1000}
  1840.       #MAX_QUOTES 300                 { only read in 300 quotes }
  1841.       #OUTPUT_FILE 'RSIPT.LST'        { assign output listing to rsipt.lst}
  1842.  
  1843.       RSI_VALUES : ARRAY;             { array containing plotted points }
  1844.       RSI_UPPER := 75;                { Upper range of RSI - point to SELL
  1845.                                         Change this if
  1846.                                         you want to test different value}
  1847.       RSI_LOWER := 50;                { Lower range of RSI - point to BUY
  1848.                                         Change this if
  1849.                                         you want to test different value}
  1850.  
  1851.       PLOT BEGIN      { This begins the "plot" of the RSI }
  1852.           RSI_VALUES := RSI(14);  { COMPUTE THE RSI(14) PLOT }
  1853.       END;
  1854.  
  1855.       BUY WHEN RSI_VALUES[-1] < RSI_LOWER AND RSI_VALUES > RSI_LOWER;
  1856.  
  1857.       SELL WHEN RSI_VALUES[-1] > RSI_UPPER  AND RSI_VALUES < RSI_UPPER;
  1858.  
  1859.       8.5.2 Script Output
  1860.  
  1861.               Technical Analysis Scanner (TAS) Profit Test
  1862.                       Wed Jan 23 16:04:23 1991
  1863.  
  1864.               3COM (COMS) From 02/21/90 To 01/22/91
  1865.               Initial Cash $ 1000.00. (Long Positions Only)
  1866.  
  1867.                                                       Trade    Total
  1868.         Date   Action  Shrs   Price  Points    Cash   Profit   Profit
  1869.       ------- -------- ---- -------- ------ -------  -------  -------
  1870.       04/06/90 Buy       75  13.250   0.000    6.25     0.00     0.00
  1871.       06/18/90 Sell      75  16.375   3.125 1234.38   234.38   234.38
  1872.       11/02/90 Buy      170   7.250   0.000    1.88     0.00   234.38
  1873.  
  1874.                      Summary for COMS
  1875.                              Long           Short            Total
  1876.       ---------------------------------------------------------------
  1877.        Trades                 2               0               2
  1878.        Profitable             1 ( 50.00%)     0 (  0.00%)     1 ( 50.00%)
  1879.        Stops                  0               0               0
  1880.        Profit $          234.38            0.00          234.38
  1881.        There is a Long Position which is still open.
  1882.        If it were liquidated at today's price of  6.375,
  1883.        the profit would be $   85.62
  1884.  
  1885.               Technical Analysis Scanner (TAS) Profit Test
  1886.                       Wed Jan 23 16:04:30 1991
  1887.  
  1888.               APPLE (AAPL) From 01/18/90 To 01/22/91
  1889.               Initial Cash $ 1000.00. (Long Positions Only)
  1890.  
  1891.                                                       Trade    Total
  1892.         Date   Action  Shrs   Price  Points    Cash   Profit   Profit
  1893.       ------- -------- ---- -------- ------ -------  -------  -------
  1894.       03/01/90 Buy       29  34.250   0.000    6.75     0.00     0.00
  1895.       03/20/90 Sell      29  41.375   7.125 1206.62   206.62   206.62
  1896.       05/07/90 Buy       29  41.500   0.000    3.12     0.00   206.62
  1897.       12/10/90 Sell      29  41.750   0.250 1213.88     7.25   213.88
  1898.  
  1899.                      Summary for AAPL
  1900.                              Long           Short            Total
  1901.       ---------------------------------------------------------------
  1902.        Trades                 2               0               2
  1903.        Profitable             2 (100.00%)     0 (  0.00%)     2 (100.00%)
  1904.        Stops                  0               0               0
  1905.        Profit $          213.88            0.00          213.88
  1906.  
  1907.  
  1908.  
  1909.                      Summary for ALL SYMBOLS
  1910.                              Long           Short            Total
  1911.       ---------------------------------------------------------------
  1912.        Trades                 4               0               4
  1913.        Profitable             3 ( 75.00%)     0 (  0.00%)     3 ( 75.00%)
  1914.        Stops                  0               0               0
  1915.        Profit $          448.25            0.00          448.25
  1916.        Profit (Including Open Positions) $               299.50
  1917.  
  1918. 9 TAS Change History
  1919.  
  1920.    9.1 Version 1.4
  1921.  
  1922.         -    Set size of INTEGER output to 5 characters, left-justified
  1923.  
  1924.         -    Set size of REAL numbers to 8 characters, left-justified
  1925.  
  1926.         -    Fixed problems with complex function nesting
  1927.  
  1928.         -    Round values of Directional Movement Indicator suite to integer
  1929.              values
  1930.  
  1931.         -    Fixed problem with declared arrays being reused for intermediate
  1932.              temporary arrays.
  1933.  
  1934.    9.2 Version 1.5 - Jan 11, 1991
  1935.  
  1936.         -    Added OBV(), PVI(), NVI(), NEG(), CUM() functions
  1937.  
  1938.         -    Fixed problem which occurred if a WRITE was called with a
  1939.              parameter which is a function returning an array. Always
  1940.              printed the address of the array rather than the last entry
  1941.              of the array.
  1942.  
  1943.         -    Fixed zero divide problem which occurred sometimes in ROC()
  1944.              function.
  1945.  
  1946.    9.3 Version 1.6 - Jan 14, 1991
  1947.  
  1948.         -    Added #OUTPUT_FILE command to allow writing script output to
  1949.              a file.
  1950.  
  1951.         -    Added #MAX_QUOTES command so that the Maximum Number of
  1952.              Quotes specified in the Configuration Menu can be over-ridden
  1953.              for individual scripts.
  1954.  
  1955.         -    Fixed inconsistencies in some of the 'tab' formatting between
  1956.              the trial version and registered version.
  1957.  
  1958.    9.4 Version 1.7 - Jan 17, 1991
  1959.  
  1960.         -    Added #SCAN_DATE command to stop loading data after a
  1961.              specific date.
  1962.  
  1963.         -    Added LINREG() 'Linear Regression' function, SLOPE() function
  1964.              and CORRCOEF() function.
  1965.  
  1966.    9.5 Version 2.0 - Jan 19, 1991
  1967.  
  1968.         -    Added #PROFIT_TEST command. This included variables
  1969.              PLOT_PHASE, TEST_PHASE, END_PHASE and LAST_TICKER. Added
  1970.              Profit Test functions PT_INIT(), PT_BUY(), PT_SELL(),
  1971.              PT_STOP(), and PT_TOTAL().
  1972.  
  1973.         -    Corrected errors in beginning of Exponential Moving Average
  1974.              and MACD array calculation.
  1975.  
  1976.         -    Added Functions ANGLE() and VOL()
  1977.  
  1978.    9.6 Version 2.1 - Jan 26, 1991
  1979.  
  1980.         -    Fixed several problems with the TAS Script Editor. Added the
  1981.              ability to 'split' a line by hitting ENTER when in INSERT
  1982.              mode.
  1983.  
  1984.    9.7 Version 2.2 - Feb 2, 1991
  1985.  
  1986.         -    Reworked PROFIT TEST features for ease of use. Added BUY/SELL
  1987.              WHEN, PLOT BEGIN...END; Removed requirement for directly
  1988.              calling the PT_xxxx functions.
  1989.  
  1990.         -    Simplified expression syntax by making AND and OR operators
  1991.              lower precedence than Relational Operators. This removes
  1992.              nearly all requirement for parentheses in statements.
  1993.  
  1994.         -    Allow '=' (equal sign) to be used for Assignment.
  1995.  
  1996.         -    Remove requirement to follow IF statement with THEN.
  1997.  
  1998.         -    Added CHARTPRO support.
  1999.  
  2000.    9.8 Version 2.3 - Feb 6, 1991
  2001.  
  2002.         -    Fixed bug in Profit Test which miscomputed the last day's
  2003.              closing price if the position was "open" at the end of the
  2004.              run.
  2005.  
  2006.         -    Made change to Wilder's RSI calculation to bring it closer to
  2007.              the Metastock calculation.
  2008.  
  2009.         -    Removed "beep" at end of TAS Run. Changed message to show
  2010.              successful run.
  2011.  
  2012.    9.9 Version 2.4 - Feb 12, 1991
  2013.  
  2014.         -    Added "Build or Run Selection" screen.
  2015.  
  2016.         -    Modified expression analyzer to allow mixing arrays and real
  2017.              values in an expression.
  2018.  
  2019.    9.10 Version 2.5 - Feb 15, 1991
  2020.  
  2021.         -    Added ability to include the heading in the PRINT function of
  2022.              the SELECTION RUN screen. Also added option to append to the
  2023.              file or replace it when printing.
  2024.  
  2025.         -    TICKER LIST menu now shows tickers sorted in alphabetical
  2026.              order.
  2027.  
  2028.    9.11 Version 2.6 - Feb 17, 1991
  2029.  
  2030.         -    Added RUN WINDOW which shows status of scanning operation.
  2031.              SCAN/RANK output goes to upper window, status output goes to
  2032.              lower window.
  2033.  
  2034.         -    Added PAUSE during run. If you type any keystroke while TAS
  2035.              is scanning a ticker, it will stop at the next ticker and
  2036.              wait for you to type another key.
  2037.  
  2038.    9.12 Version 2.7 - Feb 18, 1991
  2039.  
  2040.         -    Found bug in ADXR calculation. Previous versions are
  2041.              incorrect with this indicator. Optimized Directional Movement
  2042.              indicator computation so that they run at twice the previous
  2043.              speed.
  2044.  
  2045.         -    Added SORTOUT, SORTON, and SORTPRINT functions to allow
  2046.              sorting report output.
  2047.  
  2048.         -    Added PEAK and TROUGH functions to locate price peaks and
  2049.              troughs.
  2050.  
  2051.         -    Added "CHECK SCRIPT" key (F4) to EDITOR. This key will check
  2052.              the script for syntactical errors.
  2053.  
  2054.    9.13 Version 2.8 - Feb 21, 1991
  2055.  
  2056.         -    Fix problem in RSI where there are nothing but 'inside days'
  2057.              in the period.
  2058.  
  2059.         -    Place floating point error message in run window
  2060.  
  2061.         -    Remove requirement to have leading zeros in front of decimal
  2062.              numbers (like .02, .20, etc instead of 0.02, 0.20).
  2063.  
  2064.    9.14 Version 2.9 - Feb 23, 1991
  2065.  
  2066.         -    Added ALT-X Key to EXIT TO DOS. This key can be used whenever
  2067.              TAS is expecting keyboard input.
  2068.  
  2069.         -    Added Wilder's Parabolic Time/Price System (sometimes known
  2070.              as 'Parabolic SAR'.
  2071.  
  2072.    9.15 Version 2.91 - Feb 27, 1991
  2073.  
  2074.         -    Found bug in memory free routine which was eating memory each
  2075.              time a script was run. This caused about 26K to be "lost"
  2076.              each time the script was run. Eventually led to "out of
  2077.              memory" condition. Problem fixed. Memory stays constant from
  2078.              script to script.
  2079.  
  2080.         -    Fixed bug in PROFIT_TEST SHORT where both long and short
  2081.              positions were being entered when the test should only have
  2082.              been short positions.Added Wilder's Parabolic Time/Price
  2083.              System (sometimes known as 'Parabolic SAR'.
  2084.  
  2085.         -    Changed screen colors in the TICKER LIST SELECTION screen so
  2086.              that the selected tickers show up on a monochrome display.
  2087.