Algo Trading in Ranging Markets

An automated trading strategy contains a set of rules which will take particular actions in response to incoming market data. When automating a trading strategy, the trader may want to add rules to trade only during certain market conditions. In this article, Rob Pasche of QuantNews presents three tools which can be added to an automated trading strategy to filter for ranging markets.

The Average Directional Index indicates whether the price of an instrument is moving in a primary direction up or down or if it's moving sideways. A high ADX (generally 30 or higher) will indicate price is primarily moving up or down while a low value (generally 25 or lower) will indicate price is exhibiting range bound behaviour. Therefore programming an algo to calculate ADX and only trade when ADX is below 25 will filter out trending markets and place trades only when markets are range bound.

The Average True Range calculates the difference between the high and low of the most recent candle, measuring volatility. Therefore taking the N-period moving average of the ATR can be used to approximate the volatility of an instrument over the past N periods. For example, programming an algo to only execute trades when the ATR is below its 20-day moving average can be used as a filter to avoid massive bull or bear runs which are often marked by a high ATR.

The Relative Strength Index measures momentum of an uptrend or downtrend using values 0-100. Including a filter for a middle-of-the-road RSI value, for example 40-60, will limit the algo to only trade when momentum is weak and the instrument's price is range bound.


These materials constitute marketing communication and do not take into consideration your personal circumstances, investment experience or current financial situation. The content is provided as general market commentary and should not be construed as containing any type of investment advice, investment recommendation and/or a solicitation for any investment transactions. This market communication does not imply or impose an obligation on you to perform an investment transaction and/or purchase investment products or services. These materials have not been prepared in accordance with legal requirements designed to promote the independence of investment research and are not subject to any prohibition on dealing ahead of the dissemination of investment research.

FXCM, and any of its Affiliates, shall not in any way be liable to you for any inaccuracies, errors or omissions, regardless of cause, in the content of these materials, or for any damages (whether direct or indirect) which may arise from the use of such materials, services and their content. Consequently, any person acting on them does so entirely at their own risk. Please ensure that you read and understand our Full Disclaimer and Liability provision concerning the foregoing Information, which can be accessed here.