Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

darthtrader2.0

Algorithmic Trading with MATLAB Webinar

Recommended Posts

I just watched this yesterday:

http://www.mathworks.com/company/events/webinars/wbnr30376.html?id=30376&p1=50647&p2=50649

 

I was always curious as to why someone would use Matlab over a more specific trading software but after watching that video I have to say I'm completely floored. They use a simple moving average system as an example and the visualization tools are light years beyond anything else I've ever seen.

The one backtest shows this color coded 3d plot of how the different MA parameters effect a sharpe ratio...just amazing.

The only downside I can see with matlab is the price of the software and the datafeeds that connect to it are somewhat limited to the higher end of things(reuters, bloomberg).

note:you do have to fill out a brief questionaire, it would probly be worth it to just create an account at the site as they have a few other webinars for finance that look pretty interesting.

Share this post


Link to post
Share on other sites

I found this too

http://www.matlabtrader.com/

 

It has stuff to get matlab hooked up to interactive brokers.

Note the full matlab version is $5000 with the toolboxes you would want. The student version is 99 bucks. Pretty sweet deal to get your feet wet it would seem.

 

Here is the datafeed toolbox, pretty lame that it jumps from yahoo to bloomberg, lol.

http://www.mathworks.com/products/datafeed/description3.html

 

anyone ever mess with the esignal or dtn API?

Share this post


Link to post
Share on other sites
The only downside I can see with matlab is the price of the software and the datafeeds that connect to it are somewhat limited to the higher end of things(reuters, bloomberg).
If your current data feed can output live to excel then you should have no problem. Matlab can grab data quickly and efficiently from an opened (via DDE/ActiveX) or saved excel file. It takes literally just a few lines of code to check, grab, and add new data from excel to a database. Of course there are other ways to accomplish the same task. The price is pretty steep unless A) You are a student or B) You have a decent income.

 

For awhile now I have done all my back testing and system building in Matlab. However, just recently I have started transferring all my charting over to it. It wasn't my original plan, but at the moment it seems to be the best (only time will tell). My current plan is to be fully charted with Matlab by the fall.

Share this post


Link to post
Share on other sites

Ahh great info Hlm.

Could you describe your setup and process in more detail?

Do you analize and store tick data? If you are storing things what DB are you using?

Do you use multiple strategies? Thats one thing that seems nice with matlab and absurd that so much retail autotraders can't handle more than one strategy at once.

Share this post


Link to post
Share on other sites
Could you describe your setup and process in more detail?
Well, it depends on what you are looking for in your charting software. Retail charting platforms are great for when you are first learning and want to look around and experiment. Once you figure out and decide on what exactly you need to become consistently profitable, you should carry those over to the new platform. Of course I mean for only those that want/need such an environment (not for everyone). Since I am still in the process of moving completely over to Matlab, I am still using SierraChart to take care of my data storage. In SierraChart there is a study called "Worksheet Study/System/Alert" where it uses DDE to constantly update an open Excel file with x amount of data (drops last bar when new one added). If you want multiple time frames you just add the study to another chart with the same Workbook name and it will automatically place it in the second Sheet. This is nice since only one Excel file has to be open.

 

Sample Excel Data from SierraChart...

ESU8  144 tick - #1                        
Date Time        Open        High        Low          Last          Volume  #of Trades
39640.67705    1239.75    1239.75    1239.50    1239.75    625      56
39640.67689    1239.75    1240.00    1239.50    1239.75    1965    144
39640.67662    1239.50    1240.00    1239.50    1240.00    2849    144
39640.67626    1240.00    1240.25    1239.50    1239.50    2106    144
39640.67601    1240.00    1240.25    1239.50    1240.00    2398    144
39640.67572    1240.75    1241.00    1240.00    1240.00    2873    144

At which point you can grab in Matlab with...

ExcelFile = ddeinit('excel','c:\data.xls:Sheet1');
ExcelData = ddereq(ExcelFile, 'r4c1:r8c7'); 
%started with r4 because r3 isn't completed yet

To check for new data you could do something like...

CurrentTime = ddereq(ExcelFile, 'r4c1');
if CurrentTime ~= LastTime
i=1;
   while(CurrentTime ~= LastTime)
       NewData = ddereq(ExcelFile, ['r4c1:r' num2str(i+4) 'c7']);
       CurrentTime = NewData(end,1);
       i = size(NewData, 1);
   end
