With the new quote data available for all pair Forex for both Brokers (Oanda and FXCM), the backtest result is more accurate because it incorporates the bid/ask spread in the trade.

Given that both brokers charges spread – Oanda only charges spread, FXCM charges spread plus commission –  the new quote data also allows having a good approximation of the broker fees and commission schema impact in the trading strategy. Is worth noticing that before the quote bar, the Oanda fees were approximated by a constant fee per trade.

To get an idea of the bid/ask spread in the strategy performance, please check the followings algorithms.

  • This is the original algorithm, run with trade bar data and using Oanda as brokerage (note the fees.)
  • This is the same algorithm, run with quote bar data and Oanda as brokerage (in this case the fees are zero).
  • Finally, the algorithm run with quote bat data and FXCM as brokerage.

Here is a table with the comparison between trade bar vs quote bar and FXCM vs Oanda. The ask/bid spread has a large impact in the performance. Sharpe ratio is almost 50% lower, net profit, information ratio and compounding annual return are approximately 60% smaller by taking account the of the spread. But what is interesting is the difference between the Oanda and FXCM using quote bars. Sharpe ratio, net profit, information ratio and compounding annual return are all approximately 30% grater using FXCM.

However, when trying to replicate this results with many algorithm and setups, the performance difference between Oanda and FXCM is not so clear in favor of FXCM.

That is the motivation for this experiment, trying to measure if the broker choosing for forex trading has a significant impact in the performance.

The null hypothesis is that there is not significant difference in performance for a given strategy as results of the Broker commissions and fees.

The methodology is using statistical analysis on results obtained by brute force.

In order to generate the data a base algorithm is used. The base algorithm is run using one combination of parameters that affects the size of the trades and the quantity of trades.

Base Algorithm
The base algorithm* is a simple momentum strategy for forex (attached). The algorithm logic is considering is the excess return over the past 12 months is positive or negative and goes long on the contract if it is positive and short if negative. Like every momentum following strategy it has some serious drawdowns. It worth note that there is no risk management in order to keep the backtests as comparable as possible.

Algorithm Parameters
As was previously expressed, two kind of parameters are used in the base algorithm, beside the Broker.

Parameters that affect the size of the trades:

  • Maximum exposure: what proportion of the total portfolio values is used to entry to the market. This variable affects the volume of the trades and makes the strategy riskier. The values tried were 0.2, 0.3, 0.4, 0.5 and 0.8.  
  • Leverage: Self-explanatory, similar to maximum exposure it also makes the algorithm riskier, it has a huge impact in the max drawdown. The values tried were 1, 5, 10, 20 and 50.
  • Initial cash: This variable only affects the trading volume. The values tried were 10K, 50K, 100K, 500K and 1M.

Parameter that affect the quantity of trades:

  • Pairs to Trade: How many pairs of the extreme excess returns are actually traded. E.g. if this parameter (called pairsToTrade) is equal to 2, each month the algorithm goes long the two pairs with higher excess return and goes short the two pairs with the lowest excess return. The values tried were 1, 2, 3, 4 and 5.

The alternatives setups yield 1250 combinations, in order to run all the combinations the LeanSTP** was used. With 8 Lean instances running in parallel it took 3 hours in an Intel I6 6700.

The universe are 36 Forex pair shared between Oanda and FXCM.


Finally, the base algorithm time span is seven years and three months, form January First 2010 to March 31st 2017.


A more detailed statistical analysis can be found in this notebook.

The conclusion is that this experiment failed to show that FXCM and OANDA have the same impact in trading.

The differences in the Compounding Annual Return, Sharpe Ratio, Expectancy, Net Profit, Loss Rate, Win Rate and Beta are significant at 99% in favor to FXCM.

FXCM may seems more expensive at first sight but in average the spread charged by Oanda erodes even more the algorithm performance. In others words, the broker selection matters. Obviously it will not transform a bad strategy in a profitable one.

Finally, there are cases where Oanda is a better than FXCM. It may worth to try both brokers once the strategy shows it intrinsic value.


* You may note this algorithm do not make use of the OnData method. On the other side it uses the TradingCalendar to get the first and latest tradable day each month.
** This tool was already shared in the forums. To run this experiment, the algorithm parameters and its alternatives values should be defined in the GenerateRunsArguments method. Finally, to parse all algorithm results in a single CSV file this small program was used.