Navigation: Analyzing Test Results >

Using an Imported Trade List





RealTest makes it easy to define a strategy based on a list of specific trades.

Reasons to do this might include:

Analyzing the results from a period of live trading (whether systematic or discretionary)

Seeing if you could have done better using different exit rules, position sizing, entry skip criteria, etc.

Comparing actual vs. backtest results for a strategy or set of strategies

RealTest supports two kinds of trade lists: transactions or round-trip trades.

Transaction lists are things like IB Flex Query output, where each row only specifies a single transaction (e.g. BUY 100 MSFT). RealTest automatically sorts the transaction list by symbol then date and time, and converts it to a round-trip trade list for use in a backtest.

Round-trip trade lists include one row per round-trip trade, with both the entry and exit details included.

In either case, the trade list file must be in standard CSV format, where the field delimiters are commas and decimal points are periods.

To use a trade lists of either kind, you must provide a definition of what is in each column.

See TLFields for details on what columns can be used and how to specify their layout. (The header row of the CSV file is ignored and is not required.)

See TLAdjusted and TLTimeShift for other settings related to trade lists.

As an example, see actual_trades.csv in the Examples folder, the first few rows of which look like this in a text editor:

or like this in Excel:

A trade list file can include all of the trades or transactions from any number of strategies.

The example script actual_trades.rts shows how to use this file.

This example includes two strategies, called "Longs" and "Shorts" (the above screen shots happen to only include long trades).

To "run" this trade list as a backtest that produces separate stats for each side plus combined stats, the example defines two strategies:

The Template mechanism was used to avoid having to repeat the file path and field map.

This example script contains sample templates for several known trade and transaction list formats, which can be copied in to your own scripts as needed:


Symbol Changes

If a file named symchanges.csv is found in the RealTest directory, it is loaded and used to map symbols found in trade lists to what they currently are in your data file.

This file has just two columns: old symbol, new symbol as in this example (it doesn't matter what the columns are called, just that they're in this order):

Using this file saves you from having to edit every individual trade list before importing it.


Overlaying Trading Rules

In addition to simply "backtesting" a list of trades to generate stats and graphs or look at charts, you can also experiment with adding strategy elements to override the entry or exit rules or position sizes of the trades.

As a simple example, try adding "EntrySkip: C > 50" to the strategies in this example script, then re-running it. You'll see that this reduces the trade count by about half, and lowers the expectancy somewhat.

To override the position sizes in an imported trade list, add both a Side specification and a Quantity formula to each strategy.

To test different exit rules, simply add them to the strategy.

Note that adding any exit formula (ExitRule, ExitLimit or ExitStop) to a TradeList strategy disables the exits from the trade list.





Copyright © 2020-2022 Systematic Solutions, LLC