To Set Up And Run A Simulation

Top  Previous  Next

 

A two-step process

Running a simulation in Mechanica is always a two-step process. Signal Rules files are run first, to generate your system’s trades. Then, the Position Sizing Rules are run.

The Rules Editor (shown below), is a full-featured Windows text editor with built-in syntax checking. This is where you will create and modify Signal Rules and Position Sizing Rules files.

Signal Rules files include information about technical indicators to be applied (these definitions usually reside on the Resources page), as well as rules for trade entry, trades in progress and trade exit.

Position Sizing Rules files contain instructions for applying various position sizing and resizing strategies to the trades that were generated when the Signal Rules were run. Such code resides either on the Initial Size page, or on the Resize page, depending on what you are trying to accomplish.

Signal Rules

Signal Rules files contain all the Mechanica Basic code that governs trade entry, trades in progress, and trade exit. When you run a Signal Rules file, you are telling Mechanica to generate the trades for your system, according to the rules you have written.

1From the File menu, open a system by choosing Open, Signal Rules.

A number of sample systems are provided for your convenience. They are located in the ..\Mechanica\Sample_Rules directory. The system code will appear in the Rules Editor when a file is opened.

2.Or...use the multi-page, tabbed Rules Editor (shown above) to enter a system yourself using the Mechanica Basic language.
3From the Data menu, open the Symbol Manager and select the desired Data Page(s), and then, under the Tag Symbols tab, check the various symbols you wish to test.
4Specify the years the simulation is to cover, using the STARTDATE and ENDATE commands (on the Initial Size page of the Rules Editor).
5Click the close button (or press Ctrl + F4) to close the Symbol Manager.
6Choose Run Signal Rules from the Signals menu to run the Signal Rules portion of the test. This instructs Mechanica to process the trades for your system, according to the Signal Rules you have written.

7Alternately, you can click on the Run Signal Rules icon on the Signal toolbar (shown above).

 

Viewing results: Signal Rules

1Once the Signal Rules have been run, you can inspect indicator values and custom formulas in the spreadsheet-style Grid display, located in the Signal Results window. Then, press F11 to view a Signal Chart of the current symbol, or F12 to view a Quick Chart (list of Signal Charts available). These charts are also available from the Signals menu, and on the Signals toolbar (shown).

 

Position Sizing Rules

After you have generated all the trades for your system(s) by running the Signal Rules, then run the Position Sizing Rules to study various position sizing and resizing strategies.

1Open a Position Sizing file by choosing Open, Position Sizing Rules from the File menu.
2Again, a number of sample systems are provided for your convenience. They are located in the ..\Mechanica\Sample_Rules directory.
3Press Alt–P, R to run the Position Sizing Rules.
4Alternately, you can run this portion of the simulation by choosing Run Position Sizing Rules (on the Position Sizing menu), or by clicking on the Run Position Sizing Rules icon on the Sizing toolbar.

 

Viewing results: Position Sizing Rules

After the Position Sizing rules have been run, a number of statistical and graphical reports are available to assist you in evaluating your system's potential.
These studies are located at the bottom half of the Position Sizing menu, and are shown highlighted (below).