Backtest

General Information

The Backtest has been implemented as a key feature for analyzing the performance of a strategy on a historical basis. It is possible to backtest a strategy for a single instrument (security) or instrument list (portfolio).
Running a backtest will require:
With TradersYard X Discovery and higher: TradersYard X++ (plusplus) strategy.
In order to open the backtest window select Backtest by using Main -> New.
Workflow: ● Choose your Analyzer Session in SetupBuilder ● Define your Entry-, Stop- and Target-parameter in SetupBuilder ● Choose Main / New -> Backtest ● Choose your strategy in “General Options” (e.g.: TX++) ● Choose a data source, e.g. “Datafeed” or “File with ticks” (you need to download and/or select from the file) ● Define a timeframe ● Select an InstrumentList (optional: you can additionally choose one specific instrument by simply clicking on it) ● Set start and end times (date and time) ● Go to the tabs and click on “Settings” ● Choose your entry signal in “Backtest Parameters” and check if stops and targets match your settings in SetupBuilder. Yet you have the chance to change those settings here. Confirm by clicking “Save Setup”. ● Go to “Parameters” and choose your Analyzer Session ● Define other settings like the number of bars, buying power, and so on. ● Confirm by clicking “Save Setup”. Please note: If you have changed your setup in “Backtest Parameters”, you overwrite your settings in SetupBuilder when clicking “Save Setup”. ● Start your backtest by clicking “Run”. Now you can choose if you want to backtest your strategy on a selected instrument or on the whole list. ● In the area below your Instrument List, you can watch the progress of the calculation or stop it.

General Options

The Input Tab allows the following settings:
Parameter
Meaning
Start Date&Time
Choose the date and time at which the backtesting should start.
End Date&Time
Choose the date and time at which the backtesting should end.
Instrument Lists
Choose an instrument list.
Time-Frame
The time interval for data representation on a chart e.g. 1Min, 1hour, 1Day.
Strategy
Choose a strategy (e.g. self programmed or TX++). An TX++ strategy must be created with the Setup Builder and chosen in the Settings tab.
Run
Here you can choose between a selected (single) instrument or an instrument list (portfolio); this starts the backtest.
Open
Allows to open a backtest result saved in the past.
Data Source
Define if a data feed or a file is used to calculate the backtest. Possible files: with bars or with ticks. The file should not contain a header.
The result tab offers the following possibilities:
Parameter
Meaning
View Type
Choose between Amount, Percent, or Ticks
Save Result
Saves the backtest result

Settings tab

This tab shows two types of strategies: 1. Self-programmed or imported strategies
The parameters of the strategy can be edited.
Additional parameters:
  • Buying Power
  • Cash Value
  • Commission
  • Slippage
2. TradersYard X++ Strategies The TX++ parameters are mainly the same as the above, with just a few slight differences:
  • The Backtest Parameters category contains the parameters from the Setup Builder
  • The Parameters category allows you to select an Analyzer Escort session from the Setup Builder
  • It is possible to save the manually edited settings with the Save Setup button
    • Saving the setup will overwrite the Setup Builder.
The following functions are available under the category "Trading":
Function
Description
Enable Trading Breaks
Trading breaks set in the Market Place Escort are either taken into consideration or not. If this parameter is set to „true“, then the backtest only calculates its results within the trading times set in TradersYard X. Pre- or post-market movements are not taken into account.
Last Opened Trade Handling Mode
If the last trade cannot be completed during the backtest, then you can select whether this trade should be closed anyway (Option: Close) or stay open (LeaveOpen). With „LeaveOpen“, the last trade is not included in the Profit&Loss calculation.
Orders Handling Mode
Standard or Advanced. Further functions for Advanced: Orders settings
Calculate Entry Market Orders On Close: Options „true“ or „false“.
Calculate Exit Market Orders On Close: Options „true“ or „false“. The standard setting is based on the Backtest Standard Mode. Here, market orders are always calculated with the next open of the candle. This function can be changed in Advanced, as a result of which the close of the candle is also used.
Decision Mode: - Best Case: unclear orders are calculated with the best possible result. - Worst Case: unclear orders are calculated with the worst result that could occur. - Ignore: unclear orders are ignored.

Data Source

