Click here to Login





                                                   Anyone have a working cointegration test, like Johansen?

  0

0
Josh McCormick
2020-09-17 20:47:34


I'm looking to use a cointegration test as part of a pairs trading strategy. The Johansen Test seems to have some good characteristics. Anyone have a working formula?

I'd implement one myself, but so far, I haven't found an explanation or existing implementation that doesn't cause my brain to hurt. :)

UPDATE: To explain more, QuantShare has a function for Correlation (how much two stocks generally move together) and for Covariance (how much two stocks generally move in the same direction), but not Cointegration (how likely it is for two stocks to revert back to a relative mean). From there you can generate some other variables, like the half-life of two stocks (how long it generally takes them to revert back to the mean) and then create some formulas to identify good pairs trade candidates.



Josh McCormick
2020-09-18 22:31:22

  0

I came across some a complete Johansen cointegration test GUI with source code. There are links below. If you use them, you'll have to cut and paste the whole thing. It looks like the Wayback Machine's URLs get mangled here in the forum.

DOWNLOAD PAGE:
================

https://web.archive.org/web/20130806005531/http://www.quantcode.com/modules/docmanager/view_file.php?curent_file=404&curent_dir=19

APPLICATION DISCUSSION:
===================

https://web.archive.org/web/20160501080214/http://www.quantcode.com/modules/mydownloads/singlefile.php?cid=15&lid=595

CREATING AND USING TEST DATA
=========================

https://web.archive.org/web/20161025043033/http://www.quantcode.com/modules/smartfaq/faq.php?faqid=103

Once downloaded, I believe the only two files you'll need are "MaxEigenData.cs" and "JohansenHelper.cs".

I was able to extract the source code just for the Johansen test itself, and I tried creating a new QuantShare function with it, but I couldn't clear all the errors and get it to compile. Until I gain more experience, this is beyond the level of what I can do with C#. If someone would like to give it a try, you not only have my blessing, you have my thanks as well.



No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Stochastic Cross Test V1.0
Metatrader Historical Data Downloader
Market trading rules
Design and backtest a trading system with two strategies
Strategy Indicator - Percent winning trades for a trading rule

How-to Lessons
How to speed up watchlist and screener plug-ins when working with...
How to copy and paste drawing tools
How to create a screen
How to drag & drop a stock to a static watchlist
How to create a moving average of an indicator

Related Forum Threads
Test Halloween Effect on Eurostoxx 50 last 20 years
NewPosition.IsLong working correctly?
Help From anyone in India
I have been thinking about automation...
conditional color not working

Blog Posts
Working with the formula editor
How to Create a Custom Real-Time Table using QS Trading Software
How to Create Your First Meta-Strategy
QuantShare Programming Language Tutorial
How to use QuantShare screener to trade penny stocks









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.