Navigation: <Root level>

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 three forms of Imported Trade List: standard, AmiBroker, and IB Flex (or other transaction lists).

For information about using AmiBroker trade lists, see Importing AmiBroker Trades.

For details about the IB Flex format, see Importing IB Flex Query Output.

The remainder of this topic describes the standard format.

Note also that multiple trade-list-based strategies can be combined in one script and any mixture of the above types can be included.


To be used with RealTest, your list of trades must be formatted as an ASCII CSV file with the following columns:

Column

Required?

Description

Symbol

yes

the symbol of the stock or contract traded

Strategy

yes

the name of the strategy to which the trade belongs

Side

no

1 for long, -1 for short, 0 for both (side determined by sign of quantity)

DateIn

yes

date the position was entered (can be any date format with month before day)

QtyIn

no

number of shares or contracts bought or shorted

PriceIn

no

average price per share of the entry transaction

FeesIn

no

total commission paid for the entry transaction

DateOut

no

date the position was exited (can be any date format with month before day)

QtyOut

no

number of shares or contracts sold or covered

PriceOut

no

average price per share of the exit transaction

FeesOut

no

total commission paid for the exit transaction

Columns can be in any order, and most of them are not required. There must be a header row containing these specific column names, to tell RealTest which columns you are providing and in what order.

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:

 

Your trade list file can include all of the trades from any number of strategies.

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

 

It is fine to have more than one trade in the same symbol on the same date. For example, if you entered a full position but then exited half on one date and half on another date, you would want that to appear as two rows in your trade list -- one for each half position -- and they'd both have the same values for Symbol, Strategy and DateIn.

Assuming that your trade list includes all of the above columns, it can be "run" as a backtest using the simplest possible strategy definitions:

The only requirement is that the strategy names in the script match the strategy names in the trade list (case does not matter).

 

Running the above script with the above trade list file (after importing data for all the included symbols) produces this results line and equity graph:

(Yes, I hand-picked a very good period for a couple of my strategies.)

 

To the extent that your trade list is missing columns and/or you want to test alternative rules, you must provide additional strategy elements. When a mix of imported trade information and strategy formulas are used, the formulas will override the existing trade data where applicable.

For example, here is the above script with a couple of elements changed for each side:

The results now look like this (not quite as good):

Comparing the trade lists from the two tests, we can see the modified position sizes:

 

Scrolling theses lists to the right, we can also see where some of the exits are now due to the newly added stop rules:

(and, as it happens, these first two instances were made worse by the addition of a stop rule)

 

The second example of using an imported trade list, actual_entries.rts, shows how partial trade information can still be used as a strategy input.

In this case, only the entry portion of every trade is included in the actual_entres.csv trade list file:

 

The script makes up for the lack of exit information by providing exit rules:

As you can see, the imported trade list mechanism provides many different ways to work with a set of live trade records.

 

 

 

 

 

Copyright © 2020-2021 Systematic Solutions, LLC