Algorithmic Trading: A Quantitative Approach to Developing an Automated Trading System



Similar documents
NEW TO FOREX? FOREIGN EXCHANGE RATE SYSTEMS There are basically two types of exchange rate systems:

Scalping Trade Strategies April 14, 2009

What is Forex Trading?

Evolution of Forex the Active Trader s Market

The foreign exchange market is global, and it is conducted over-the-counter (OTC)

The purpose of this ebook is to introduce newcomers to the forex marketplace and CMTRADING. Remember that trading in forex is inherently risky, and

Carry Trade Explained What Is the Carry Trade?

Contents Risk Disclaimer... 3 Introduction... 4 Choosing the Right Broker... 4 The Financial Markets... 5 The Forex Market...

5 Pitfalls To. Avoid For. Sucessful

Maverick FX Trading. Forex 101 Session #4 Preparation for Demo Trading

SPOT FX Trading Strategies. Copyright Powerup Capital Sdn Bhd

Forex Basics brought to you by MatrasPlatform.com

CommSeC CFDS: IntroDuCtIon to FX

MICHAEL HODGES AND BRETT COOPER

The World s Elite Trading School. The Trusted Source for Online Investing and Day Trading Education Since What is a Forex?

Terms and definitions

EUR/USD Trading Strategy

A Manual for New FOREX Traders

How To Consistently Make $900 - $9,000 in 48 Hours or Less

Real Time Short-Term Trading Gregory McLeod Currency Strategist

ActTrader Forex Trading Guide

Guide to Online Forex Trading

NDD execution: NDD can help remove the conflict of interest >>> providing a confl ict free environment for Retail FX traders CLIENT.

Welcome to FOREX e-book

Forex Trading Strategies: One way to trade the Non Farm Payroll report.

Best Times to Trade Forex

BEST TIMES TO TRADE THE FOREX MARKET

Trading Station / MetaTrader 4 Product Guide 2 October Page 1 of 15

Chapter 1.2. Currencies Come in Pairs

How to Find Your Fortune in the Forex Markets by Tom Willmott

A practical guide to FX Arbitrage

LET S GET TO KNOW FOREX

ALL RIGHTS RESERVED TO REAL-FOREX.COM

1 Introduction. 1.5 Margin and Variable Margin Feature

Trading System: BatFink Daily Range (A) Investment Market: Forex

3. The Foreign Exchange Market

Hedge Hog Trade Rules

Foreign Exchange Trading Managers

The Forex Profit System :

WebTrader User Guide

Introduction to Forex Trading

How To Be Successful At Trading Forex

Active Currency Trading Model Product Guide for Individually Managed Discretionary Accounts (MDA)

Firststrike (1997 through no compounding)

The information contained herein is derived from sources we believe to be reliable, but of which we have not independently verified. Forexyard.

1 Introduction. 1.5 Leverage and Variable Multiplier Feature

The Impact of Gold Trading

Trading Station II / MetaTrader 4 Product Guide 12 November Page 1 of 14

THIS IS THE TRADING METHOD FOR THE STEALTH FOREX TRADING SYSTEM V10

Trading University Trade Successfully with Trend Following

Forex Cantata User Manual

TRADING RULES ONLINE FX AND PRECIOUS METAL Effective August 10, 2015

The Awesome Trading System (2 nd Edition)

Option Contract Size. Spreads as low as (in pips) Standard Lot 100,000 of 1st Ccy, Mini Lot 10,000 of 1st Ccy. 10:00am EST**

AN INTRODUCTION TO THE FOREIGN EXCHANGE MARKET

Chapter 3.4. Forex Options

The Truth About Forex* TRADING GUIDE

An Introduction to Online Trading. National University of Singapore 22 March 2007 Klaus Buhl

Forex Currency Trading Conditions Overview for Colmex Pro MT4 Users

TOPFX. General Questions: FAQ. 1. Is TOPFX regulated?

AN INTRODUCTION TO TRADING CURRENCIES

Trading forex is buying one currency while at the same time selling a different currency.

Forex Diamond EA. User Guide - 1 -

World Cup University. Trade Successfully with Trend Following. By Kevin J. Davey

SHADOWTRADERPRO FX TRADER USERS GUIDE

RISK WARNING. Retail transactions conducted with NatureForex are not insured by any deposit insurance of any kind.

Getting Started With Forex Trading: A Forex Primer. Member NASD, NYSE, SIPC, and NFA

Intro to Forex and Futures

Session #1 Building a Trading Plan

The Truth about Forex TRADING GUIDE

High Frequency Trading Volumes Continue to Increase Throughout the World

Trading with the flow

FxPro Education. Introduction to FX markets

