Tag Archives: Pairs Trading

Getting the daily return from a Pairs Trading Strategy using Matlab

Getting the daily return from a Pairs Trading Strategy using Matlab

Guys, I am developing a pairs trading strategy in Matlab for my thesis. My problem is the following. I modelled the system in order to buy or sell just 1 quantity of a pair of stocks. Considering that I can short sell, possible negative initial investment are possible. How can I calculate the return in this case?

 

Prudent version: cash received from shorts is a liability and serves as collateral against the borrowed shares. The return calculation should divide any profit by these short proceeds. Necessarily the max return would be capped at 100%.

Less prudent version: divide the return by only the margin required to support the short sale.

 

I think you can do it in the same way as done for futures.

You short sell at 100, price rises to 102, you made a loss of 2%, similarly, if it falls to 98, you made a profit of 2%. In futures, since you don’t actually own anything, based on your prediction, you either pay the 2% loss to exchange, or you receive the 2% profit from them.

 

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Presentation material for Quant Finance Meetup on Pairs Trading in R programming language

 

Presentation material for Quant Finance Meetup on Pairs Trading in R programming language

This is from Alon who presented last nite:

You can reach the slide deck with the code at
alonhonig.com in the ‘resources’ tab
Here is a paper that refers to logarithmic as well as arithmetic returns:
http://ssrn.com/abstr…
Here is the pairs trading paper:

http://69.175.2.130/~…

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Meetup quant finance next event is Pairs Trading in R on Jan 17, LAST CALL!!

Meetup quant finance next event is Pairs Trading in R on Jan 17, LAST CALL!!

I just sent this to my Meetup.com/quant-finance group:

Hey all

It looks like the group is growing crazy with lots of non-Ontario members. So welcome to all.

Our next Meetup is firm for this Tues Jan 17 at the North York Civic Library in Toronto. This starts at 7pm not the usual 6:30.

http://www.meetup.com/quant-finance/events/44899052/

Please confirm as this will be yet another ‘our biggest’ Meetup yet. Topic is: Pairs Trading In R.

Thanks to Member Alon for piecing this together. These presentations can take a lot to put together so give this person a standing ovation for doing it. It takes a lot for members to step up to do a presentation. If you want, please let me know if you want to do something!  So please speak up!

I have a variety of topics to bang out for the group including my new course on how to build a High Frequency Trading Platform and how to use QuantLib with Excel, C#, Java, etc. I am also wanting to bring in the 15 year old whiz kid who got a lot of attention in Canada’s Dragon Den (or aka Shark Tank in the USA).

I am also looking at some webinar technology to help drive online presentations for non Toronto members as I am convinced there is a big need for these types of topics.

As for me here at QuantLabs.net, I have two latest posting summaries that you may interested in:

https://quantlabs.net/blog/2012/01/new-java-programming-book-series-interview-cheat-sheet-and-pairs-trading-in-r/

https://quantlabs.net/blog/2012/01/video-courses-on-hft-high-frequency-trading-quantlibxl-java-programming-pairs-trading-in-r-meetup-and-quant-jobs/

I hopefully will see you on Tues.

This is a reminder of the usual $3-$5 donation to cover the room. Also, we are totally responsible for setting up and tearing down the chairs. Also, we will go over to Milestones for a more social setting.

Thanks Bryan

P.S. Got ideas, feedback, or comments, let me know!

 

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

New Java programming book series, interview cheat sheet, and pairs trading in R

 

New Java programming book series, interview cheat sheet, and pairs trading in R

This was just sent to my email opt in list:

 

Hi there

There is still a 50% discount as we are well under way into 2012 but I will be increasing very, very soon so this could be the last call.

