Portfolio Boss Documentation

Exporting the Backtest Results

 

 

It's possible to export the strategy's backtest results (statistical reports) as spreadsheets, which can then be viewed with Microsoft Excel, Google Sheets, and other such program. The resulting reports are usually much more detailed than what's seen in Portfolio Boss, though more confusing.

To export the backtest results, click the “Export” button at the top of the Backtest Strategy Page.

 

 

That button is only clickable once the strategy is backtested (press the button for manual/standard backtest).

Now, the dialog “Export Backtest Results” shows up, which allows you to choose which report to export. These reports are generally similar to the ones you see on the MetricsPerformance, Positions, and History Tabs.

 

 

As you see above, there are six types of report you can export (each will be discussed in the following sections):

  • In-depth trade history, monthly & yearly performances (Excel file),
  • Trade history (positions),
  • Trade history (trading dates),
  • Monthly performance,
  • Yearly performance, and
  • Backtest vs. benchmark comparison.

Select one type, then press the “Browse” button to define the location you want to save the file into:

 

 

By default the export folder is at “My Documents”, specifically %UserProfile%\Documents\PortfolioBoss\Backtests , though you can define it from the File Explorer window that pops up:

 

 

You can then give the file any name you wish, and press “Save”. This does not create the file, yet. To actually export the file, press the “Export” button on that dialog:

 

 

Tick the checkbox “Open file after export” to open the file immediately after it's exported; it'll be opened with Microsoft Excel if you have it installed, or with Windows's Notepad. The resulting file has the format “.CSV” (Comma-Separated Values), except the topmost-type which has the format “.XLSX” (Microsoft Excel):

 

 

Now about the “Field Delimiter” section, it only appears when you select the CSV types:

 

 

It allows you to choose the character to separate the values/data. You can choose either semicolon (;), comma (,) or tab (whitespace) here.

 

 

