strategy testing and automated trading system for fx
TRANSCRIPT
Strategy Testing and Automated Trading System for FX
I. IntroductionTradeFX is a collec�on of matlab scripts and a Meta Quotes expert advisor script that allow tes�ng on Foreign Market (FX) trading
strategies, performing machine learning to evaluate the best performing strategy based on historical data. A$er the system is
trained, it can be used together with any MetaTrader FX pla%orm to place trades based on its learned predic�ons.
Figure 1 Matlab Component
Figure 2 MetaTrader UI
file:///C:/Users/gms/MyDocuments/ClassCoursework/Fall2009/FT_CO...
1 of 3 9/9/2009 5:45 PM
II. How to useSee our Video Demo of Automated Trading.
Requirements
1. Matlab. The files are wri+en and run on Matlab R2007a.
2. MetaTrader Pla%orm
Most FX dealer will require you to open a demo account before ge2ng data from their system. The process usually totally
free. Either Forex.com (US) or Alpari‐UK is a good place to start.
Steps
File preparation
1. Download MetaTrader program, install & run. Make sure you can get live data by following their instruc�ons.
2. Download the our TradeFX.zip package.
3. Extract the zip file to a folder
a. Copy Trade Monitor.mq4 & Trade Monitor.ex4 to <MetaTrader>/experts/ folder
b. Copy Data.txt and Order.txt to <MetaTrader>/experts/files/ folder
In MetaTrader
1. Run MetaTrader, bring up the EURUSD chart. To quickly see system in ac�on, choose 1M (1 minute) chart.
2. On Naviga�on panel, drag and drop Trade Monitor into the chart. Confirm the ac�on in dialog box.
3. Press Expert Advisor to start running.
In Matlab
1. Open matlab
2. Se2ng path environment variables to extracted folder and all its subdirectories (File | Set Path | Add with Subfolders)
3. Run spotFX.m to generate learning data for Support Vector Machine. Data given is EURUSD data from 19 January to 12
April 2009. You should replace with your new data saved from MetaTrader later.
4. Run Communica�on.m to bring up the Automated trading system.
5. Press Start.
Data from MetaTrader should be soon display in synchroniza�on with that in MetaTrader. Trade will take place in
MetaTrader automa�cally.
IMPORTANT NOTICE:
file:///C:/Users/gms/MyDocuments/ClassCoursework/Fall2009/FT_CO...
2 of 3 9/9/2009 5:45 PM
1. Current version only support placing Sell orders.
2. Given currency pair data is EURUSD. To test on other currency pair, obtain historical data of that pair (Save file from
MetaTrader) and run spotFX again.
3. System will place a maximum of 10 trades at a �me.
4. Trades will exit automa�cally when MACD condi�ons is sa�sfied as described in ‘MACD Sample’ Expert Advisor script given
my MetaTrader.
Comments, sugges�ons and sharing please send to
Linh Vu (vuxuanlinh at gmail.com)
AcknowledgementThe following libraries and tutorial code are used in our system.
[1] Mechanical trading systems: TA‐Lib func�ons, h+p://sourceforge.net/docman/display_doc.php?docid=47727&group_id=190150
[2] Support Vector Machine toolkit for Matlab, LibSVM
[3] Interac�on between MetaTrader 4 and Matlab via CSV Files, h+p://ar�cles.mql4.com/440
Project Report[1] Strategy tes�ng and Automated Trading for FX
file:///C:/Users/gms/MyDocuments/ClassCoursework/Fall2009/FT_CO...
3 of 3 9/9/2009 5:45 PM