Here are the latest benefits with the large amount of quant videos and software goodies I have added:

  • World`s first online video course on how to build high frequency trading (HFT) and using the largest FREE open source library with Excel
  • I just added cheat sheets for quant/trader job interviews with tough questions from Goldman Sachs, Bloomberg, etc
  • I also added a set of Books on a study guide for those who are trying to pass the Sun Certified Java Programmer (SCJP) exam
  • Multiple C++, C# source code projects and Matlab Coder demos for converting M script files to trading platforms

So get your initial membership here at http://quantlabs.net/membership.htm

The SCJP book series is posted at:

http://quantlabs.net/member/sun-certified-java-programmer-online-course-now-posted-for-quant-development/

Job interview cheat sheet:

http://quantlabs.net/member/how-to-get-a-lucrative-career-in-quant-trading-and-banking-with-our-job-interview-cheat-sheets/

Last reminder on the Toronto Meetup for Pairs Trading in R

http://www.meetup.com/quant-finance/events/44899052/

Thanks and yours truly

Bryan at QuantLabs.net

 

 

 

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Video Courses on HFT, high frequency trading, QuantLibXL, Java Programming, Pairs Trading in R Meetup, and Quant jobs

Video Courses on HFT, high frequency trading, QuantLibXL, Java Programming, Pairs Trading in R Meetup, and Quant jobs

Just emailed to everyone on the Opt in Email list

Hey there

So here we are in 2012. Some major additions for our QuantLabs.net Premium Membership. Here are the additions:

1. World’s first online video course on How to Build High Frequency (HFT) Trading  Platforms

https://quantlabs.net/blog/2012/01/youtube-video-hft-high-frequency-trading-video-course-now-online-with-bridge-to-r-and-matlab/

2. Video Course on QuantLib, QuantLibXL with front ends to Microsoft Excel, C#, Java, Python, R, and more

https://quantlabs.net/blog/2012/01/youtube-video-online-course-on-open-source-c-quant-library-quantlib-with-quantlibxl-excel-java-c-r-python/

3. I have another  course as well which will be an online course for learning how to program in Java

Whoa!! That is a lot of stuff for the Membership. Join NOW before I put the rate where it should be. SO GET THE HALF PRICE OFF NOW!

http://quantlabs.net/membership.htm

I got a LAST CALL for our very popular Toronto Meetup on Pairs Trading in R. It will be on Jan 17.

https://quantlabs.net/blog/2012/01/final-call-for-toronto-quant-finance-meetup-pair-trading-in-r-on-jan-17/

Finally, more jobs on the Linked In group front where you need to join to get access:

http://www.linkedin.com/groups/C-C-Python-Development-Experts-3427378.S.88258045?qid=1176434a-c7e3-4ac1-a163-23d55817d75c&trk=group_most_recent_rich-0-b-ttl&goback=.gmr_3427378

http://www.linkedin.com/groups/PHD-MS-in-Machine-Learning-3427378.S.88257743?qid=1176434a-c7e3-4ac1-a163-23d55817d75c&trk=group_most_recent_rich-0-b-ttl&goback=.gmr_3427378

Again,  get your membership before everything goes up in price!

http://quantlabs.net/membership.htm

Thanks and talk to you soon

Bryan

 

, Pairs Trading in R Meetup, and Quant jobs

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Reminder and confirmed on Meetup on Pairs Trading with R Jan 17 7pm in Toronto!

 

Reminder and confirmed on Meetup on Pairs Trading with R Jan 17 7pm in Toronto!

Quant Finance Meetup member Alon Honig is stepping up to the plate. He has proposed topics including:

“Pairs Trading With R”
learn how to determine the profitability of a Pairs Trading arbitrage
strategy using the popular R program suite.
The presentation will include data and a complete R script so that you
may create and test your own strategies

Also:

I am currently running a side
statistical consulting business (in addition to my insurance
consulting job) that focuses on financial applications. I an very well
versed in R programming language and think that the members may
benefit from being introduced to this new platform.

the Presentation would follow the current format:
1) “quick” mathematical background on means (i.e. average) and medians
and how one calculates them
2) create an R function live that calculates the mean/median
3) explain the “pairs” trading strategy
3) apply both the statistical models to a pairs trading strategy
4) draw conclusions
5) questions

This will be a very good topic nad I like what I see in R so I am definitely going.
We are trying to sort the location for the NYorth Library or downtown still but
the date is firm at this point.

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Trading Membership with tick Forex database, Matlab/C++/C# video, historical db source code, Pairs Trading with R, NEW videos and jobs

Trading Membership with tick Forex database, Matlab/C++/C# video, historical db source code, Pairs Trading with R, NEW videos and jobs

Here is an email to my opt in email list:

Hi there

This has been a very long time coming. I have just launched our new live QuantLabs.net Premium Membership Service at:

http://quantlabs.net/membership.htm

There is a 50% discount as we head into Christmas but I will be increasing the rate first week of 2012.

Here are the benefits with the large amount of quant videos and software goodies I have added:

· Tracking daily profitable, high performing market securities

· Dozens of reports in popular formats which are generated daily by dozens of our proprietary models

· Bonus database manager which uses Yahoo Finance Data with over 35,000 stock symbols. Source code included.

· Bonus 2 year multi second tick FOREX database for 14 major currency pairs

· Multiple C++, C# source code projects and Matlab Coder demos for converting M script files to trading platforms

So get your initial membership here at http://quantlabs.net/membership.htm

I have added a few new YouTube videos including:

The Matlab and C++/C# secrets:

http://www.youtube.com/watch?v=qDRmVSBGofM&list=UUeYq5g4YHXzqDtFjGFhM_yw&index=1&feature=plcp

How to install and use multi second Forex tick database for back testing:

http://www.youtube.com/watch?v=ohGXInCUkYE&list=UUeYq5g4YHXzqDtFjGFhM_yw&index=2&feature=plcp

How to do quant finance trading with C++, C#, Matlab, MYSQL Ticks Forex Database

http://www.youtube.com/watch?v=WQNbNPlKse8&list=UUeYq5g4YHXzqDtFjGFhM_yw&index=3&feature=plcp

More jobs at my Linked In group where you need to join:

http://www.linkedin.com/groups/Looking-Application-Engineer-Control-Design-3427378.S.85276636?qid=e9d9e6ae-f51b-43a9-ada8-0904e693195e&trk=group_items_see_more-0-b-ttl

http://www.linkedin.com/groups/Looking-Sr-C-Developer-strong-3427378.S.84753888?qid=e9d9e6ae-f51b-43a9-ada8-0904e693195e&trk=group_items_see_more-0-b-ttl

http://www.linkedin.com/groups/Looking-Sr-C-Developer-strong-3427378.S.84753888?qid=e9d9e6ae-f51b-43a9-ada8-0904e693195e&trk=group_items_see_more-0-b-ttl

http://tbe.taleo.net/NA2/ats/careers/requisition.jsp?org=OCWEN&cws=4&rid=15104

New Toronto Meetup details with Pairs Trading in R:

http://www.meetup.com/quant-finance/events/44899052/

You need to register at Meetup.com to view.

Wow so much info. Got questions or comments? Let me know.

Also, Merry Xmas, and Have a good holiday season

Bryan at Quantlabs.net

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Quant Finance Toronto Meetup! Pairs Trading With R

Quant Finance Meetup member Alon Honig is stepping up to the plate. He has proposed topics including:

“Pairs Trading With R”
learn how to determine the profitability of a Pairs Trading arbitrage
strategy using the popular R program suite.
The presentation will include data and a complete R script so that you
may create and test your own strategies

Also:

I am currently running a side
statistical consulting business (in addition to my insurance
consulting job) that focuses on financial applications. I an very well
versed in R programming language and think that the members may
benefit from being introduced to this new platform.

the Presentation would follow the current format:
1) “quick” mathematical background on means (i.e. average) and medians
and how one calculates them
2) create an R function live that calculates the mean/median
3) explain the “pairs” trading strategy
3) apply both the statistical models to a pairs trading strategy
4) draw conclusions
5) questions

This will be a very good topic nad I like what I see in R so I am definitely going.
We are trying to sort the location for the NYorth Library or downtown still but
the date is firm at this point.

http://www.meetup.com/quant-finance/events/44899052/

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Hooray! My Pairs Trading Model is working again. It is back in action. See daily samples

Hooray! My Pairs Trading Model is working again. It is back in action. See daily samples

Just go to see thing in action:

http://quantlabs.net/private/2011/09/26/pairs-trading-combination-of-rtc-l-doe-to-jec-to-wfs-to-cym-to-dateseptember-26-2011-51604-258-pm/

 

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

WOW! New Pairs Trading model which only picks winning stock with average 10+% return on strategy portfolio

WOW! New Pairs Trading model which only picks winning stock with average 10+% return on strategy portfolio

I just did my first model and strategy. It picks the daily stock winners on a somewhat random basis. You will be able to get full report details with neat graph to go with it which measures long and the short. This will be only available in our premium membership advisory service. Join it now before we jack up the rates!!

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!