img

Advisor Tester - trading strategy tester

The trading strategy tester is designed to test the effectiveness of operating a user expert on historical data. While testing, the tick sequence is modelled on the basis of price bars, so there may be some inaccuracy between the results of the expert's work in the tester, and operating in real time.

To start the strategy tester, click on the item View in the main menu and select Advisor Tester. This will open the main window of the tester to specify expert parameters.

Parameters tab - Testing Parameters

The Parameters tab is used to specify testing parameters of your trading expert. Let us consider the dialog window elements and their purpose:

1. The drop-down Advisor list allows you to select an expert for testing. The list contains all the compiled scripts in the Advisors folder and in subfolders.

2. The Properties button serves for calling up the dialog window for changing the expert properties. This dialog window is available only for experts, which use global variables specified with the keyword extern.

3. The drop-down list for selecting a symbol for testing. The list coincides with the symbols in the Market Watch window.

4. The drop-down list for selecting the interval for testing. Available standard intervals:

  • Minute
  • 5 Minutes
  • 15 Minutes
  • 30 Minutes
  • 1 Hour
  • 4 Hours
  • Daily
  • Weekly

5. The Spread drop-down list - selecting a spread for testing. The list allows the user to enter a positive value, or select a value from the list, the current spread option corresponds to the current spread existing for selected instrument.

6. Choosing a testing method: Control points or Open Prices Only (only the opening prices). In the Control points mode modelling goes as follows: there are 4 ticks modelled for each bar. When the closing price is higher than the opening price, the ticks are formed in the following sequence: Open, Low, High, Close; when the closing price is less than the opening price the following sequence is formed - Open, High, Low, Close. In the Open Prices Only testing mode each tick corresponds to opening bar price. This testing method is suitable only for advisors making deals on the already formed bars. In this method, the testing speed is higher than in the Control points mode.

7. Selection of a minimum distance for orders. The field allows to specify any positive value or choose a value from the list of standard options, the Current distance option corresponds to the actual distance of orders, determined for the instrument specified at the moment.

8. The Limit dates check box is used to limit a testing range. When the check box is off, the testing goes through the full history loaded for the selected instrument, when the check box is on - the fields From and To are activated to specify the range of dates for testing.

9. Fields of specifying dates for testing limitation. The date of the test beginning is selected in the From field, the date of the test end is specified in the To field. If the interval for testing exceeds the range of the loaded history data, zero price values will be used for dates out of the range.

10. The Initial Deposit field is used to specify the deposit in dollars (USD) when the testing process starts.

11. The Enable visual mode check box. When the check box is on, the trading operations and orders are displayed on the chart during the testing. This mode reduces the speed of testing.

12. The testing speed slider and the "pause" button serve for speed regulation in a visual mode.

13. The Enable expert logs check box - puts out printing on the Journal tab.

14. The Start (Stop) button is used to run the test and to stop it ahead of time.

When carrying out a visual test the chart is displayed on a grey background and the moments of the opening / closing positions are highlighted: opening a Buy position - black arrow, opening a Sell position - red.

The Results tab - tabular displaying of results

The Results tab provides information of all deals, made during the test. The data is displayed in a tabular format. The Closed Positions table displays positions that have been closed, and the Open Positions displays all remaining positions when the testing is complete.

Each line in the Closed Positions table contains:

  • # - closed position number
  • Deal ID - position identifier
  • Symbol - position symbol
  • Direction - direction
  • Volume 1 - position volume in the base currency units
  • Volume 2 - position volume in the quote currency units
  • Open rate - open price
  • Open time - date and time of opening
  • Stop loss - stop loss level(the value is not displayed if the linked stop loss order was not available)
  • Take profit - take profit level (the value is not displayed when the linked take profit order was not available)
  • Last swap* - position swap (not calculated in the current version)
  • Rate close - closing rate
  • Time close - opening time and date
  • Profit - position profit
  • Balance* - balance after the position was opened
  • Equity* - equity after the position was opened

The table can have items sorted by any of available fields, click on the corresponding column heading for sorting.

* This field is displayed when the Show extended columns mode is on. This mode can be activated via the context menu of the table.

Unclosed positions have the following information displayed:

  • Deal ID - position identifier
  • Symbol - position symbol
  • Direction - direction
  • Volume 1 - position volume in the base currency units
  • Volume 2 - position volume in the quote currency units
  • Open rate - open price
  • Open time - date and time of opening
  • Stop loss - stop loss level(the value is not displayed if the linked stop loss order was not available)
  • Take profit - take profit level (the value is not displayed when the linked take profit order was not available)
  • Last swap - position swap (not calculated in the current version)
  • Profit - position profit (when the testing complete)

The dialog box displays at the bottom the testing summary data that includes:

  • Balance
  • Equity
  • Margin - (margin maintenance when the test is complete)
  • Margin free

Equity Graph - graphical representation of equity and changes in the balance

The horizontal axis of the chart shows ordinal numbers of closed positions, the vertical axis - current equity / balance. The blue line shows the change in balance, the green one shows the change in equity.

Double-click opens the Results tab with the selected deal that corresponds to the specified position on the chart.

Journal - expert's message log

The Journal tab shows the output of System.Print function, used in the expert. The information is displayed in a table consisting of two columns: the first column shows the time of the event, the second - the text of the message. If the Enable expert logs check box on the Parameters tab is disabled, the journal will have only start and stop expert commands displayed.