StrategyRunner

From FxCodeBaseWiki
Jump to: navigation, search

Overview

Strategy Runner is a new product built on the basis of Indicore SDK and Forex Connect. It allows running a strategy as a separate program on a dedicated trading connection. The product has the following advantages:

- It consumes a small amount of memory and CPU (as compared to FXTS, for example). Multiple instances of the application can be launched without affecting the performance of your computer.

- Being used as a separate program, it does not require sharing memory with other tasks. Therefore, Strategy Runner can keep more historical and analytical data in the memory.

- Unlike FXCM Trading Station, Strategy Runner has no side components or strategies that can crash the running strategy or affect it in one way or another.

- Strategy Runner is a crossplatform software distributed for Windows x86/x64, Linux x86/64, and MacOS 64.

System requirements

Windows

Windows 7, Windows 8, or Windows 10.
The system update of Universal C Runtime is required.

Linux

Strategy Runner can be run on most popular Linux systems such as RedHat, CentOS, Debian, Ubunty of the 64-bit versions. The 32-bit versions will start to be supported later.

MacOS

MacOS is not supported in the first release.

Downloading Strategy Runner

You can download the Strategy Runner installation package here:

Configuring Strategy Runner

Strategy Runner comes with a standard set of indicators and strategies (the same as FXCM Trading Station). All the custom indicators must be copied to %StrategyRunnerFolder/indicators/custom. All the custom strategies (and packages with strategies) must be copied to %StrategyRunnerFolder/strategies/custom.

Strategy Runner has no GUI. Therefore, all its parameters are configured in a configuration file. You can create a new configuration file or use one of the sample files (%samples/dmacd_conf.ini, %samples/ma_advisor_conf.ini, or %samples/macross_conf.ini). To be used, a strategy must have its own configuration file.

Note that indicators and strategies on JavaScript are not supported in this release.

A configuration file contains the following fields:

Connection parameters

Mandatory connection parameters

  • login - a login ID to connect to the FXCM system
  • password- a password to connect to the FXCM system
  • url - usually, it is fxcorporate.com
  • connection - Demo or Real

Non-mandatory connection parameters

  • database - a database name if the account is present in more than one database
  • pin - a PIN number if the account is protected by PIN

Other mandatory parameters

QM_HISTORY_PATH - a path to the storage of locally cached historical data. For example (for Windows), QM_HISTORY_PATH=C:/Users/adm/Documents/HistoricalData
Note that QM_HISTORY_PATH=. means that the data is stored in the local directory.

Strategy parameters

Mandatory strategy parameters

  • strategy - a strategy name, for example, MACD, or MACROSS, or MA_ADVISOR
  • instrument - an instrument, for example, EUR/USD, USD/JPY, etc.
  • account - an account ID if the strategy is trading

Note, that in the configuration file of Strategy Runner, an account ID is required (not an account name used in FXCM Trading Station). To obtain the account ID of a trading account, do the following:
1. Go to %/sample/show_accounts.ini.
2. Fill in all the fields.
3. Run show_accounts.bat (or show_accounts.sh on a non-Windows system).
4. A list of account IDs and names appears on the screen.

Optional strategy parameters

In the configuration file, you can set any parameter of the strategy. If you choose not to do so, the default values are used. Note that in FXCM Trading Station the names of parameters are shown in a human-friendly form that can differ from the real parameter names. To see the real parameter names, go to the strategy source code.
For example, for the MA_ADVISOR strategy, the following parameters can be set:

  • FastN
  • SlowN
  • FMA_N
  • SMA_N
  • CANTRADE
  • TF

For illustration of a configuration file, see the sample files (%samples/dmacd_conf.ini, %samples/ma_advisor_conf.ini, or %samples/macross_conf.ini).

Controls

You can run a strategy, see the updates that take place while the strategy is running, and stop the running strategy.

Strategy Runner has no GUI, therefore, it can be controlled via a console in the following way:

  • To run Strategy Runner, execute the following command: StrategyRunner <path to configuration_file>
  • As soon as Strategy Runner starts, it displays the strategy events and statistics. A strategy event is displayed when it occurs and includes the information about the date, time, instrument, price, indicator, and a brief description of an order event or trading alert. The statistics is displayed every minute and includes the following items:
    • prices - the number of times the market price changed from the moment the strategy started up to the present moment.
    • orders - the number of orders executed on the account from the moment the strategy started up to the present moment.
    • alerts - the number of alerts occurred from the moment the strategy started up to the present moment.
  • To stop the strategy, press Ctrl + C. Note that, if you close the console, the Strategy Runner instance stops without saving any settings and update information.