LastTime = NewData(1,1);
OldData = vertcat(NewData(1:end-1,, OldData); %adds new data

Note: I'm currently not on my Matlab workstation so code above is just a quick example and not necessarily efficient or error free. :)

 

One can also grab from Excel using ActiveX if you don't want to use DDE. Everything is well documented on their site.

 

Do you analize and store tick data? If you are storing things what DB are you using?
That is one of my summer projects I am currently working on. I will be using MySQL. The great thing about Matlab is that there is an abundance of information on their site under the Newsgroup and File Exchange sections.

 

Do you use multiple strategies? Thats one thing that seems nice with matlab and absurd that so much retail autotraders can't handle more than one strategy at once.
I am currently automating one strategy that has multiple filtering and analysis steps. Being able to have full control of how data is analyzed and manipulated without boundaries is a big reason why I started using Matlab. Edited by Hlm
Specified that I am currently working on one automated strategy.

Share this post


Link to post
Share on other sites

Do you use multiple strategies? Thats one thing that seems nice with matlab and absurd that so much retail autotraders can't handle more than one strategy at once.

 

Hello,

 

Thanks for posting this webinar link, I'll be watching it tonight after the market. With regard to multiple strategies, you might be looking at the wrong software. Neoticker can do this just fine and has been able to for a long time (forever??).

 

Thanks again.

 

All my best,

MK

Share this post


Link to post
Share on other sites

Thanks Hlm, great info. I will have to try to get the DDE stuff going with dtn and see how that works, should be a nice learning experience in and of itself.

For database stuff have you ever checked out HDF5? I know thats some heavy duty stuff for large files and matlab can interface directly with it:

http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/hdf5.html

I read on one of the quant boards about a guy who mentioned he was mining around 1 terrabyte datasets with it. My only concern with Mysql is that things might get overwhelming size wise rather quickly if i want to store tick data across multiple instruments. My interest here is in a very long term project for high frequency stuff that will take years to get sorted out. HDF5 might be total over kill though, i don't know.

MidKnight, I kind of figured neoticker could do multiple strategies...I guess I've really never read something where neoticker couldn't do "X". There is just something about the program that bugs me though, this visual basic program for win95 feel to it.

Share this post


Link to post
Share on other sites

I've been doing a little analysis in Mathematica, but after asking some people who know their stuff, I'm going to try out Matlab. It seems easier to get moving, and Matlab seems to deal with data better. Wish me luck.

Share this post


Link to post
Share on other sites
For database stuff have you ever checked out HDF5? I know thats some heavy duty stuff for large files and matlab can interface directly with it:

http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/hdf5.html

I read on one of the quant boards about a guy who mentioned he was mining around 1 terrabyte datasets with it. My only concern with Mysql is that things might get overwhelming size wise rather quickly if i want to store tick data across multiple instruments. My interest here is in a very long term project for high frequency stuff that will take years to get sorted out.

The main reason why MySQL is being used is because I am very familiar with it and my programming friend and I have been using it with other projects for years. MySQL can work with a lot of data if done correctly, but if you are looking at storing years of raw tick/volume data without splitting up files it may be beneficial to go with hdf5. To be honest I don't know much about hdf5. I guess I will add that research to my todo list. :)

Share this post


Link to post
Share on other sites
but if you are looking at storing years of raw tick/volume data without splitting up files it may be beneficial to go with hdf5.

 

Well I should say I know virtually nothing about database design and what not.

Is that the whole issue with SQL vs a time series database, single file/table size? While I could see the problems that would arrise if you dumped years of tick data into a single table that would obviously be a really dumb way to go about things considering that with financial time series we have the benefit of sectioning things off by the day.

I'll have to try MySql out, I soppose the big advantage would be the learning material available. Maybe at some point we can try a database design thread on here.

Share this post


Link to post
Share on other sites
Well I should say I know virtually nothing about database design and what not.

Is that the whole issue with SQL vs a time series database, single file/table size? While I could see the problems that would arrise if you dumped years of tick data into a single table that would obviously be a really dumb way to go about things considering that with financial time series we have the benefit of sectioning things off by the day.

I'll have to try MySql out, I soppose the big advantage would be the learning material available. Maybe at some point we can try a database design thread on here.

Yes, much of it depends on how you decide to organize data for your needs be it within the database itself or having separate files.

Share this post


Link to post
Share on other sites

I'm thinking about making a mysql database with live data for this type of analysis. I'd like to get a few years of 1m in a table, and then a week or so of tick data.

 

Does anyone know of a good, reliable way to get data into a mysql database real time?

Share this post


Link to post
Share on other sites

Does anyone know of a good, reliable way to get data into a mysql database real time?

 

Assuming you want to stay away from your datafeeds API, you might be able to get this going if your datafeed can do DDE and assuming matlab can write to mysql, then you could probly do something like what Hlm posted above.

 

I think the bigger question though is if you need to access the database to trade live or just to backtest ideas. If just for backtesting the easiest thing to do might just be to spit out text files of the data from ninja, then parse the text with python or something and shove it into the database at the end of the day. I would think that would be pretty simple to figure out. From searching around this morning I think thats what I'm going to start off with. The more complex issues of datafeed -> database -> matlab -> trade signal/order, well I'll cross that bridge when I come to it.

Share this post


Link to post
Share on other sites

Yeah, I was more interested in live data. If I feel I really need it, I could write a C++ wrapper that takes a live feed and puts it into mysql, tick by tick. EOD I can handle just fine.

Share this post


Link to post
Share on other sites
I'm thinking about making a mysql database with live data for this type of analysis. I'd like to get a few years of 1m in a table, and then a week or so of tick data.

 

Does anyone know of a good, reliable way to get data into a mysql database real time?

 

Hi Atto,

 

I know of one neoticker user who wrote their own datasource (you can do that with the neoticker) so that his datafeed will slot write into SQL server as well as his charts. Of course, he isn't releasing it....but I mention it just as a point of one tool where things like this are quite possible. His name is Michale Kreslik (spelling?).

 

All my best,

MK

Share this post


Link to post
Share on other sites
Hi Atto,

 

I know of one neoticker user who wrote their own datasource (you can do that with the neoticker) so that his datafeed will slot write into SQL server as well as his charts. Of course, he isn't releasing it....but I mention it just as a point of one tool where things like this are quite possible. His name is Michale Kreslik (spelling?).

 

All my best,

MK

http://kreslik.com/forums/viewtopic.php?start=0&t=357

My "SQL history engine" MS SQL Server 2005 database create script is attached below.

 

Currenty it features 255 million+ ticks for 16 FX pairs over the last 7 years and the database size is nearly 100GBs with all the indexes.

 

I'm feeding this carefully sifted and clean data to my NeoTicker and I'm also using it as a data source for running various statistics, written in C#.

 

Michal

Share this post


Link to post
Share on other sites
Guest Tresor

Hello Hlm,

 

What would be the hardware requirements for using Matlab for strategy creating, (ii) optimizing (iii) running live charting, (iv) trading signals, etc?

 

There were several components mentioned (e.g. simulink) in the webinar: which components did you purchase or belive are optimal to purchase?

 

Regards

Share this post


Link to post
Share on other sites
What would be the hardware requirements for using Matlab for strategy creating, (ii) optimizing (iii) running live charting, (iv) trading signals, etc?
Hardware requirements pretty much depend on the type of analysis you will be doing and if it's time critical or not. Matlab itself does not require much (actual requirements HERE). It shouldn't need more than any other charting software. By nature you may be doing more advanced calculations across a larger amount of data, which then the amount of time required to accomplish a task will be directly related to your processing power. Also, it depends on how your program within Matlab. If you use standard loops instead of vectors it may go slower unless compiled.

 

There were several components mentioned (e.g. simulink) in the webinar: which components did you purchase or belive are optimal to purchase?
This is an interesting topic that I have had with several people. It's just like my feeling towards using indicators...find out exactly what information you need, and then look for the indicator that gives you that information. And many times you can't find exactly what you want so you have to build your own. The same can be said with toolboxes. I do own a few of them, but with my current project I am not using any of them. You have to imagine that they would mention as many as they could in the webinar since that's their business. I would figure out what you specifically need and then search the newsgroup and file exchange for answers. However, if you want to know a couple of the popular ones, I would say the Optimization and Statistics Toolbox.

 

I hope that helps some.

Edited by Hlm
Added actual requirements link.

Share this post


Link to post
Share on other sites
Guest Tresor

Hlm,

 

There were two indicators mentioned in the webinar: MAs and RSI. How many indicators are there prebuilt-in Matlab. Would you mind posting a list of them? Or is it the case that there are no prebuilt-in indicators and one has to program them oneself?

 

Regards

Share this post


Link to post
Share on other sites
There were two indicators mentioned in the webinar: MAs and RSI. How many indicators are there prebuilt-in Matlab. Would you mind posting a list of them? Or is it the case that there are no prebuilt-in indicators and one has to program them oneself?
If you are looking for a quick way to mimic your current charting platform, the Financial Toolbox would be a good start. However, it requires the Optimization and Statistics Toolbox. This toolox has many indicators and also simplifies the charting process. Again one must just read through the product list and look at the specifics of the toolboxes of interest. I would urge anyone to first make a list of required items and then do the research to find the ways that they can be obtained.

Share this post


Link to post
Share on other sites
Guest Tresor

There seems to be only a few indicators.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Topics

  • Posts

    • Be careful who you blame.   I can tell you one thing for sure.   Effective traders don’t blame others when things start to go wrong.   You can hang onto your tendency to play the victim, or the martyr… but if you want to achieve in trading, you have to be prepared to take responsibility.   People assign reasons to outcomes, whether based on internal or external factors.   When traders face losses, it's common for them to blame bad luck, poor advice, or other external factors, rather than reflecting on their own personal attributes like arrogance, fear, or greed.   This is a challenging lesson to grasp in your trading journey, but one that holds immense value.   This is called attribution theory. Taking responsibility for your actions is the key to improving your trading skills. Pause and ask yourself - What role did I play in my financial decisions?   After all, you were the one who listened to that source, and decided to act on that trade based on the rumour. Attributing results solely to external circumstances is what is known as having an ‘external locus of control’.   It's a concept coined by psychologist Julian Rotter in 1954. A trader with an external locus of control might say, "I made a profit because the markets are currently favourable."   Instead, strive to develop an "internal locus of control" and take ownership of your actions.   Assume that all trading results are within your realm of responsibility and actively seek ways to improve your own behaviour.   This is the fastest route to enhancing your trading abilities. A trader with an internal locus of control might proudly state, "My equity curve is rising because I am a disciplined trader who faithfully follows my trading plan." Author: Louise Bedford Source: https://www.tradinggame.com.au/
    • SELF IMPROVEMENT.   The whole self-help industry began when Dale Carnegie published How to Win Friends and Influence People in 1936. Then came other classics like Think And Grow Rich by Napoleon Hill, Awaken the Giant Within by Tony Robbins toward the end of the century.   Today, teaching people how to improve themselves is a business. A pure ruthless business where some people sell utter bullshit.   There are broke Instagrammers and YouTubers with literally no solid background teaching men how to be attractive to women, how to begin a start-up, how to become successful — most of these guys speaking nothing more than hollow motivational words and cliche stuff. They waste your time. Some of these people who present themselves as hugely successful also give talks and write books.   There are so many books on financial advice, self-improvement, love, etc and some people actually try to read them. They are a waste of time, mostly.   When you start reading a dozen books on finance you realize that they all say the same stuff.   You are not going to live forever in the learning phase. Don't procrastinate by reading bull-shit or the same good knowledge in 10 books. What we ought to do is choose wisely.   Yes. A good book can change your life, given you do what it asks you to do.   All the books I have named up to now are worthy of reading. Tim Ferriss, Simon Sinek, Robert Greene — these guys are worthy of reading. These guys teach what others don't. Their books are unique and actually, come from relevant and successful people.   When Richard Branson writes a book about entrepreneurship, go read it. Every line in that book is said by one of the greatest entrepreneurs of our time.   When a Chinese millionaire( he claims to be) Youtuber who releases a video titled “Why reading books keeps you broke” and a year later another one “My recommendation of books for grand success” you should be wise to tell him to jump from Victoria Falls.   These self-improvement gurus sell you delusions.   They say they have those little tricks that only they know that if you use, everything in your life will be perfect. Those little tricks. We are just “making of a to-do-list before sleeping” away from becoming the next Bill Gates.   There are no little tricks.   There is no success-mantra.   Self-improvement is a trap for 99% of the people. You can't do that unless you are very, very strong.   If you are looking for easy ways, you will only keep wasting your time forgetting that your time on this planet is limited, as alive humans that is.   Also, I feel that people who claim to read like a book a day or promote it are idiots. You retain nothing. When you do read a good book, you read slow, sometimes a whole paragraph, again and again, dwelling on it, trying to internalize its knowledge. You try to understand. You think. It takes time.   It's better to read a good book 10 times than 1000 stupid ones.   So be choosy. Read from the guys who actually know something, not some wannabe ‘influencers’.   Edit: Think And Grow Rich was written as a result of a project assigned to Napoleon Hill by Andrew Carnegie(the 2nd richest man in recent history). He was asked to study the most successful people on the planet and document which characteristics made them great. He did extensive work in studying hundreds of the most successful people of that time. The result was that little book.   Nowadays some people just study Instagram algorithms and think of themselves as a Dale Carnegie or Anthony Robbins. By Nupur Nishant, Quora Profits from free accurate cryptos signals: https://www.predictmag.com/    
    • there is no avoiding loses to be honest, its just how the market is. you win some and hopefully more, but u do lose some. 
    • $CSCO Cisco Systems stock, nice top of range breakout, from Stocks to Watch at https://stockconsultant.com/?CSCOSEPN Septerna stock watch for a bottom breakout, good upside price gap
    • $CSCO Cisco Systems stock, nice top of range breakout, from Stocks to Watch at https://stockconsultant.com/?CSCOSEPN Septerna stock watch for a bottom breakout, good upside price gap
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.