|Top Previous Next|
Mechanica Basic—like Trading Basic before it—is an easy-to-learn, high-level programming language. Even with little or no previous programming experience, you should be up and running by the time you finish the tutorial. And of course, you can select the indicators for your systems from a list of popular, pre-defined technical studies, including RSI, %R, stochastics, volatility, moving averages, and many others.
Although Mechanica employs a familiar, intuitive Windows interface, the heart of its functionality remains language-driven, for the ultimate in flexibility and power.
The Mechanica Basic library has been expanded to include many new commands and functions, including user-named variables and grid column aliases, along with improved text editing, syntax checking, and automatic translation of most altered legacy keywords.
Indicator values can be displayed in columns in the Grid—a spreadsheet-style trade verification and debugging tool—for easy reference. User-named variables are easy to declare, and are compatible with existing variable types. (All numerical variables in Mechanica are of the double-precision type.) And you can now assign aliases to the column definitions that appear in the Grid, and reference and assign values to them directly in your code, as you would any other variable.
Grid column aliases and user-named variables make your code clearer and easier to understand.
Apply Mechanica Basic to specify your trading and position sizing rules. It’s the heart of the power of Mechanica, and much of what you will end up coding in practice is no more difficult than the examples shown below.
Have column 1 hold target values for long trades--in this case, the 50-day high:
COL1 = MAX[HIGH,50,0]
Here’s our entry signal: We’re going to enter a long trade on the open today, if yesterday's high equals the value of column 1 yesterday:
IF HIGH = COL1 THEN BUYOPEN
Coding an exit signal is just as easy.
User-named variables provide global storage for numerical values or other variables, and are easily declared:
VAR = MY_FAVE_VAR
COL1 = HIGH
COL2 = LOW
MY_FAVE_VAR = (COL1 – COL2) / 2
Once a user-named VAR is declared, it is legal and accessible from any page.