AlgoTraderAlgoTrader Documentation

Appendix M. Example Strategy "RSI"

This example strategy shows how market indicator (Relative Strength Index in this case) can be used to generate buy or sell signals and act accordingly. There is no much focus on qualitative side, i.e. RSI signal is used in a simple, trivial way. However one can see how indicator is constructed, feed with market events and how trades can be sent based on the indicator's values.

There is a simple rule for position accumulation - it is allowed to sell only when there is no position or there is only long position, and it is allowed to buy only when being flat or short.

The main artifacts needed for the implementation of a new strategy are described in Chapter 4, Strategy Development.

The RSI strategy consist of the following main artifacts:


The strategy service class providing the main methods invoked by the application on certain events.


Config where the following parameters are specified:

period - days to look back and calculate the RSI index,

buyThreshold - index value, once value becomes below - treated as a buy signal,

sellThreshold - index value, once value above - treated as a sell signal,

securityId - id of the security to trade,

quantity - order quantity.

To setup the strategy for back testing and live trading on a development workstation please execute the following steps:

Download the Example Strategies

If you have used the Section 2.1, “Windows Installer” to setup AlgoTrader, this project is already setup in the AlgoTrader IntelliJ IDEA and you can skip this step.

Download the Examples project zip file and unpack it in a directory of your choosing:


user name and password will be provided when signing up for an AlgoTrader license

If you need an older AlgoTrader version, login to our maven repository ( and click on Browse on the left and select code-general.

Then select the AlgoTrader version you want and download:

Import/open the project rsi

To start the strategy in live trading mode on a development workstation please execute the following steps:

Initialize the database

load the db-samples script into the MySQL database: /algotrader-conf/src/main/resources/db-samples/mysql/mysql-data.sql

load the strategy specific script into the MySQL database: /rsi/src/main/resources/db/mysql/mysql-data.sql

To start the Strategy please see the explanations in Chapter 3, Starting AlgoTrader.