Possible options are: - Datаfeed (e.g. YFeed, TeleTrader, etc. or a data feed from a broker) - File with Bars - File with Ticks
File format and data format for data from a file:
File with Bars: .csv and .txt
File with Ticks: .csv and .txt

Charts tab

The Charts tab is divided into the equity curve and the chart history. The equity curve contains information either about one instrument (security) or an entire instrument list (portfolio), while the chart history is always for one instrument only.
The functions Show, Equity, and X-Axis are only available after a backtest has been generated.
Equity curve representation
  • If the option Show All is active, the equity curve shows all trades of the backtesting result.
  • If the option Show Chart is active, the equity curve shows all trades within the charting history area (zoom).
Both options have also an impact on other tabs too
In the same manner:
  • If the option Show All is active, then results of the tabs Summary, Trades, Orders, Executions, Periods, and Trading Info are calculated for all trades.
  • If the option Show Chart is active, then results of the tabs Summary, Trades, Orders, Executions, Periods, and Trading Info are only calculated for those trades within the charting history area (zoom)
  • Equity Single: displays only the selected instrument
  • Equity All: displays all instruments of the instrument list (portfolio) and draws a curve for each instrument.
  • Equity Account: displays all instruments of the instrument list (portfolio) in one curve.
Please Note! The options Show All or Show Chart have no impact if the Equity options are set to All or Account. The above mentioned other tabs will calculate there results on all trades only and not for a specific area of the chart history window.
The X-Axis options allow the user to display the equity curve either with Date & Profil/Loss or Trades & Profit/Loss.
Navigation There are two zoom options for analyzing the results:
  1. 1.
    Mouse wheel
  2. 2.
    Click and hold the right mouse button and select an area in the chart history or equity curve.
As mentioned above, the Show All or Show Chart options have an impact on the displayed of the equity curve and the results in the other tabs. If the option Show Chart is active, then zooming within the chart history will also zoom within the equity curve. If the option Show All is active, then the chart history zoom has no impact on the equity curve. Zooming within the equity curve, on the other hand, always has an impact on the chart history.

Context menu

There are several options in the context menu:
  • Copy
  • Save Image As...
  • Page Setup... (for printing)
  • Print...
  • Show Point Values
  • Set Scale to Default
Context menu Graph:
  • Cumulative Profit
  • Daily Net Profit
  • Entry Efficiency
  • Exit Efficiency
  • MAE
  • MFE
  • Monthly Net Profit
  • Weekly Net Profit
  • Total Efficiency
  • Trade Profit/Loss
Context menu Trades:
  • All
  • Long
  • Short
Context menu Winning/Losing:
  • All
  • Winning
  • Losing

Brief Statistic

As the name implies, the Brief Statistic contains a summary of trading results
Indicator explanations The Indicator results are divided into three columns: all long and short trades together, long trades only, and short trades only.
Parameter
Meaning
Total Net Profit
Total net profit (gross profit minus gross loss)
Gross Profit
Profit generated by all your trades within the specified date & time period
Gross Loss
Loss generated by all your trades within the specified date & time period
Profit Factor
Gross profit divided by gross loss (e.g. 1 = profit and loss is the same)
Cumulative Profit
Cumulative profit of previous periods
Maximum Drawdown
The maximum loss in one trading sequence
Commission
Commission generated for the broker
Total Number of Trades
Monetary number of all trades
Winning Trades
Monetary number of all winnings trades
Losing Trades
Monetary number of all losing trades
Average Trade
Average profit or loss per trades
Average Winning Trade
Average profit or winning trades
Average Losing Trade
The average loss of losing trades
Ration (Win/loss)
The ratio of wins to losses
Maximum Consequence Winners
Number or consecutively winning trades
Maximum Consequence Losers
Number or consecutively losing trades
Largest Winning Trade
Highest profit of a trade
Largest Losing Trade
Highest loss of a trade
Number of Trades per Day
Total number of trades per day

Trades tab

