Mechanica Basic -- Language Reference

Top  Previous  Next

 

Features

Mechanica Basic is a superset of Trading Basic, the language that was used in the predecessor application, Trading Recipes.  New features include user-named variables and user-named columns.  These make your code much more readable and easier to follow.  Also there is a cool feature called X-Ray that provides Grid style debug functionality for position sizing, resizing and portfolio level issues.

Upgrading from TR

For many users Mechanica represents an upgrade from TR.  Most of TR's keywords remain intact in Mechanica and most of those that have changed will be automatically re-formatted / corrected for use in Mechanica the first time an old .GO file is loaded.  For some words it was not possible to provide this convenience and when Mechanica encounters one of them a syntax error message will be issued.

Mechanica lets you open old style .GO files but remember, once you save them, they will have the file extensions .SIG for signal code and .SIZ for position sizing code.  Extension .GO is not used by Mechanica.

TR code for position sizing (money management) that previously resided on the Trade in Progress page of TR should be cut and pasted into the Initial Size tab of Mechanica.  A few words such as MULTIPLIER have moved to a different "page" / tab (the Resize tab in this case) and those must be manually placed on an individual basis. For new usage in these few cases please see help under the "Where Legal" heading for the specific word.

Batch processing [link]

Once you've become familiar with Mechanica you will probably find that batch.sig files are indispensable.  They are key to automating your own processes and will make your research more organized and your order generation more reliable.

 

The following sections describe Mechanica Basic in detail:

SIG

Signal Rules

SIZ

Sizing Rules

Calendar

Date related

Memory and Storage

Variables and Functions

Operators / Logical

Other Language Elements