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.
As we’ve 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 Mechanica’s progress, one price data file at a time:
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-day—which is what the Signal Rules do—to 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.
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 database—and accumulate and report this pertinent information—day-by-day.
Next, trades from all systems are processed day-by-day, using the Position Sizing Rules.