The Trades tab contains all trades from the backtesting summary. Right-clicking on the column names opens the context menu, which allows you to add or remove columns using the Choose columns window. Right-clicking on the trades list allows you to export the list as an MS Excel document
Tip: PnL shows profit and loss of the actual trade. The cumulative PnL (“Com. PnL”) shows total profit and loss of all trades so far. As you can see in the screenshot, top-down - starting with the first PnL - the following PnL is subtracted respectively added on. Each new result you will find in “Com. PnL”-column, every following PnL will be added on or subtracted in a zigzag-mode down to the latest result of cumulated PnL. Please take into account that most minimal deviations might occur as the cumulated PnL is rounded to two decimal figures whereas prices sometimes are calculated to three or more decimal figures.

Orders tab

The Orders tab contains all orders from the backtesting summary. Right-clicking on the column names opens the context menu, which allows you to add or remove columns using the Choose columns window. Right-clicking on the trades list allows you to export the list as an MS Excel document

Order execution description

The Backtest simulates a real-time behavior in two different modes: Mode No. 1 - Tick-based (works in the same way as the simulation account). If the current tick touches an open order this tick price will be used as a fill price. Mode No. 2 - Candle-based (simulates the tick-based mode).
Each candle will be split into four pieces:
  • growing candle: Open; High; Low; Close.
  • falling candle: Open; Low; High; Close.
If e.g. the High price touches an open order this price will be used as a fill price. The same is valid if an open order touches the Open, Low, or Close price.
Difference between Market, Stop, and StopLimit order: Market and Stop orders will be filled with the same candle. StopLimit orders will be filled with the next candle. Example. Assuming TimeFrame = 1 Day the StopLimit order will be filled on the next day, while the Stop order will be filled on the same day.

Executions tab

The Executions tab contains all order executions of the backtesting summary. Right-clicking on the column names opens the context menu, which allows you to add or remove columns using the Choose columns window. Right-clicking on the trades list allows you to export the list as an MS Excel document

Periods tab

The Periods tab contains a summary of the backtesting results based on various calendar settings. Right-clicking on the column names opens the context menu, which allows you to add or remove columns using the Choose columns window. Right-clicking on the list allows you to export the list as an MS Excel document and choose the period type.
Possible period types are:
  • Annual
  • Monthly
  • Weekly
  • Day of Week
  • Daily
  • Hour of Day

Trading Info tab

The Trading Info tab contains all information about the trade in a trading tree. It includes Partial Trades, Orders, and Executions. Right-clicking on the column names opens the context menu, which allows you to add or remove columns using the Choose columns window.

Essential information

To backtest a trading signal it is necessary to set the correct history length required by the signal or condition. To do this the setting "Required bars count" must be defined. In general, the default setting of 20 bars is enough for most signals. If a signal or condition with the Condition Escort or via programming was created that requires more history (bars) the setting must be adjusted accordingly. Be aware that for the defined history (bars count) setting no signals/conditions can be calculated. Only the bars after that will show signals.
Information for Dow Theory signals: Signals created with Dow Theory indicators like the P123 require a long history to calculate the signals. At least 500 bars or more must be set. Note, that your data feed or file must deliver enough history since the e.g. first 500 bars will not show any signals. Only the following bars will show them.

Further development from Standard to Advanced

In collaboration with the University of Aachen (Institute for Mathematics), the Backtest function of TradersYard X has been further developed and the Advanced Mode has been created. The research paper by Dr. Stanislaus Maier-Paape and Dr. Andreas Platen indicates that a strategy in the Backtest only delivers results for historical data and cannot be a basis for live trade, since the future results can deviate substantially therefrom. Nevertheless, the function Backtest, which is offered by all leading software manufacturers, still plays an essential role in the quality of the software. A well-functioning backtest algorithm is necessary in order to develop a well-functioning trading system. The more accurately the results are calculated in the backtest, the more reliable the trading system is when it comes to live trading.
Furthermore, the research also demonstrates that despite very progressively developed algorithms and tests in the market, in some cases, the calculations are not outputted correctly. In one of these cases, one speaks of situations that cannot be clearly defined, for short SNU (situation which is not unique). In order to make it possible to also react to SNUs, the function "Decision Mode" was developed, which gives the user of the software the chance to make a decision. The following three settings can be made:
  • Worst case: the SNU is evaluated based on the worst possible result.
  • Best case: the SNU is evaluated based on the best possible result.
  • Ignore: the entry signal or the whole trade is ignored.
SNUs only occur in connection with stop, limit, and stop-limit orders. Market orders can always be clearly defined.