HF Markets Ltd. TRADING AND EXECUTION RISKS

DEALING HANDBOOK FOR FX TRADERS

WGM Services Ltd Authorisation No: 203/13

Introduction to Forex Trading

FOREX STRATEGIES BY ANDREA UNGER

INDUSTRY LEADING DERIVATIVES EXPERTS. Tel:

Chapter 2.4. Multiple Time Frames

Algorithmic Trading Session 1 Introduction. Oliver Steinki, CFA, FRM

International Academy of Exchange Trading. Lesson 4: Orders

* FDI Portfolio Investment Other investment

Forex Capital Trading Pty Ltd. does not make any recommendations on the validity of any financial product referred to in this advertisement, s

At 17:00 hours (5:00 pm) each Friday, trading will be disabled until Sunday 17:00 hours (5:00 pm).

ELECTRONIC TRADING GLOSSARY

Introduction to Foreign Exchange. Andrew Wilkinson

Pro Picks Quick Reference

WallStreet FOREX Robot User Guide

SAMPLE TRADERS BUSINESS PLAN

THE XFOREX. Mini E-book Guide for Forex Beginners. Currency Trading. Guide

INTRODUCTION. This program should serve as just one element of your due diligence.

Let s Get to Know Spread Bets

Partnerships you can depend on

Chapter 4 - The Foreign Exchange Market. Functions of the FX Market

Recent Trends in Japanese Foreign-Exchange Margin Trading

ECONOMIC ROADBLOCKS FOR THE YEN p. 6

Forex Trade Copier 2 User manual

Chapter 1.1. The Forex Market

Spike Trading: Spot FX Vs Futures

Transcription:

