View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Automated Trading with MATLAB - 2012

4.7 | 8 ratings Rate this file 54 Downloads (last 30 days) File Size: 7.47 MB File ID: #37932 Version:
image thumbnail

Automated Trading with MATLAB - 2012


Stuart Kozola (view profile)


31 Aug 2012 (Updated )

Files from the Automated Trading webinar showing X_Trader and QuickFIX/J integration.

| Watch this File

File Information

Files used in the webinar - Automated Trading with MATLAB broadcast on August 21, 2012. This webinar can be viewed at
Specific topics include:
* Data gathering options, including daily historic, intraday, and real-time data
* Model building and prototyping in MATLAB
* Backtesting and calibrating a model
* Interacting with existing libraries and software for trade execution (X_Trader, QuickFIX/J, messaging queues)

It is recommended that you watch the webinar to see the "live" system running.


Algorithmic Trading With Matlab 2010 inspired this file.

This file inspired Algorithmic Trading With Bloomberg Emsx And Matlab, Automated Trading System Development With Matlab, and Commodities Trading With Matlab.

Required Products Control System Toolbox
Database Toolbox
Datafeed Toolbox
Econometrics Toolbox
Financial Toolbox
Global Optimization Toolbox
Parallel Computing Toolbox
DSP System Toolbox
Signal Processing Toolbox
Simulink Verification and Validation
Statistics and Machine Learning Toolbox
System Identification Toolbox
MATLAB release MATLAB 7.14 (R2012a)
MATLAB Search Path
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (21)
18 Jul 2016 obsenspictor

Is the executor.bat file missing from quickFix/j version 1.6? I'm trying to figure out how to run the line system('C:\sandbox\java\quickfixj\bin\executor.bat&'). Is it necessary to switch to version 1.5?

Comment only
21 Sep 2015 chen Yan

14 Apr 2015 Xin LIU

Thanks. Great job!

07 Nov 2014 Anthøny Salazar

thanks for share it help me a lot, if we continue on this motion, everyone will be rich.

03 Apr 2014 cyril

cyril (view profile)

nice work, @Stuart is there so much a need to use GA for finding the best rule? there are 3*2+3*2^2*3+2^3*3^2 possibilities of rules with the scheme you did, so it's not a big deal to test them 1 by 1

28 Feb 2014 Bruno

Bruno (view profile)

Could you help me with this

Comment only
02 Jan 2014 Bradley

02 Jan 2014 Bradley

Hello Stuart,

I am having trouble with starting banzai on my computer. I know it has to probably deal with not having the the config file on the correct path.
I am receiving the error that SessionSettings is a undefined function. I am not sure where to put the correct file and what files to put there. Thank you!

11 Jul 2013 Frank Weissbach


I solved the issue. It was indeed a path issue. If classes depend on other .jar then those need to be added to the javaclasspath as well.
Following the quickfix installation guide the following 4 jar files need to be in the path:

quickfixj-all.jar(includes core and message JARs)

Comment only
08 Jul 2013 Mark

Mark (view profile)

Those following this thread my find the website: interesting. Some of the work here inspired it along with work from 'Algorithmic Trading With Matlab 2010'

Comment only
08 Jul 2013 Frank Weissbach

Hello Stuart,

1) The Banzai example is running correctly on my system.
2) The javaclasspath is set correct.
I'm successful calling (and creating the output objects in Matlab) other classes from the same quickfixj-all jar files.

Comment only
01 Jul 2013 Stuart Kozola

Stuart Kozola (view profile)


The error is telling you it can not find the SocketInitiator method. This error is likely due to one of these reasons:
1) the required library is not on the javaclasspath
2) a mis-match in required java libraries

When you download and install quickfix/j, run the banzai example outside of MATLAB to make sure your system has all of the required java libraries. If it runs correctly, then the problem is in the importing/classpath.txt reference to the required java libraries, which you can fix by importing the libraries from the same directory as the installation of quikcfix/j.

Comment only
01 Jul 2013 Frank Weissbach

I have an error when I trying to execute 'Demo7b_QuickFIXExample.m'

Everything works fine up to the line:
initiator = SocketInitiator(application,storeFactory,settings,logFactory,messageFactory);

which gives me the error:
Undefined function 'SocketInitiator' for input arguments of type

Operating System: Microsoft Windows 7 Version 6.1 (Build 7601: Service Pack 1)
Java VM Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode

Comment only
01 Jul 2013 Frank Weissbach

I'm working on Windows 7:
Operating System: Microsoft Windows 7 Version 6.1 (Build 7601: Service Pack 1)
Java VM Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode

Comment only
29 Apr 2013 Mark

Mark (view profile)

Thank you for this collection. On a cursory read of the code, if I am correct there is an issue with the logic employed in tradeSignal if I have understood it correctly. Specifically, the input 'ind' and logical 'AND'. As I understand it, 'ind' is normalized such that 0 = sell, 0.5 = "skip", 1 = buy. If you logically AND 0 & 1 (sell and buy) the result is a 0 (sell) however this is not the desired result. I'm posting this in the spirit of others trying to review this code and welcome any correction on my understanding.

Comment only
07 Dec 2012 nicholas


05 Dec 2012 Piment

Piment (view profile)

07 Nov 2012 Stuart Kozola

Stuart Kozola (view profile)

Hi Goryn,

Did you try inputStream ='C:\\MATLAB_CODES\\Automated_Trading\\banzai.cfg');

settings = SessionSettings(inputStream);

It is a JAVA path issue, not MATLAB. Try this and it should work.

Comment only
26 Sep 2012 Goryn

Goryn (view profile)

Thank you for your answer, Stuart. But it is another error. Firstly, I've tried to run Demo7b_QuickFIXExample.m and it writes:

Java exception occurred:
quickfix.ConfigError: banzai.cfg (The system cannot find the file

at quickfix.SessionSettings.<init>(

Error in Demo7b_QuickFIXExample (line 23)
settings = SessionSettings('banzai.cfg');

Comment only
24 Sep 2012 Stuart Kozola

Stuart Kozola (view profile)

This error occurs when trying to reference a file path on Windows that is not a valid URL. See for an example.

You can either:
1) Run the commands with banzai.cfg in the current working directory


2) change the MATLAB file to accept inputStreams:
inputStream ='C:\\MATLAB_CODES\\Automated_Trading\\banzai.cfg');

settings = SessionSettings(inputStream);

Comment only
10 Sep 2012 Goryn

Goryn (view profile)

I have an error when I trying to execute 'Demo7b_QuickFIXExample.m' script:
- firstly I've added path to 'classpath.txt'
- then after loading quickfix packages I try to execute 'settings = SessionSettings('banzai.cfg');' it writes me:
Java exception occurred:
quickfix.ConfigError: banzai.cfg (Cannot find) at quickfix.SessionSettings.<init>(

If I try to execute a line of code with full path, like "settings = SessionSettings('c:\MATLAB_CODES\Automated_Trading\banzai.cfg');" it writes:

Java exception occurred:
java.lang.IllegalArgumentException: name

at sun.misc.URLClassPath$Loader.findResource(Unknown Source)

at sun.misc.URLClassPath.findResource(Unknown Source)

at$ Source)

at Method)

at Source)

at java.lang.ClassLoader.getResource(Unknown Source)

at java.lang.ClassLoader.getResourceAsStream(Unknown Source)

at quickfix.SessionSettings.<init>(

Comment only
04 Sep 2012 1.1

Updated zip file contents.

05 Nov 2014 1.2

Updated with toolbox packaging.

01 Sep 2016

Updated license

Contact us