The separator you choose here isn't that important, as the file looks jumbled anyway (unless, you're planning to feed these data into some other programs/script). Even if you have Microsoft Excel, the CSV files don't look good except when you use comma as separator. But there's a perfect solution to view the XLSX or CSV files, and that is the Google Sheets (it's free!). Look at the video below on how to view the files with Sheets:

 

 

Let's now discuss each export (report) type from top to bottom as shown on that “Export Backtest Results” dialog:

 


 

1.  In-depth trade history, monthly & yearly performances (Excel file): this export type has the most complete data. It creates an .XLSX file containing three worksheets:

 

 

  • Trade History: this sheet shows the entire history of the backtest, that is, the Positions held each and every day, complete with their entry & exit prices, weights, and gains. There's also the strategy's percentage profit and total account size each day. Let's discuss the columns on this sheet:

    • Trading date: the date of each trading session, excluding weekends/holidays. Each date contains a number of Positions based on Total Positions to Hold, but Positions exited at that date will also be included.
    • ID: the identifier for each Position. Each Position entered has a unique ID, and this ID won't be used by other Positions at other dates.
    • Symbol: the ticker symbol for each Position. Sometimes you see “Cash” here too if your strategy uses Cash and/or Limit Orders.
    • Position type: whether the Position is long (bought) or short (short-selling).
    • Position weight @ open: the Positions' weight at the day's market open. It's also the Position's weight when entered and exited. These are a factor of 1 (raw percentage divided by 100).
    • Adjusted close: the adjusted closing price of the instrument on that date.
    • Entry price @ open: this shows the entry price for each Position (could be the day's opening price or the Buy Limit price). It uses adjusted price. Non-empty cells on this column denote freshly entered Positions.

    • Exit price @ open: the exit price for each Position (could be the day's opening price or the Sell Limit price). It uses adjusted price. Non-empty cells on this column denote Positions exited at this day.
    • Position weight @ close: the Positions' weight at the day's market close. Those Positions exited at this day have a weight of 0. It's a factor of 1, as usual.
    • Symbol gain: the instrument's gain, i.e. the change in the instrument's closing price today vs yesterday. If the Position is exited today, it uses the exit Price.
    • Position gain: this is the amount of money the Position has gained/lost since yesterday's close, in relation to/in percentage of the total account size yesterday. It takes into account the Position's exit price, if it's exited today. Therefore the aggregate “Position gain” for all today's Positions (including those exited), equals the total amount of money your account gained/lost since yesterday, shown in the next column.
    • Daily gain: it's simply the percentage gain/loss of the account size between this day and the previous day.
    • Compounded daily gain: the percent gain of the strategy from the beginning of the backtest period up to this day's close. Put another way, it's the dollar profit up to this day (in percent). It's what you see on the Chart Tab (backtest's equity curve) but minus 100% (because it's the “gain”, not the current account size).

    • Portfolio amount: this is the current account size (portfolio size) at this day's close, in dollar value. You won't see this column populated unless you set a value to the property “Initial amount” (on the Backtest Panel) before the backtest is executed.

 

  • Monthly Performance: This sheet shows the gain/loss for every month of the whole backtest period, similar as in the Performance Tab.

    • Month: this column shows all the months (and their year), from the beginning of the backtest period to the latest date.
    • Gain: the percent gain/loss of each month, calculated from the total account size at the previous month's end (last day's market close) to this month's end. Note, the latest month is usually incomplete (no last day yet), so its end date is the latest available date. Ditto the earliest month doesn't usually start at its first trading day, so it's calculated from the earliest available date (the start of the backtest period).
    • Compounded gain: the total gain of the strategy from the beginning of the backtest period up to the end of each month, in percent of the initial capital. Note, this is the total profit (or loss), not the current account size.

 

  • Yearly Performance: This sheet shows the gain/loss for every year of the whole backtest period, similar as in the Performance Tab.

    • Year: shows all the years during the whole backtest period.
    • Gain: the percent gain of each year, calculated from the account size at previous year's end to this year's end. The latest and earliest years usually aren't whole years, so their gain is calculated from the dates available to them.
    • Compounded gain: the total gain of the strategy from the beginning of the backtest period up to the end of each year, in percent of the initial capital.

 


 

2.  Trade history (positions): this CSV file lists all the distinct Positions entered by the strategy, instead of the day-by-day Positions history as in the previous export type. Here you'll see the Positions' entry and exit dates, prices, weights, and their total gain.

 

 

One row here is occupied by one distinct Position. These Positions aren't limited to the usual stock/ETF and Cash Equivalent Positions, but includes the Cash Positions as well (the “Total Positions” metric, as shown on the Metrics Tab and Stats Tab, excludes the Cash Positions). There are also Positions not yet closed (exited), i.e. those at the latest backtest date. Now let's see what columns we have here:

  • Position ID: this is the identifier of each distinct Position. Positions with the same symbol (but entered at different dates) have different IDs. The ID starts from 1, and the later a Position is entered, the bigger its ID. The entire Position list here is sorted by this ID (hence by the date they're entered).
  • Symbol: the ticker symbol of each Position, including “Cash”. Those with number-suffix within square brackets indicate currently delisted instruments (the number shows how many times they've been delisted).
  • Position type: indicates whether the Position is a long-position (bought) or a short-position (short-selling).
  • Open: the entry price for each Position (adjusted price). Usually these are the market's opening prices, but could be Buy (or Short) Limit prices as well, i.e. if the limit price is lower (for buying) or higher (for shorting) than the opening price.
  • Open date: the date the Positions were entered.
  • Open weight: the weight of the Positions when they were entered.
  • Close: the exit price for each Position (adjusted price). Usually these are the market's opening prices, but could be Sell (or Cover) Limit prices as well, i.e. if the limit price is higher (for selling) or lower (for covering) than the opening price. For those Positions not yet exited (those at the latest backtest date), their “Close” price here is the market's closing price.
  • Close date: the date the Positions were closed (exited).
  • Close weight: the weight of the Positions when they were exited.
  • Gain: the gain/loss of each Position from entry to exit. Those Positions not yet exited have the latest date's closing price to gauge their gain, since they don't have exit prices yet.

 


 

3.  Trade history (trading dates): this is the simplified version of the “In-depth trade history” sheet we discussed earlier. In this CSV file you'll see the Positions held every day, along with their weight, gain, and the action/signal when they will be closed.

 

 

  • TradingDate: this column shows all the trading dates, for the whole backtest period. Each date usually occupies multiple rows, for multiple Positions held on that date.
  • Symbol: the ticker symbol of each Position. Cash and Cash Equivalent symbols (e.g. SHY) are listed only once in a given date, even if there are multiple such Positions on that date; there's no grouping indicator (suffix) whatsoever.
  • Position type: whether the Position is long (bought) or short (shorted).
  • Position weight: the weight of each Position at the day's close (or when the Position was exited).
  • Gain: the instrument's gain/loss, based on yesterday's closing price and today's closing price (or the exit price, if the Position is exited).
  • Action: the action the strategy will do for each Position at the next trading day. Mostly it's “Hold”, but sometimes you'll see exit actions as well (Sell, Limit Sell, Cover, Limit Cover, or Exit for Cash Positions). Keep in mind these are not trading signals.

 


 

4.  Monthly performance: this CSV file shows the monthly gain for the whole backtest period. Unlike the “Monthly performance” sheet we discussed earlier, we don't have the “Compounded gain” shown here (percent profit from backtest start-date to each month's end). Instead, we have monthly gain comparison between the strategy and its benchmark.

 

 

  • Month: this column shows all the months in the backtest period; but instead of the months' name, we have the months' last trading date. Each row is occupied by each month. Note, the latest month usually hasn't ended yet, so the latest available date is used as its last trading date.
  • Backtest: the percent monthly gain/loss for the strategy, calculated from the total account size at the previous month's end (last day's market close) to this month's end. The earliest month usually has its gain calculated from the earliest available backtest date.
  • Benchmark: the benchmark's monthly gain/loss.

Note, the gains are raw percentage, not yet a factor of 1. For example 0.182 is actually 0.182%, so you have to divide it by 100 to yield the factor of 1 (that is, 0.00182).

 


 

5.  Yearly performance: this CSV file shows the yearly gain for both the strategy and its benchmark. So as previously, we don't have the “Compounded gain” here.

 

 

  • Year: this column lists all the years in the backtest period. Each row is occupied by a specific year. Each year has its last trading date written here. Note, the latest year usually hasn't ended yet, so its latest available date is used here instead.
  • Backtest: the percent yearly gain for the strategy, calculated from the account size at previous year's end up to this year's end. The earliest year's gain is usually calculated from the earliest date available on that year.
  • Benchmark: the benchmark's yearly gain, calculated similarly as the strategy's.

As previously, the gains shown here are the raw percentage.

 


 

6.  Backtest vs benchmark comparison: This CSV file shows the metrics report for both the strategy and the benchmark. The metrics listed here are the ones shown on the Metrics Tab, but only for the All Sample period (the whole backtest period). 

 

 

  • Description: this column lists the metrics' name. Top to bottom, they're exactly the ones you see on the Metrics Tab. Please look at the Metrics Tab's documentation (linked above) for the detailed explanation of each metric.
  • Backtest: this shows the strategy's metrics score. Each score is for the entire backtest period. They're accurate up to three decimal places, unlike the two decimal places found in the Metrics Tab.
  • Benchmark: this is for the benchmark's metrics score.

 


 

7.  Now, when it comes to a multi-strategy, the export results are generally similar, but there are some important differences:

 

  • In-depth trade history, monthly & yearly performances (Excel file): the Monthly and Yearly performance sheets are similar to what we described, but the Trade History sheet contains additional information:

    • Name: this column shows the name of the active strategies, of each day. For example means it's Strategy C there, which is the child of Strategy B, which in turn is the child of Strategy A. Each strategy contains its own set of Positions for that date. You can check on the “Weight” column next, to make sure whether that strategy is indeed active (greater than 0%). Now, sometimes you'll see “Unassigned cash” here as well, which is not part of any strategy. Unassigned cash is simply a cash set aside to trim the weight of a profitable/overweight stack back to its original weight that you set (that is, if your multi-strategy contains multiple strategy stacks); therefore the leaner stack may be infused with the fund to enter its next Positions.
    • Weight: the percentage of account size occupied by each activated strategy. If a parent strategy is fully in Cash Equivalent Positions, its weight will be 0%; even though it's technically not used, it is still active (in its Cash Equivalent Positions).
    • Gain: this column shows the strategy's instruments average gain, i.e. from yesterday's close to today's close (or the exit price, if the Positions are exited today).
    • ID: the identifier of each Position. But keep in mind, in a multi-strategy one symbol can occupy multiple Positions (e.g. child strategy activated multiple times). Hence you may see one cell containing multiple IDs (separated by comma) for the same symbol.

    • Position weight @ open: for Cash Equivalent Positions, these are usually 0, because technically there's no such Positions (child strategy is activated instead).
    • Position count: the number of Positions occupied by each symbol.
    • Entry price @ open: each Cash Equivalent symbol from the parent (e.g. SHY) has a note here, like: indicating how many Positions are in Cash Equivalent, the name of the child strategy replacing those Cash Equivalent Positions, and the number of Positions held by a single instance of that child strategy. So the total number of replacement Positions held by the child, in that example, is 2 × 3 = 6 Positions.

    • Position gain: instead of a gain for a single Position, you may see multiple Positions' gain (those with the same symbol).

 

  • Trade history (positions): Everything is exactly the same as what's described earlier, except there's a new column “Strategy”, which tells you the name of the strategy each Position belongs to. As usual, if there are arrows, look at the rightmost strategy name:

Unlike the previous export type, you will rarely see Cash Equivalent Positions here (unless they're from the last tier strategy). Because Cash Equivalent Positions don't technically exist in that multi-strategy (usually, they're immediately replaced by the child strategy's Positions).

 

  • Trade history (trading dates): As usual, everything is the same except the “Strategy” column:

And on each date, the Positions are sorted alphabetically, instead of based on the strategy they belong to. You may also see “Unassigned cash” here, as already explained earlier.

 

The remaining export types (Monthly Performance, Yearly Performance, and Backtest vs Benchmark Comparison) are exactly the same as what we've discussed before. But there's one metric type not found on the Backtest vs Benchmark Comparison, i.e. “Total trades/Rule count”, since a multi-strategy doesn't have rules/filters  (its basic strategy components do).

As for meta-strategies, their export results are exactly similar to basic-strategies' export results, except the Positions aren't actual instruments (e.g. AAPL, TSLA, etc.), but the strategy-components (like Atlas Order, DB Transactions, Bitcoin Meme Velocity, etc.). Cash or Cash Equivalent Positions still use the ticker symbol, obviously.

 

 

Positions' prices are based on the strategies' equity curve as seen on the Chart Tab (the “Backtest” percentage/total return).

 

 

 

Back to Top

>