Algorithmic Trading: A Quantitative Approach to Developing an Automated Trading System Luqman-nul Hakim B M Lukman, Justin Yeo Shui Ming NUS Investment Society Research (Quantitative Finance) Abstract: In Flash Boys: A Wall Street Revolt, Lewis wrote "The market is rigged" by HFT traders who front run orders placed by investors. Indeed, if makers cannot win by getting a good price, they will win by speed. In this paper, we focus on the foreign exchange market. Although they are OTC markets where each brokers managed their inventory separately and as such each quoting a slightly different bid-ask spread, an emerging trend is that more brokers are providing ECN accounts for retail investors. Users of ECN accounts receive their pricing from a pool of large liquidity providers and hence there are smaller price discrepancies. That said, we are not just trading with other retail traders but also dealers from banks who provide these liquidity. They make a market with an advantage of being fast and access to the market depth of their clients. Building a trading bot will increase the speed and accuracy of our trade execution and hence, enhance our chance of survival in the competitive world of trading. Keywords: Trading Systems 1. Motivation The foreign exchange market is the most liquid and lucrative market, where trillions of currencies worth are traded daily. Yet because of its high liquidity, traders are susceptible to perils of overtrading which decreases their profit factor. A recent research study undertaken by Ph.D. researcher John Forman, reveals that 99.6% of retail Forex traders are unable to achieve more than 4 back-to-back profitable quarters. Sound strategy or not, losses are apparently inevitable. Yet we cannot deny that there are still 0.4% of successful discretionary traders. Looking at Expert Advisors Market at MQL5 (https://www.mql5.com/en/market), we see that based on historical back testing, there are some systems which can more than breakeven. It could be curve fitting to historical data and so may not hold its good performance into the future. Nevertheless, it is an interesting topic to explore on how trading systems are developed. To simplify and narrow the scope on this limited paper, we will focus on a simple trading system on USD/JPY, neglecting other major and cross pairs and their relationships with one another. 2. Background of USD/JPY Firstly, we need to recognise that USD/JPY is a safe haven currency as JPY has a near zero interest rate and hence is a good currency for financing. Due to low yield of JPY, if there is major unrest in other parts of the world (e.g. such as the outbreak of Ebola), investors will shift their funds from riskier, higher yielding currencies such as AUD or NZD into JPY. This will often cause large fluctuation in the value of USD/JPY. US Dollar is sensitive to major economic events such as Non-Farm Payroll, Federal Open Market Committee meetings and unemployment claims. These indicators vary over time, depending on what is the goal of the central banker. Thus, it is safer to stop the systems before such important events.

Secondly, it is the second most widely traded pair and accounts for 18.3% of transactions, hence its spread is consistently low and good for automated trading on tick. However, the start of the first hour after a weekend has inconsistent and unusually high spread at times. Thirdly, we need to recognise the realistic expectation of movement in USDJPY and we did it by looking at historical data of the last 6 months from August 2014 to February 2015. From figure 1, we observed that there is hourly seasonal pattern in both liquidity (tick volume) and price movement (lower stick, body, upper stick), regardless of direction. There is clearly a surge in liquidlity when 2100 GMT+8 arrives, sometimes an hour before. Liquidlity and price movement are larger coming end of the week, especially Thursday and Friday. Generally, the higher liquidity and capital flows into the pair generate larger price movements. These could be good filters and targets for our trading systems. Figure 1: USD/JPY Weekly View. Time is GMT+2 compared to Singapore s GMT+8. Hence we add 0600 hours to the ones we observed Fourth, we want to explore if there is any autocorrelation between the time series data. From Figure 2, lag in 10, 12, 14, 25 and 30 days failed the t-test and exceeded the 95% confidence interval, implying that there is possibly some relationship between daily close price at such intervals. From Figure 3, hourly intervals of 4, 8, 16, 18 and 24 failed the t-test and exceeded the

Autocorrelation Autocorrelation confidence interval implying that there is possibly some relationship between hourly closing price at such intervals. These could be good estimates for our trading systems parameters. Autocorrelation Function for C lag 1 (with 5% significance limits for the autocorrelations) Autocorrelation Function for H lag 1 (with 5% significance limits for the autocorrelations) 1.0 0.8 0.6 0.4 1.0 0.8 0.6 0.4 0.2 0.0-0.2-0.4-0.6-0.8-1.0 0.2 0.0-0.2-0.4-0.6-0.8-1.0 1 5 10 15 20 25 30 Lag 35 40 45 50 55 60 1 5 10 15 20 25 30 Lag 35 40 45 50 55 60 Figure 2: Autocorrelation analysis for daily close price Figure 3: Autocorrelation analysis for hourly close price 3. Types of Trading Systems To create a good trading system, one needs a good understanding of the trading instrument and it is beyond the scope of this limited paper. In general, products are developed for certain group of investors for specific needs. That means the instrument exhibits unique characteristics. Some of these may then be exploited in a trading system. A trading system could be simple or complicated, but a basic one comprises a few functions: entry and exit signals (including target profit and stop loss), filters on entry; position sizing on entry and exit, and risk management. The objective is to utilize a trading strategy that has an edge over other participants of the market and that suits the trader s needs. Depending on one s risk profile, it is recommended to take a 2% risk on each trade. Professionals have proven that good entries ensure that you have a good safety margin and hence experience a lower drawdown. However, a volatile market can change a winning position to a losing one in seconds and thus, a stop loss is imperative. Managing the trade is actually more important than the entry itself. Target profits are important because the difference between closing a position on hitting target profit and hitting a stop loss is very big. Filters are subjective depending on the instrument you are trading but are also the factor that adds the most value to the trading system. In this example, we will use a simple breakout strategy for USDJPY. Simple Breakout (24) system Timeframe: 1 Hour Currency Pair: USD/JPY Breakout HH-LL Look back Period: 24 Stop Loss: 20 pips Target Profit: 100 Volume: 10,000 (0.1 Standard Lot) Starting Capital: USD 10,000 Spread: 0.5 pips (consistent average) Back testing period: 1-April-2011 to 31-Jan-2015

2011.04. 2011.05. 2011.06. 2011.07. 2011.09. 2011.10. 2011.11. 2012.01. 2012.02. 2012.03. 2012.04. 2012.06. 2012.07. 2012.08. 2012.10. 2012.11. 2012.12. 2013.01. 2013.03. 2013.04. 2013.05. 2013.07. 2013.08. 2013.09. 2013.10. 2013.12. 2014.01. 2014.02. 2014.04. 2014.05. 2014.06. 2014.08. 2014.09. 2014.10. 2014.11. Close USD/JPY Price Chart April 2014 - Jan 2015 120.00 110.00 100.00 90.00 80.00 70.00 Equity Curve: Trading Statistics for USD/JPY Summary All Trades Net Profit $ 849.13 Profit Factor 1.18 Max Balance Drawdown 5.61% Total Trades 458 Winning (%) 41% Max Consecutive Winning Trades 6 Max Consecutive Losing Trades 8 Largest Winning Trade $ 86.10 Largest Losing Trade $ -75.17 Average Trade 1.85 Sharpe Ratio 0.06 In summary, this strategy produces good results when the market is trending as seen from the price chart. However, the system failed to make progress when the market ranges: the maximum number of consecutive losing trades was 8. Overall, profit factor is 1.18 and max equity drawdown was 6.77%. Sharpe Ratio or reward-to-variability is 0.06 which means a risk-adjusted return of 6%. Interested

readers can think of further ways to further improve this strategy, e.g. by varying the look back period or by incorporating further filters to reduce the number of trades when market is ranging.