Synopsis of Trade Processing

Top  Previous  Next

 

Learning how Mechanica process trades will clarify the material in the next section, and cement some of the concepts already covered.

 

Signal Rules

As weve discussed, the Signal Rules are responsible for trade generation during backtesting.

When a SIG file is run (choose Run Signal Rules from the Signals menu), Mechanica (a) opens the first historical price data file in the portfolio, (b) reads it from top to bottom, from the earliest date to the most recent, (c) applies the Signal Rules to generate the trades, (d) writes all pertinent information to an internal database file, and (e) closes the price data file. Then it moves on to the next symbol, and the next, until it has processed all trades for all symbols in the portfolio. This is a serial process, and it is reflected in the application status bar when the Signal Rules are run. There, you can view Mechanicas progress, one price data file at a time:

 

Position Sizing Rules

By contrast, when a SIZ file is run (choose Run Position Sizing Rules from the Position Sizing menu), it reads through the trade database day-by-day, searching for new trades to size, and open trades to resize, according to the rules you have defined. At this stage, Mechanica makes the transition from accumulating information stored symbol-by-symbol, day-by-daywhich is what the Signal Rules doto accumulating information related to the current status of literally…everything (starting with various equity figures and numerous categories of risk, and ending with trade performance statistics) ...read sequentially day-by-day for all markets.

 

Trade Processing Summary

The Signal Rules read all symbols in the portfolio one file at a time, and write all pertinent information to a trade database. The Position Sizing Rules read all pertinent information for all trades in the trade databaseand accumulate and report this pertinent informationday-by-day.

ThumbTack white

With regard to the behavior of trade processing during Simultest (which allows multiple systems to be tested at once), the Signal Rules code processes all the price data files in the portfolio assigned to System 1, one price data file at a time, and then moves on and repeats the process with the next system, and the next, until all the price data files (symbols) for all systems have been processed.

Next, trades from all systems are processed day-by-day, using the Position Sizing Rules.