Forex 공적분 전략


Forex Pairs Trading의 통화 통합.
외환 거래의 통합은 중요한 도구입니다. 나에게 공적분은 훌륭한 경제적 중립적 기계 무역 전략의 토대가되어 경제적 환경에서 이익을 얻을 수있다. 시장이 상승 추세, 하락 추세 또는 단순히 옆으로 움직이든, 외환 거래는 일년 내내 이익을 얻을 수 있습니다.
공적분을 활용하는 외환 거래 전략은 통계적 재정 거래와 평균으로의 전환을 기반으로하는 컨버전스 거래의 한 형태로 분류됩니다. 이 유형의 전략은 1980 년대 모건 스탠리 (Morgan Stanley)의 양적 거래 팀이 주식 쌍을 사용하여 처음으로 대중화되었습니다. 그러나 다른 트레이더들도 외환 거래에서도 매우 효과적이라는 것을 알았습니다.
공적분에 기초한 외환 쌍 거래.
공적분에 기반한 외환 거래는 근본적으로 회귀 - 평균 전략입니다. 간단하게 말하면, 두 개 이상의 외환 쌍이 공적으로 통합 될 때, 이는 개별 외환 쌍들 사이의 가격 스프레드가 시간이 지남에 따라 일관되게 평균값으로 되돌아가는 경향이 있음을 의미합니다.
공적분은 상관 관계가 아니라는 것을 이해하는 것이 중요합니다. 상관 관계는 가격의 공동 움직임에 관한 단기간의 관계입니다. 상관 관계 란 개별 가격이 함께 움직이는 것을 의미합니다. 상관 관계는 일부 거래자에 의존하지만, 그 자체로는 신뢰할 수없는 도구입니다.
다른 한편, 공적분은 가격이 함께 움직이는 것처럼 특정 범위 또는 스프레드 내에서 함께 움직이는 가격의 공동 움직임과 장기적인 관계이다. 나는 공적분이 외환 거래에서 매우 유용한 도구라는 것을 알게되었습니다.
내 외환 거래 중 스프레드가 기계 거래 알고리즘에 의해 계산 된 한계 값까지 넓어지면 나는 쌍 가격 사이의 스프레드를 "짧게"합니다. 다시 말해서, 나는 공적분으로 인해 확산이 0으로 되돌아 갈 것을 내기하고있다.
기본 외환 거래 전략은 매우 간단합니다. 특히 기계 거래 시스템을 사용할 때 : 비슷한 방식으로 움직이는 두 가지 통화 쌍을 선택합니다. 나는 실적이 저조한 통화 쌍을 사고 외제를 판매합니다. 두 쌍 사이의 퍼짐이 수렴 할 때, 나는 이익을 위해 나의 입장을 마감한다.
공적분에 기반한 외환 거래는 시장 중립적 인 전략입니다. 예를 들어 통화 쌍이 폭락하면 거래가 장기적 측면에서 손실을 가져오고 단기적 측면에서 상쇄 효과가 발생할 수 있습니다. 따라서 모든 통화와 기본 상품이 갑자기 가치를 잃지 않는 한 최악의 시나리오에서는 순매수가 0에 가까워 야합니다.
같은 맥락으로, 많은 시장에서 페어 트레이딩은 자체 매매 트레이딩 전략이다. 왜냐하면 짧은 매도로부터 얻은 수익금이 때때로 긴 포지션을여는데 사용될 수 있기 때문이다. 이 혜택이 없다고하더라도, 공적분을 동원한 외환 거래 쌍은 여전히 ​​잘 작동합니다.
외환 거래를위한 공적분의 이해.
균형 환율은 단기 균형 가격뿐 아니라 장기적인 가격 기대치를 바탕으로 내 기계 거래 시스템을 프로그래밍 할 수있게 해주는 외환 거래 쌍방에서 유용합니다.
공적분 중심의 외환 거래의 작동 방식을 이해하려면 먼저 공적분을 정의한 다음 기계적 거래 시스템에서 어떻게 기능 하는지를 설명하는 것이 중요합니다.
앞에서 말했듯이, 공적분은 시계열 집합 사이의 평형 관계를 말합니다. 예를 들어, 균형이 맞지 않는 별도의 외환 쌍의 가격과 같은 시계열 집합 간의 균형 관계를 말합니다. 수학적 전문 용어로 표현되는 공적분 (cointegration)은 시계열에서 비정상 변수 간의 관계를 측정하는 기술입니다.
두 개 이상의 시계열이 각각 1의 루트 값을 가지지 만 선형 조합이 고정되어있는 경우 시계열은 공적분이라고합니다.
간단한 예로서, 주식 시장 지수와 관련 선물 계약의 가격을 고려해보십시오. 이 두 가지 상품의 가격이 단기간에 무작위로 방황 할 수도 있지만 궁극적으로는 균형으로 돌아갈 것이고 편차는 변화 없는.
고전적인 "무작위 걸음 걸이"예를 들어 설명하는 또 다른 예가 있습니다. 카 루핑 밤 이후에 집으로 걸어가는 두 명의 개별 술꾼이 있다고 가정 해 보겠습니다. 이 두 술주정 뱅이가 서로를 모르고 있다고 가정 해 봅시다. 그러므로 개별 경로 사이에 예측 가능한 관계는 없습니다. 그러므로 그들의 운동 사이에는 공적분이 없다.
대조적으로, 개가 가죽 끈에 그의 개를 동반하는 동안 각 술꾼이 귀환을 방황하고 있다는 생각을 고려하십시오. 이 경우, 이 두 가난한 생물의 경로 사이에는 확실한 연결 고리가 있습니다.
이 둘은 각각 단기간에 여전히 개별 통로를 유지하고 있지만 어느 한 쪽에서 어느 한 쪽이 임의로 특정 시점에 임의로 길을 가거나 늦을지라도 항상 가까이서 발견됩니다. 그들 사이의 거리는 상당히 예측 가능하기 때문에 쌍은 공적분이라고한다.
기술 용어로 돌아가서, 두 개의 비 정적 시계열 (예 : AB와 XY의 가상 쌍 집합)이있을 경우 이들의 차이가 계산 될 때 고정되어 있으며이 쌍을 통합 된 1 차 계열이라고합니다. 또한 I (1) 시리즈를 부르십시오.
이 시리즈들 중 어떤 것도 일정한 값을 유지하지 않더라도 고정 된 AB와 XY의 선형 조합 (I (0)으로 표시)이 있으면 AB와 XY가 공적분됩니다.
위의 간단한 예는 가상의 외환 쌍의 두 시계열로만 구성됩니다. 그러나 공적분의 개념은 더 높은 통합 주문을 사용하는 여러 시계열에도 적용됩니다 ... 여러 개의 개가 각각 다른 길이의 가죽 끈을 동반 한 방랑 술에 관해 생각해보십시오.
실 사회 경제학에서는 소득과 지출, 또는 형법의 엄격함과 감옥 인구의 크기와 같은 쌍의 공적분을 보여주는 사례를 찾는 것이 쉽습니다. 외환 거래에서, 내 초점은 통화의 공적분 된 쌍 사이의 양적 및 예측 가능한 관계를 활용하는 데 있습니다.
예를 들어, 나는이 두 가지 공적분 화 된 가상 통화 쌍인 AB와 XY를보고 있다고 가정하고 그들 사이의 공적분 관계는 AB & # 8211; XY = Z, 여기서 Z는 평균이 0 인 정지 시리즈, 즉 I (0)입니다.
이것은 간단한 거래 전략을 제안하는 것처럼 보일 것이다 : AB-XY & gt; V 및 V가 내 임계 값 트리거 가격 인 경우 AB가 가격이 하락하고 XY가 증가 할 것으로 예상되므로 외환 거래 시스템이 AB를 판매하고 XY를 구매합니다. 또는, AB-XY < - V, 나는 AB를 사고 XY를 팔 것을 기대할 것입니다.
외환 거래에서 가짜 회귀를 피하십시오.
그러나 위의 예에서 제안하는 것처럼 간단하지 않습니다. 실제로, 외환 거래를위한 기계 거래 시스템은 AB와 XY 사이의 R 제곱 값에 의존하는 대신 공적분을 계산해야합니다.
비상업적 인 변수를 다루는 경우 일반 회귀 분석이 부족하기 때문입니다. 그것은 소위 가짜 회귀 (spurious regression)를 야기하는데, 이것은 변수가없는 경우에도 변수들 간의 관계를 암시합니다.
예를 들어, 나는 서로에 대해 2 개의 분리 된 "무작위 걸음"시계열을 회귀 시킨다고 가정 해보자. 선형 관계가 있는지 테스트 할 때 매우 자주 p 값이 낮은 R - 제곱 값과 높은 p 값을 찾습니다. 아직도, 이 2 개의 무작위 도보 사이 아무 관계도 없다.
외환 거래의 공적분 수식 및 테스트.
공적분을위한 가장 간단한 테스트는 다음과 같이 작동하는 Engle-Granger 테스트입니다.
AB t와 XY t가 둘 다 I가 맞는지 확인한다. (1) 최소 제곱 법을 사용하여 공적분 관계 [XY t = aAB t + et]를 계산한다. 공적분 잔차 등이 Augmented Dickey-Fuller (ADF) 테스트.
자세한 그레인저 방정식 :
I (0)은 공적분 관계를 설명한다.
XY t-1? ? AB t-1은 장기간에 걸친 불균형의 정도를 설명하는 반면, Δi는 통화 쌍의 시계열이 불균형으로부터 스스로를 교정하는 속도와 방향이다.
외환 거래에서 Engle-Granger 방법을 사용하는 경우 회귀의 베타 값을 사용하여 쌍의 거래 규모를 계산합니다.
외환 거래에서 Engle-Granger 방법을 사용하면 회귀의 베타 값이 쌍의 거래 크기를 계산하는 데 사용됩니다.
외환 거래에서 공적분에 대한 오차 보정 :
외환 거래를 위해 공적분을 사용할 때, 공적분 된 변수가 조정되고 장기 균형으로 어떻게 돌아갈지를 설명하는 것도 도움이됩니다. 예를 들어, 여기에 두 개의 샘플 외환 쌍 시계열이 자동 회귀 적으로 표시됩니다.
공적분에 기초한 외환 쌍 거래.
외환 거래를위한 기계 거래 시스템을 사용할 때 설치와 실행은 매우 간단합니다. 첫째, 나는 그들이 EUR / USD와 GBP / USD와 같이 공적화 될 수있는 것처럼 보이는 두 개의 통화 쌍을 찾는다.
그런 다음 두 쌍 간의 예상 스프레드를 계산합니다. 다음으로, unit-root 테스트 또는 다른 일반적인 방법을 사용하여 스테 틀러 리티를 확인합니다.
내 인바운드 데이터 피드가 제대로 작동하는지 확인하고 기계적 거래 알고리즘이 거래 신호를 생성하도록합니다. 매개 변수를 확인하기 위해 적절한 백 테스트를 수행했다고 가정하면 마침내 내 외환 거래에서 공적분을 사용할 준비가되었습니다.
나는 Cointegration 외환 거래 시스템을 구축하기위한 훌륭한 출발점을 제공하는 MetaTrader 지표를 발견했습니다. 그것은 Bollinger Band 표시기처럼 보이지만 사실 오실레이터는 두 개의 서로 다른 통화 쌍 사이의 가격 차이를 보여줍니다.
이 오실레이터가 높은 극단 또는 저 극단으로 이동하면 페어가 디커플링 (decoupling)되어 거래를 알리는 신호입니다.
그래도 성공을 확신하려면 적절한 거래를 실행하기 전에 Augmented Dickey-Fuller 테스트를 통해 신호를 필터링하는 내 기계적 거래 시스템을 사용해야합니다.
물론 자신의 외환 거래를 위해 공적분을 사용하고자하는 사람은 아직 알 고 프로그래밍 기술이 부족하여 숙련 된 프로그래머가 성공한 전문가 고문을 의뢰 할 수 있습니다.
알고리즘 트레이딩의 마법을 통해 데이터 분석을 기반으로 가격 스프레드를 정의하는 기계 거래 시스템을 프로그래밍합니다. 내 알고리즘은 가격 편차를 모니터링 한 다음 시장 비효율을 수확하기 위해 통화 쌍을 자동으로 구매 및 판매합니다.
외환 거래와 함께 공적분을 사용할 때주의해야 할 위험.
Forex 쌍 거래는 전적으로 위험 부담이 없습니다. 무엇보다도 공적분을 사용하는 외환 거래는 평균 가치가 과거와 마찬가지로 미래에도 동일 할 것이라는 가정에 근거한 평균 회귀 전략입니다.
앞에서 언급 한 Augmented Dickey-Fuller 테스트는 외환 거래를위한 공적분 관계를 검증하는 데 도움이되지만 미래에 스프레드가 계속해서 공적분 될 것이라는 의미는 아닙니다.
강력한 리스크 관리 규칙에 의거합니다. 즉, 계산 된 역 환위가 무효화되는 경우 또는 내 기계 거래 시스템이 수익성이없는 거래에서 나옵니다.
평균값이 바뀌면 표류가됩니다. 나는 가능한 빨리 표류를 탐지하려고 노력한다. 다시 말하면 이전에 공적화 된 외환 쌍의 가격이 이전에 계산 된 평균으로 되돌아가는 대신 추세로 움직이기 시작하면 내 기계 거래 시스템의 알고리즘이 가치를 다시 계산해야 할 때입니다.
외환 거래를위한 기계 거래 시스템을 사용할 때이 기사 앞부분에서 언급 한 자기 회귀 식을 사용하여 스프레드를 예측하는 이동 평균을 계산합니다. 그런 다음 계산 된 오류 범위에서 거래를 종료합니다.
Cointegration는 나의 forex 쌍 무역을위한 귀중한 공구이다.
외환 거래에서 공적분 사용은 시장 중립적 인 기계 무역 전략으로 어떤 시장 환경에서도 거래가 가능합니다. 그것은 의미로의 복귀에 기반을 둔 현명한 전략이지만, 다른 회귀 수단을 의미하는 외환 거래 전략의 함정을 피하는 데 도움이됩니다.
수익성있는 기계 거래 시스템에서의 잠재적 인 사용 때문에 외환 거래를위한 공적분은 학술 연구자 및 전문 상인 모두의 관심을 끌었습니다.
이 양에 초점을 맞춘 블로그 기사 또는 주제에 대한이 학술 토론과 거래자 간의 토론에 대해 많은 최근 출판 된 기사가 많이 있습니다.
Cointegration는 나의 Forex 한 쌍 무역에있는 귀중한 공구이고, 나는 당신이 너 자신을 위해 그것으로 볼 것을 강력하게 추천한다.
Tommaso Sillian이 말합니다.
아주 좋은 기사. 그것은 고무적이다. 그것을 쓰는 주셔서 감사합니다!
Harish Nachnani는 말합니다.
상관 관계는 주식 (지분)에도 적용됩니다. 그 차이점은 무엇입니까? 위의 과정을 주식에 적용 할 수 있습니까?
에디 플라워 (Eddie Flower)는 말한다.
예. 동일한 프로세스가 주식 및 파생 상품에 적용될 수 있습니다. 외환 쌍과 비교할 때 주식의 그런 큰 우주가 있기 때문에, 거래를위한 잠재적 인 기회의 더 많은 수가 있어야합니다. 오늘날의 거래 시스템의 수 많은 기능을 통해 많은 관계 세트를 실시간으로 신속하게 조사 할 수 있습니다. 또한 옵션 통합 자들에 의해 공적분을 사용할 수 있습니다. 특정 종목 / 옵션 간의 가격 관계로 인해 거래자가 상당히 위험한 종목에 참여할 수있는 인기있는 코카 콜라 - 펩시 스프레드와 같은 결과를 기대할 수 있습니다.
Harish Nachnani는 말합니다.
이 전략을 사용하여 일주일 또는 수주에 걸쳐 거래합니까? 또한, 어떤 프로그래밍 언어를 권하고 싶습니다. R은 계산을 실행하는 데 시간이 걸리며 일간 거래 일 경우 지연이 발생합니다.
프로그래밍 언어는 하루 종일 거래의 중요성을 느끼지 못합니다. Perl, Python, C / C ++ 및 C #과 같은 주요 언어도 좋습니다. R은 매우 빠르지 만 메모리를 동적으로 할당해야하는 경우 느려집니다.
나는 매일 차트를 사용하여 거래하며 2 ~ 2 주 동안 대부분의 거래를 유지합니다. Shaun은 전문 프로그래머이며, 주어진 거래 전략에 대해 최상의 결과를 얻으려면 항상 최상의 프로그래밍 언어를 사용하는 자신의 판단을 신뢰합니다. 사실, Shaun은 공적분 및 기타 요소를 활용할 수있는 균형 잡힌 성과를 거둔 프로그램을 만들 수 있습니다. 견적을 원하신다면 즉시 연락하십시오.
Chris Zimmer는 말합니다.
이 MT4의 구현에는 약간의 관심이 있습니다. 코드에서이 전략을 구현 한 세부 사항을 제공 할 수 있으면 czimmeronestepremoved로 보내주십시오.
나는 나의 석사를 위해 FX에서 공적분 전략에 관한 작은 프로젝트를하고있다. 나는 많은 통화 쌍에 대한 공적분 테스트를 실시했다고 생각합니다. 통계적으로 크게 공적분을 발견 한 사람은 누구입니까?
Eddie가 실제로 숫자를 사용했다고 생각하지 않습니다. 이 기사는 개념에 대한 전반적인 가이드가 되려고하지만 진실한 전략이 될 수는 없습니다.
1) USD / JPY 및 EUR / CHF.
2) EUR / PLN 및 EUR / HUF.
3) USD / TRY 및 USD / ZAR.
4) AUD / USD 및 NZD / USD.
5) EUR / NOK 및 EUR / SEK.
나는이 것들이 상당히 상관 관계가 있다는 것을 알고 있지만 그것은 공적분을 암시하지 않는다.
Camilo Romero는 말합니다.
좋은 외환 쌍이 공적합니다 :
시장 중립적 인 전략이 없기 때문에 USDJPY / EURCHF는 공적분이 될 것입니다.
공유해 주셔서 감사합니다.
Camilo Romero는 말합니다.
누구든지 평균 회귀 전략을 사용하여 백 테스트 코드를 구현 했습니까?
나는 두 개의 외환 쌍 사이에 pip 값을 주어야합니까?
누구든지 코드 백 테스트 비용을 추가하고 수익성있는 결과를 얻었습니까?
나는 누군가가 가지고 있다고 확신하지만 단기 차트에 대해 확실한 답을 찾을 수있는 곳이 아닙니다. 여러분은 장기적인 공동 연구를 할 수는 있지만, 제가 한 연구는 아닙니다.
유일한 공적분은 유로와 CHF 그리고 AUD와 NZD 간의 유일한 친목 무역이며, 이 국가와 중앙 은행 간의 경제는이 공적분을 창출하고있다.
EUR 및 GBP가 아닌가요?
Robert J Armagost가 말했습니다.
안녕, 에디. 훌륭한 기사. 나는 10 년 동안의 차트를 생각하면서 테스트 해 보았습니다. & # 8221; 나는 이것을 생각한 최초의 사람이 될 수 없다! & # 8221; 이 사이트를 발견했을 때. 이것을 작성해 주셔서 대단히 감사드립니다. 더 이상 혼자라고 느끼지 않습니다. ?? 어떤 브로커를 사용하는지 궁금하거나 여러 중개인을 사용하십니까? 시간 내 줘서 고마워.
근실하게 로버트 J. Armagost.
내가 사용하는 주요 브로커는 Pepperstone과 STO (TopTradr를 통해)입니다.
안녕하세요 Shaun 저는이 전략을 수동으로 거래 해 왔습니다. 이것을 자동화 할 소프트웨어가 있습니까? (그래서 더 이상 심야에 일어나지 않아도됩니다.) 시간 내 주셔서 감사합니다.
선반에서 벗어나지 만 우리가 만들 수있는 무언가입니다. 견적을 얻기 위해 입장 및 퇴장 규정에 저를 쏴주세요. infeestestremoved.
로버트 & # 8212; 좋은 의견에 감사드립니다. Shaun은 이러한 유형의 거래 전략을 구현할 수있는 올바른 도구를 보유하고 있으며, 그의 브로커 권고 사항에 전적으로 동의합니다. EF.

Forex Pairs Trading의 통화 통합.
외환 거래의 통합은 중요한 도구입니다. 나에게 공적분은 훌륭한 경제적 중립적 기계 무역 전략의 토대가되어 경제적 환경에서 이익을 얻을 수있다. 시장이 상승 추세, 하락 추세 또는 단순히 옆으로 움직이든, 외환 거래는 일년 내내 이익을 얻을 수 있습니다.
공적분을 활용하는 외환 거래 전략은 통계적 재정 거래와 평균으로의 전환을 기반으로하는 컨버전스 거래의 한 형태로 분류됩니다. 이 유형의 전략은 1980 년대 모건 스탠리 (Morgan Stanley)의 양적 거래 팀이 주식 쌍을 사용하여 처음으로 대중화되었습니다. 그러나 다른 트레이더들도 외환 거래에서도 매우 효과적이라는 것을 알았습니다.
공적분에 기초한 외환 쌍 거래.
공적분에 기반한 외환 거래는 근본적으로 회귀 - 평균 전략입니다. 간단하게 말하면, 두 개 이상의 외환 쌍이 공적으로 통합 될 때, 이는 개별 외환 쌍들 사이의 가격 스프레드가 시간이 지남에 따라 일관되게 평균값으로 되돌아가는 경향이 있음을 의미합니다.
공적분은 상관 관계가 아니라는 것을 이해하는 것이 중요합니다. 상관 관계는 가격의 공동 움직임에 관한 단기간의 관계입니다. 상관 관계 란 개별 가격이 함께 움직이는 것을 의미합니다. 상관 관계는 일부 거래자에 의존하지만, 그 자체로는 신뢰할 수없는 도구입니다.
다른 한편, 공적분은 가격이 함께 움직이는 것처럼 특정 범위 또는 스프레드 내에서 함께 움직이는 가격의 공동 움직임과 장기적인 관계이다. 나는 공적분이 외환 거래에서 매우 유용한 도구라는 것을 알게되었습니다.
내 외환 거래 중 스프레드가 기계 거래 알고리즘에 의해 계산 된 한계 값까지 넓어지면 나는 쌍 가격 사이의 스프레드를 "짧게"합니다. 다시 말해서, 나는 공적분으로 인해 확산이 0으로 되돌아 갈 것을 내기하고있다.
기본 외환 거래 전략은 매우 간단합니다. 특히 기계 거래 시스템을 사용할 때 : 비슷한 방식으로 움직이는 두 가지 통화 쌍을 선택합니다. 나는 실적이 저조한 통화 쌍을 사고 외제를 판매합니다. 두 쌍 사이의 퍼짐이 수렴 할 때, 나는 이익을 위해 나의 입장을 마감한다.
공적분에 기반한 외환 거래는 시장 중립적 인 전략입니다. 예를 들어 통화 쌍이 폭락하면 거래가 장기적 측면에서 손실을 가져오고 단기적 측면에서 상쇄 효과가 발생할 것입니다. 따라서 모든 통화와 기본 상품이 갑자기 가치를 잃지 않는 한 최악의 시나리오에서는 순매수가 0에 가까워 야합니다.
같은 맥락으로, 많은 시장에서 페어 트레이딩은 자체 매매 트레이딩 전략이다. 왜냐하면 짧은 매도로부터 얻은 수익금이 때때로 긴 포지션을여는데 사용될 수 있기 때문이다. 이 혜택이 없다고하더라도, 공적분을 동원한 외환 거래 쌍은 여전히 ​​잘 작동합니다.
외환 거래를위한 공적분의 이해.
균형 환율은 단기 균형 가격뿐 아니라 장기적인 가격 기대치를 바탕으로 내 기계 거래 시스템을 프로그래밍 할 수있게 해주는 외환 거래 쌍방에서 유용합니다.
공적분 중심의 외환 거래의 작동 방식을 이해하려면 먼저 공적분을 정의한 다음 기계적 거래 시스템에서 어떻게 기능 하는지를 설명하는 것이 중요합니다.
앞에서 말했듯이, 공적분은 시계열 집합 사이의 평형 관계를 말합니다. 예를 들어, 균형이 맞지 않는 별도의 외환 쌍의 가격과 같은 시계열 집합 간의 균형 관계를 말합니다. 수학적 전문 용어로 표현되는 공적분 (cointegration)은 시계열에서 비정상 변수 간의 관계를 측정하는 기술입니다.
두 개 이상의 시계열이 각각 1의 루트 값을 가지지 만 선형 조합이 고정되어있는 경우 시계열은 공적분이라고합니다.
간단한 예로서, 주식 시장 지수와 관련 선물 계약의 가격을 고려해보십시오. 이 두 가지 상품의 가격이 단기간에 무작위로 방황 할 수도 있지만 궁극적으로는 균형으로 돌아갈 것이고 편차는 변화 없는.
고전적인 "무작위 걸음 걸이"예를 들어 설명하는 또 다른 예가 있습니다. 카 루핑 밤 이후에 집으로 걸어가는 두 명의 개별 술꾼이 있다고 가정 해 보겠습니다. 이 두 술주정 뱅이가 서로를 모르고 있다고 가정 해 봅시다. 그러므로 개별 경로 사이에 예측 가능한 관계는 없습니다. 그러므로 그들의 운동 사이에는 공적분이 없다.
대조적으로, 개가 가죽 끈에 그의 개를 동반하는 동안 각 술꾼이 귀환을 방황하고 있다는 생각을 고려하십시오. 이 경우, 이 두 가난한 생물의 경로 사이에는 확실한 연결 고리가 있습니다.
이 둘은 각각 단기간에 여전히 개별 통로를 유지하고 있지만 어느 한 시점에서 어느 한 시점에서 어느 한 시점에서 임의로 다른 지점까지 임의로 리드하거나 지연 할 수 있지만 여전히 항상 가까운 지점에서 발견됩니다. 그들 사이의 거리는 상당히 예측 가능하기 때문에 쌍은 공적분이라고한다.
기술 용어로 돌아가서, 두 개의 비 정적 시계열 (예 : AB와 XY의 가상 쌍 집합)이있을 경우 이들의 차이가 계산 될 때 고정되어 있으며이 쌍을 통합 된 1 차 계열이라고합니다. 또한 I (1) 시리즈를 부르십시오.
이 시리즈들 중 어떤 것도 일정한 값을 유지하지 않더라도 고정 된 AB와 XY의 선형 조합 (I (0)으로 표시)이 있으면 AB와 XY가 공적분됩니다.
위의 간단한 예는 가상의 외환 쌍의 두 시계열로만 구성됩니다. 그러나 공적분의 개념은 더 높은 통합 주문을 사용하는 여러 시계열에도 적용됩니다 ... 여러 개의 개가 각각 다른 길이의 가죽 끈을 동반 한 방랑 술에 관해 생각해보십시오.
실 사회 경제학에서는 소득과 지출, 또는 형법의 엄격함과 감옥 인구의 크기와 같은 쌍의 공적분을 보여주는 사례를 찾는 것이 쉽습니다. 외환 거래에서, 내 초점은 통화의 공적분 된 쌍 사이의 양적 및 예측 가능한 관계를 활용하는 데 있습니다.
예를 들어, 나는이 두 가지 공적분 화 된 가상 통화 쌍인 AB와 XY를보고 있다고 가정하고 그들 사이의 공적분 관계는 AB & # 8211; XY = Z, 여기서 Z는 평균이 0 인 정지 시리즈, 즉 I (0)입니다.
이것은 간단한 거래 전략을 제안하는 것처럼 보일 것이다 : AB-XY & gt; V 및 V가 내 임계 값 트리거 가격 인 경우 AB가 가격이 하락하고 XY가 증가 할 것으로 예상되므로 외환 거래 시스템이 AB를 판매하고 XY를 구매합니다. 또는, AB-XY < - V, 나는 AB를 사고 XY를 팔 것을 기대할 것입니다.
외환 거래에서 가짜 회귀를 피하십시오.
그러나 위의 예에서 제안하는 것처럼 간단하지 않습니다. 실제로, 외환 거래를위한 기계 거래 시스템은 AB와 XY 사이의 R 제곱 값에 의존하는 대신 공적분을 계산해야합니다.
비상업적 인 변수를 다루는 경우 일반 회귀 분석이 부족하기 때문입니다. 그것은 소위 가짜 회귀 (spurious regression)를 야기하는데, 이것은 변수가없는 경우에도 변수들 간의 관계를 암시합니다.
예를 들어, 나는 서로에 대해 2 개의 "무작위 걸음 걸이"시계열을 회귀 시킨다고 가정 해보자. 선형 관계가 있는지 테스트 할 때 매우 자주 p 값이 낮은 R - 제곱 값과 높은 p 값을 찾습니다. 아직도, 이 2 개의 무작위 도보 사이 아무 관계도 없다.
외환 거래의 공적분 수식 및 테스트.
공적분을위한 가장 간단한 테스트는 다음과 같이 작동하는 Engle-Granger 테스트입니다.
AB t와 XY t가 둘 다 I가 맞는지 확인한다. (1) 최소 제곱 법을 사용하여 공적분 관계 [XY t = aAB t + et]를 계산한다. 공적분 잔차 등이 Augmented Dickey-Fuller (ADF) 테스트.
자세한 그레인저 방정식 :
I (0)은 공적분 관계를 설명한다.
XY t-1 - βAB t-1은 장기간에 걸친 불균형의 정도를 설명하는 반면, αi는 통화 쌍의 시계열이 불균형으로부터 스스로를 교정하는 속도와 방향이다.
외환 거래에서 Engle-Granger 방법을 사용하면 회귀의 베타 값이 쌍의 거래 크기를 계산하는 데 사용됩니다.
외환 거래에서 Engle-Granger 방법을 사용하면 회귀의 베타 값이 쌍의 거래 크기를 계산하는 데 사용됩니다.
외환 거래에서 공적분에 대한 오차 보정 :
외환 거래를 위해 공적분을 사용할 때, 공적분 된 변수가 조정되고 장기 균형으로 어떻게 돌아갈지를 설명하는 것도 도움이됩니다. 예를 들어, 다음은 두 개의 샘플 외환 쌍의 시계열이 자동 회귀 적으로 표시되는 것입니다.
공적분에 기초한 외환 쌍 거래.
외환 거래를 위해 기계 거래 시스템을 사용하면 설치와 실행이 매우 간단합니다. 첫째, 나는 그들이 EUR / USD와 GBP / USD와 같이 공적화 될 수있는 것처럼 보이는 두 개의 통화 쌍을 찾는다.
그런 다음 두 쌍 간의 예상 스프레드를 계산합니다. 다음으로, unit-root 테스트 또는 다른 일반적인 방법을 사용하여 스테 틀러 리티를 확인합니다.
내 인바운드 데이터 피드가 제대로 작동하는지 확인하고 기계적 거래 알고리즘이 거래 신호를 생성하도록합니다. 매개 변수를 확인하기 위해 적절한 백 테스트를 수행했다고 가정하면 마침내 내 외환 거래에서 공적분을 사용할 준비가되었습니다.
나는 공적분 외환 거래 시스템을 구축하기위한 훌륭한 출발점을 제공하는 MetaTrader 지표를 발견했습니다. 그것은 Bollinger Band 표시기처럼 보이지만 사실 오실레이터는 두 개의 서로 다른 통화 쌍 사이의 가격 차이를 보여줍니다.
이 오실레이터가 높은 극단 또는 저 극단으로 이동하면 페어가 디커플링 (decoupling)되어 거래를 알리는 신호입니다.
그래도 성공을 확신하려면 적절한 거래를 실행하기 전에 Augmented Dickey-Fuller 테스트를 통해 신호를 필터링하는 내 기계적 거래 시스템을 사용해야합니다.
물론 자신의 외환 거래를 위해 공적분을 사용하고자하는 사람은 아직 알 고 프로그래밍 기술이 부족하여 숙련 된 프로그래머가 성공한 전문가 고문을 의뢰 할 수 있습니다.
알고리즘 트레이딩의 마법을 통해 데이터 분석을 기반으로 가격 스프레드를 정의하는 기계 거래 시스템을 프로그래밍합니다. 내 알고리즘은 가격 편차를 모니터링 한 다음 시장 비효율을 수확하기 위해 통화 쌍을 자동으로 구매 및 판매합니다.
외환 거래와 함께 공적분을 사용할 때주의해야 할 위험.
Forex 쌍 거래는 전적으로 위험 부담이 없습니다. 무엇보다도 공적분을 사용하는 외환 거래는 평균 가치가 과거와 마찬가지로 미래에도 동일 할 것이라는 가정에 근거한 평균 회귀 전략입니다.
앞에서 언급 한 Augmented Dickey-Fuller 테스트는 외환 거래를위한 공적분 관계를 검증하는 데 도움이되지만 미래에 스프레드가 계속해서 공적분 될 것이라는 의미는 아닙니다.
강력한 리스크 관리 규칙에 의거합니다. 즉, 계산 된 역 환위가 무효화되는 경우 또는 내 기계 거래 시스템이 수익성이없는 거래에서 나옵니다.
평균값이 바뀌면 표류가됩니다. 가능한 한 빨리 드리프트를 감지하려고합니다. 다시 말하면 이전에 공적화 된 외환 쌍의 가격이 이전에 계산 된 평균으로 되돌아가는 대신 추세로 움직이기 시작하면 내 기계 거래 시스템의 알고리즘이 가치를 다시 계산해야 할 때입니다.
외환 거래를위한 기계 거래 시스템을 사용할 때이 기사 앞부분에서 언급 한 자기 회귀 식을 사용하여 스프레드를 예측하는 이동 평균을 계산합니다. 그런 다음 계산 된 오류 범위에서 거래를 종료합니다.
Cointegration는 나의 forex 쌍 무역을위한 귀중한 공구이다.
외환 거래에서 공적분 사용은 시장 중립적 인 기계 무역 전략으로 어떤 시장 환경에서도 거래가 가능합니다. 그것은 의미로의 복귀에 기반을 둔 현명한 전략이지만, 다른 회귀 수단을 의미하는 외환 거래 전략의 함정을 피하는 데 도움이됩니다.
수익성있는 기계 거래 시스템에서의 잠재적 인 사용 때문에 외환 거래를위한 공적분은 학술 연구자 및 전문 상인 모두의 관심을 끌었습니다.
이 양에 초점을 맞춘 블로그 기사 또는 주제에 대한이 학술 토론과 거래자 간의 토론에 대해 많은 최근 출판 된 기사가 많이 있습니다.
Cointegration는 나의 Forex 한 쌍 무역에있는 귀중한 공구이고, 나는 당신이 너 자신을 위해 그것으로 볼 것을 강력하게 추천한다.
Tommaso Sillian이 말합니다.
아주 좋은 기사. 그것은 고무적이다. 그것을 쓰는 주셔서 감사합니다!
Harish Nachnani는 말합니다.
상관 관계는 주식 (지분)에도 적용됩니다. 그 차이점은 무엇입니까? 위의 과정을 주식에 적용 할 수 있습니까?
에디 플라워 (Eddie Flower)는 말한다.
예. 동일한 프로세스가 주식 및 파생 상품에 적용될 수 있습니다. 외환 쌍과 비교할 때 주식의 그런 큰 우주가 있기 때문에, 거래를위한 잠재적 인 기회의 더 많은 수가 있어야합니다. 오늘날의 거래 시스템의 수 많은 기능을 통해 많은 관계 세트를 실시간으로 신속하게 조사 할 수 있습니다. 또한 옵션 통합 자들에 의해 공적분을 사용할 수 있습니다. 특정 종목 / 옵션 간의 가격 관계로 인해 거래자가 상당히 위험한 종목에 참여할 수있는 인기있는 코카 콜라 - 펩시 스프레드와 같은 결과를 기대할 수 있습니다.
Harish Nachnani는 말합니다.
이 전략을 사용하여 일주일 또는 수주에 걸쳐 거래합니까? 또한, 어떤 프로그래밍 언어를 권하고 싶습니다. R은 계산을 실행하는 데 시간이 걸리며 일간 거래 일 경우 지연이 발생합니다.
프로그래밍 언어는 하루 종일 거래의 중요성을 느끼지 못합니다. Perl, Python, C / C ++ 및 C #과 같은 주요 언어도 좋습니다. R은 매우 빠르지 만 메모리를 동적으로 할당해야하는 경우 느려집니다.
I trade using daily charts, and I stay in most trades for a couple of days to a couple of weeks. Shaun is an expert programmer, and I always trust his judgment to use the best programming language to obtain the best results for a given trading strategy. In fact, Shaun can create a well-balanced, winning program to leverage cointegration and other factors as well. If you’d like a quote, please contact him directly at infoonestepremoved.
Chris Zimmer says.
There is some interest in an implementation of this for MT4. If you can you provide some specifics on your implementation of this strategy in code, please send to czimmeronestepremoved.
I am doing a small project on cointegration strategies in FX for my MSc. I believe you ran cointegration tests on a lot of currency pairs. Which ones did you find to be statistically significantly cointegrated?
I don’t think Eddie actually ran the numbers. The article is intended to be an overall guide to the concept, but not quite to the point of being a bona fide strategy.
1) USD/JPY and EUR/CHF.
2) EUR/PLN and EUR/HUF.
3) USD/TRY and USD/ZAR.
4) AUD/USD and NZD/USD.
5) EUR/NOK and EUR/SEK.
I know these ones are quite highly correlated, but that doesn’t imply cointegration.
Camilo Romero says.
There are good forex pairs cointegrated:
I don’t thing USDJPY / EURCHF would be a cointegrated pair because there will not be a market-neutral strategy.
공유해 주셔서 감사합니다.
Camilo Romero says.
Has anyone implemented a backtest code using mean reversion strategy?
Should I ajust pip values between two forex pairs?
Has anyone added commission cost to backtest code and got profitable results?
I’m sure someone has, but it’s not something where you’re going to find an obvious answer on short term charts. You may find long term cointegrations, but that’s not research I’ve done.
The only cointegration is between EUR and CHF and between AUD and NZD since are the only intimate trade and economics between this countries and central banks are creating this cointegration.
Not EUR and GBP?
Robert J Armagost says.
Hello Eddie. 훌륭한 기사. I have been back testing 10 years of charts thinking ” I can’t be the first person to have thought of this!” when I found this site. Thanks so much for writing this. I don’t feel quite so alone anymore. 🙂 Just wondering which broker you use or do you use multiple brokers. 시간 내 줘서 고마워.
Sincerely Robert J. Armagost.
The main broker that I use is Pepperstone and STO (via TopTradr).
Hello Shaun I have been trading this strategy manually. Do have software to automate this? (So I don’t have to get up in the middle of the night anymore) Thanks for your time.
Not off the shelf, but it’s something that we can build. Shoot me an with your entry and exit rules to get an estimate. infoonestepremoved.
Robert — Thanks for your good feedback. Shaun has the right tools to implement this type of trading strategy, and I entirely agree with his broker recommendations, Thanks again for commenting! EF.

기계적인 Forex.
기계 거래 전략을 사용하여 외환 시장에서 거래합니다.
Cointegration in the Forex market.
From the many different types of statistical arbitrage available, pairs trading is perhaps one of the most popular. In pairs trading a trader will attempt to exploit the linear relationship between the values of two instruments, attempting to buy/sell them when the relationship between their values increases/decreases to values that offer enough profit potential. However pairs trading does not only require a linear correlation to exist but it also requires the instruments to be cointegrated, a fundamental property that ensures a fundamental connection between the instruments that diminishes the probability of the spread between both instruments “blowing up” (widening far beyond what is statistically expected). Although pairs trading is usually described in stocks/commodities, we rarely see any study of cointegration in the FX market. Today we’re going to look at some potential cointegrations in the FX market, why they exist and how they might be exploited.
Let us begin by defining what we mean by cointegration. Two series are cointegrated when they share a common stochastic drift. The typical example to explain cointegration talks about a man who goes to a bar with his dog. After getting drunk and leaving the bar both the man and the dog walk the same path home, although their stochastic drift – which is the random way in which the man walks and the dog wonders along the way – are different. When this happens their paths are in fact correlated but they are not cointegrated. If the man instead decides to put a leash on the dog their paths become cointegrated because they now share a common stochastic drift that is determined by the length of the leash. The man and the dog cannot be separated further than their leash allows, which makes any random movements they make beyond a certain length common to both (as they would pull on each other). In statistics we can evaluate for cointegration using several different tests from which theВ Augmented Dickey-Fuller (ADF) test is most popularly used. Note that this test evaluates only stationarity – not exactly cointegration – so another test such as a Johansen test is necessary to confirm cointegration.
When looking at classic examples of cointegration in financial time series you’ll notice that instruments that are cointegrated generally have some strong fundamental reasons to be cointegrated. The “leash” is a fundamental relationship between both instruments, their common stochastic drift. This relationship is usually very strong, for example two oil producing companies that share refineries in broadly the same countries and have the same clients, they are so tightly put together that it is very improbable for any random event to affect one without affecting the other. This is what makes deviations so tantalizing to exploit. В In Forex however, the story is a bit different because countries have a very hard time being so fundamentally similar.
You can actually see this easily when you look at the last year of data for several FX pairs that we usually view as correlated. For example the EUR/USD and GBP/USD traditionally have a large correlation. A normalized plot showing the last year of data shows you that both pairs indeed tend to move in the same direction but it is clear that this relationship does not follow the same stochastic drift. An ADF test using the last year of data for these two pairs will give you a value of 0.28 which is simply far too large to reject the null hypothesis. Looking at other similar pairs reveals very similar results, pairs like AUDUSD|NZDUSD – which are even more correlated than the EURUSD|GBPUSD turn out to also not be cointegrated.
So are there any cointegrations in the FX market? Actually the answer is yes. The Swiss National Bank’s decision to create a floor on the EURCHF at 1.20 generated a “leash” that made several pairs share a stochastic drift. For example the EURUSD and the CHFUSD are now cointegrated due to this fact. An ADF test will give you a value less than 0.01 for this pair, suggesting that they are indeed cointegrated (confirmed by the Johansen test as well). All similar CHF containing pairs also show cointegrations, such as the EURJPY|CHFJPY and the EURAUD|AUDCHF. This cointegrations all arise from the EURCHF peg, something which is evident when you look at the spread value as a function of time between any of these pairs. The third image shows you the spread of the EURUSD|CHFUSD pair as a function of time, it is no surprise that this is the exact same graph as the EURCHF for the past year. As the length of the “leash” varies, so does the value of the spread on the cointegrated pairs.
Could we take advantage of these cointegrations? Well, you certainly can. There are several ways in which cointegration can be traded but with a varying “leash” a good way is probably to trade the bollinger bands around the spread. You can trade on any timeframes but even when trading the daily timeframe you can make some money. The fourth image shows a very simple simulation in R where I traded the 3 pairs mentioned above, using 1:10 leverage, on a 10 period moving average using 1 standard deviation for band distances. The simulations show a 25% profit with a 10% drawdown within the past year, not too great but not too bad either. It is possible that further refinements and entries/exits on lower timeframes can indeed increase these margins.
One important thing to remember here is that the leash is a peg from a central bank. If this peg for some reason stops existing it is possible that this cointegration will simply vanish. It is therefore advisable to keep an eye on fundamental developments and stop trading the cointegration if this arises. It is also important to constantly repeat the statistical tests for cointegration as new data comes in so that you can stop trading any of these pairs as soon as the cointegration does show to break. If you would like to learn more about FX trading and how you too can design your own trading strategiesВ please consider joiningВ Asirikuy, a website filled with educational videos, trading systems, development and a sound, honest and transparent approach towards automated trading in general . 나는이 기사를 즐겼기를 바랍니다! :영형)
6 Responses to “Cointegration in the Forex market”
& # 8221; In statistics we can evaluate for cointegration using three different tests from which the Augmented Dickey-Fuller (ADF) test is the most popular.”
Yo, this is a stationarity check. it does not imply cointegration.
This is true, however when the result of this test is positive for financial series they are always cointegrated, this is why it is so popularly used for this purpose I believe. You can however perform a Johansen test as well or a Engle–Granger two step test. In the examples used on this article all series that pass the ADF test also pass the Johansen test, showing they are cointegrated.
i will be more than happy if you could share your r code in order to learn how to do this process.
Spread trading on EURUSD|CHFUSD sounds equivalent to trading EURCHF itself, which, as is actually directly possible at most brokers, should be preferred (pay only half the spread/commission costs). An EURUSD|CHFUSD spread is in fact a synthetic instrument for EURCHF.
So how is this spread trading any different (for the better)?
Thanks for commenting :o) You’re clearly right, it’s the same as trading a bollinger band strategy on the EUR/CHF. As mentioned on the article the spread is actually the same chart as the EUR/CHF. The cointegration of the EURUSD|CHFUSD is actually reflected as a tendency to return to the mean on the EUR/CHF. If you were going to trade this in practice you would indeed use the EUR/CHF to save trading costs instead of buying/selling EURUSD and USDCHF.
Great article overall but confusing in some places. As one comment’or has pointed out, ADF test is a unit root test. It is a formal test used to establish whether a price series is stationary or not. If you get a P value of more than 1%, 5% or 10% you can only fail to reject the null of unit root based on the significance level you are comfortable with. This does not infer the presence of co-integration.
The power of the ADF is also documented to be low so most researchers now go ahead to cross check with a complementary test such as KPSS.
It will be interesting to see the R code so we can also run it and see the results. You do mention that the Johansen test confirms the presence of co-integration, so all in all I believe your findings are on solid ground.
Some interesting questions that come up is how stable is the co-integration relationship? How frequently does the long run relationship estimate change and how big are these changes when they do occur.
Overall great article, keep them coming and do share some R code.

Forex cointegration strategy


Cointegration in forex pairs trading is a valuable tool. For me, cointegration is the foundation for an excellent market-neutral mechanical trading strategy that allows me to profit in any economic environment. Whether a market is in an uptrend, downtrend or simply moving sideways, forex pairs trading allows me to harvest gains year-round.
A forex pairs trading strategy that utilizes cointegration is classified as a form of convergence trading based on statistical arbitrage and reversion to mean. This type of strategy was first popularized by a quantitative trading team at Morgan Stanley in the 1980s using stock pairs, although I and other traders have found it also works very well for forex pairs trading, too.
Forex pairs trading based on cointegration.
Forex pairs trading based on cointegration is essentially a reversion-to-mean strategy. Stated simply, when two or more forex pairs are cointegrated, it means the price spread between the separate forex pairs tends to revert to its mean value consistently over time.
It’s important to understand that cointegration is not correlation. Correlation is a short-term relationship regarding co-movements of prices. Correlation means that individual prices move together. Although correlation is relied upon by some traders, by itself it’s an untrustworthy tool.
On the other hand, cointegration is a longer-term relationship with co-movements of prices, in which the prices move together yet within certain ranges or spreads, as if tethered together. I’ve found cointegration to be a very useful tool in forex pairs trading.
During my forex pairs trading, when the spread widens to a threshold value calculated by my mechanical trading algorithms, I “short” the spread between the pairs’ prices. In other words, I’m betting the spread will revert back toward zero due to their cointegration.
Basic forex pairs trading strategies are very simple, especially when using mechanical trading systems: I choose two different currency pairs which tend to move similarly. I buy the under-performing currency pair and sell the out-performing pair. When the spread between the two pairs converges, I close my position for a profit.
Forex pairs trading based on cointegration is a fairly market-neutral strategy. As an example, if a currency pair plummets, then the trade will probably result in a loss on the long side and an offsetting gain on the short side. So, unless all currencies and underlying instruments suddenly lose value, the net trade should be near zero in a worst-case scenario.
By the same token, pairs trading in many markets is a self-funding trading strategy, since the proceeds from short sales can sometimes be used to open the long position. Even without this benefit, cointegration-fueled forex pairs trading still works very well.
Understanding cointegration for forex pairs trading.
Cointegration is helpful for me in forex pairs trading because it lets me program my mechanical trading system based on both short-term deviations from equilibrium prices as well as long-term price expectations, by which I mean corrections and returning to equilibrium.
To understand how cointegration-driven forex pairs trading works, it’s important to first define cointegration then describe how it functions in mechanical trading systems.
As I’ve said above, cointegration refers to the equilibrium relationship between sets of time series, such as prices of separate forex pairs that by themselves aren’t in equilibrium. Stated in mathematical jargon, cointegration is a technique for measuring the relationship between non-stationary variables in a time series.
If any two or more time series each have a root value equal to 1, but their linear combination is stationary, then they are said to be cointegrated.
As a simple example, consider the prices of a stock-market index and its related futures contract: Although the prices of each of these two instruments may wander randomly over brief periods of time, ultimately they will return to equilibrium, and their deviations will be stationary.
Here’s another illustration, stated in terms of the classic “random walk” example: Let’s say there are two individual drunks walking homeward after a night of carousing. Let’s further assume these two drunks don’t know each other, so there’s no predictable relationship between their individual pathways. Therefore, there is no cointegration between their movements.
In contrast, consider the idea that an individual drunk is wandering homeward while accompanied by his dog on a leash. In this case, there is a definite connection between the pathways of these two poor creatures.
Although each of the two is still on an individual pathway over a short period of time, and even though either one of the pair may randomly lead or lag the other at any given point in time, still, they will always be found close together. The distance between them is fairly predictable, thus the pair are said to be cointegrated.
Returning now to technical terms, if there are two non-stationary time series, such as a hypothetical set of currency pairs AB and XY, that become stationary when the difference between them is calculated, these pairs are called an integrated first-order series – also call an I(1) series.
Even though neither of these series stays at a constant value, if there is a linear combination of AB and XY that is stationary (described as I(0)), then AB and XY are cointegrated.
The above simple example consists of only two time series of hypothetical forex pairs. Yet, the concept of cointegration also applies to multiple time series, using higher integration orders… Think in terms of a wandering drunk accompanied by several dogs, each on a different-length leash.
In real-world economics, it’s easy to find examples showing cointegration of pairs: Income and spending, or harshness of criminal laws and size of prison population. In forex pairs trading, my focus is on capitalizing on the quantitative and predictable relationship between cointegrated pairs of currencies.
For example, let’s assume that I’m watching those two cointegrated hypothetical currency pairs, AB and XY, and the cointegrated relationship between them is AB – XY = Z, where Z equals a stationary series with a mean of zero, that is I(0).
This would seem to suggest a simple trading strategy: When AB – XY > V, and V is my threshold trigger price, then the forex pairs trading system would sell AB and buy XY, since the expectation would be for AB to decrease in price and XY to increase. Or, when AB – XY < - V, I would expect to buy AB and sell XY.
Avoid spurious regression in forex pairs trading.
Yet, it’s not as simple as the above example would suggest. In practice, a mechanical trading system for forex pairs trading needs to calculate cointegration instead of just relying on the R-squared value between AB and XY.
That’s because ordinary regression analysis falls short when dealing with non-stationary variables. It causes so-called spurious regression, which suggests relationships between variables even when there aren’t any.
Suppose, for example, that I regress 2 separate “random walk” time series against each other. When I test to see if there’s a linear relationship, very often I will find high values for R-squared as well as low p-values. Still, there’s no relationship between these 2 random walks.
Formulas and testing for cointegration in forex pairs trading.
The simplest test for cointegration is the Engle-Granger test, which works like this:
Verify that AB t and XY t are both I(1) Calculate the cointegration relationship [XY t = aAB t + e t ] by using the least-squares method Verify that the cointegration residuals e t are stationary by using a unit-root test like the Augmented Dickey-Fuller (ADF) test.
A detailed Granger equation:
I(0) describes the cointegration relationship.
XY t-1 − βAB t-1 describes the extent of the disequilibrium away from the long-run, while αi is both the speed and direction at which the currency pair’s time series corrects itself from the disequilibrium.
When using the Engle-Granger method in forex pairs trading, the beta values of the regression are used to calculate the trade sizes for the pairs.
When using the Engle-Granger method in forex pairs trading, the beta values of the regression are used to calculate the trade sizes for the pairs.
Error correction for cointegration in forex pairs trading:
When using cointegration for forex pairs trading, it’s also helpful to account for how cointegrated variables adjust and return to the long-run equilibrium. So, for example, here are the two sample forex pairs’ time series shown autoregressively:
Forex pairs trading based on cointegration.
When I use my mechanical trading system for forex pairs trading, the setup and execution are fairly simple. First, I find two currency pairs which seem like they may be cointegrated, such as EUR/USD and GBP/USD.
Then, I calculate the estimated spreads between the two pairs. Next, I check for stationarity using a unit-root test or another common method.
I make sure that my inbound data feed is working appropriately, and I let my mechanical trading algorithms create the trading signals. Assuming I’ve run adequate back-tests to confirm the parameters, I’m finally ready to use cointegration in my forex pairs trading.
I’ve found a MetaTrader indicator which offers an excellent starting point to build a cointegration forex pairs trading system. It looks like a Bollinger Band indicator, yet in fact the oscillator shows the price differential between the two different currency pairs.
When this oscillator moves toward either the high or low extreme, it indicates that the pairs are decoupling, which signals the trades.
Still, to be sure of success I rely on my well-built mechanical trading system to filter the signals with the Augmented Dickey-Fuller test before executing the appropriate trades.
Of course, anyone who wants to use cointegration for his or her forex pairs trading, yet lacks the requisite algo programming skills, can rely on an experienced programmer to create a winning expert advisor.
Through the magic of algorithmic trading, I program my mechanical trading system to define the price spreads based on data analysis. My algorithm monitors for price deviations, then automatically buys and sells currency pairs in order to harvest market inefficiencies.
Risks to be aware of when using cointegration with forex pairs trading.
Forex pairs trading is not entirely risk-free. Above all, I keep in mind that forex pairs trading using cointegration is a mean-reversion strategy, which is based on the assumption that the mean values will be the same in the future as they were in the past.
Although the Augmented Dickey-Fuller test mentioned previously is helpful in validating the cointegrated relationships for forex pairs trading, it doesn’t mean that the spreads will continue to be cointegrated in the future.
I rely on strong risk management rules, which means that my mechanical trading system exits from unprofitable trades if or when the calculated reversion-to-mean is invalidated.
When the mean values change, it’s called drift. I try to detect drift as soon as possible. In other words, if the prices of previously-cointegrated forex pairs begin to move in a trend instead of reverting to the previously-calculated mean, it’s time for the algorithms of my mechanical trading system to recalculate the values.
When I use my mechanical trading system for forex pairs trading, I use the autoregressive formula mentioned earlier in this article in order to calculate a moving average to forecast the spread. Then, I exit the trade at my calculated error bounds.
Cointegration is a valuable tool for my forex pairs trading.
Using cointegration in forex pairs trading is a market-neutral mechanical trading strategy that lets me trade in any market environment. It’s a smart strategy that’s based on reversion to mean, yet it helps me avoid the pitfalls of some of the other reversion-to-mean forex trading strategies.
Because of its potential use in profitable mechanical trading systems, cointegration for forex pairs trading has attracted interest from both professional traders as well as academic researchers.
There are plenty of recently-published articles, such as this quant-focused blog article, or this scholarly discussion of the subject, as well as plenty of discussion among traders.
Cointegration is a valuable tool in my forex pairs trading, and I highly recommend that you look into it for yourself.
Pairs Trading – Entry Point Confirmation Using Technical Indicators.
Trading pairs without adequate confirmation is like building a house without a structural engineer. In the short term the design may be stable and safe, however over a longer period of time, the sensitivity to weather conditions and other factors could be hazardous.
Systems that are based on one factor alone will invariably have a shelf life and will need to be retrained to accommodate shifts in market conditions. As discussed in our previous article on cointegration, the degree to which a trader does not adhere to these strict guidelines, can greatly affect his/her profitability.
Technical indicators for entry signals on a pairs trade.
Some of the key technical indicators and patterns that can work well for confirming entry signals include the Relative Strength Index (RSI), Market Facilitation Index (MFI) and Candlestick charting. Each has a unique attribute, and can assist in defining key entry and exit points.
상대 강도 지수 (RSI)
Although this is a relatively common indicator that does not stand the test of time by itself, the RSI can be an effective tool in pairs trading. Defined as the change in momentum, this technical indicator will range from 100 (extremely overbought) to 0 (extremely oversold). Traditionally the trigger points are 70 for a short and 30 for a long. With respect to pairs trading, this strength index allows the trader to confirm overbought and oversold scenarios.
RSI shows how a technical indicator can be used to spot entry opportunities.
The sppread between Gold and Silver is considerable, with the cointegration still above the required 80 mark (according to catalyst corner). The relative strength index has confirmed that silver is trading in the oversold bracket (at 75), providing the trader with a valid entry for a short position .
Market Facilitation Index (MFI)
Invented by technical analyst Bill Williams, the MFI identifies the momentum of a movement based on the volume. Depending on the strength of the buying and selling pressure, the indicator will price in an estimate of whether the trend is strong or weak.
Commonly used with longer time frames, the Market Facilitation Index is calculated by using the high, low and volume bars. Unlike RSI, the indicator is represented by a bar graph with coloration. Green highlights strong volume and momentum, whilst blue, brown and light brown indicate indecisive volume reactions. In pairs trading, the MFI can identify long term momentum patterns and which cross to buy or short.
Included below is a table from Wikipedia, which visually highlights the degree to which an adjust in volume can influence the market facilitation index.
The money flow index uses basic bar information to create a colored graph.
Gold has crossed below silver on a linear regression basis. The Market Facilitation Index however has indicated that volume and momentum are rising, and there will be a rebound in the price. The trader would look at going long gold and short silver.
촛대.
Candlesticks are an extremely efficient way of determining the trend of a price. Different patterns defined by the open high low and close price can supply the trader with efficient entry and exit points. From a pairs trading point of view, it is important to only open a position based on a strong buy or sell pattern. Bullish signals include a piercing pattern, inverted hammer, morning star and abandoned baby. For more information on each of these patterns it is recommended to visit stockcharts.
During the month of April, the spread between Gold and Silver is relatively tight. A morning star formation appears on the Gold price, indicating a potential bullish reversal. The trader in this case, would open a Long Gold, Short Silver to capitalize on a sudden breakout in the price.
Pairs Trading Case Study: Gold / Silver.
Finding a pair of currencies or commodities that can stand up to the cointegration test on both a short term and long term basis can be quite difficult. It is common for pairings to have some degree of distance or long term deviation away from the linear regression and this can greatly affect performance.
Several high profile market neutral hedge funds have been victim to this regression breakout. Long Term Capital Management (LTCM) is the most famous example. The fund lost several billion dollars in 1998 during the Russian financial crisis. Nearly every position in its bonds and derivative pairings went off the rails all at the same time.
Trading pairs is not full proof and strict risk management and cointegration retraining must be implemented. As discussed in our previous posts on correlation and cointegration, we are looking for the degree to which two variables will return to their common mean. This will determine our entry and exit strategy, and where we will place our stops.
In one of our previous articles – ‘Analysing Pairs with Correlation and Cointegration’, we identified Gold and Silver as a good potential trading pair due to its statistically high long term percentage levels. We calculated the cointegration using a free tool from the website – Catalyst Corner catalystcorner.
30 Day Correlation: 94.98%
2 Year Correlation: 26.99%
13 Year Correlation: 95.3%
2 Year Cointegration: 85%
Silver (Black) Gold (Orange Green) 30 Minute Chart.
Setting up Charts.
Setting up a pairs template in MetaTrader is relatively simple and requires two free indicators (these have been included with the tutorial). The first indicator is that of the FX Correlator and the second is the overlay chart. Highlighted below are the step by step instructions on adding each to your chart.
1. Open Metatrader and Choose Chart.
2. Drag the Overlay Chart onto the open chart window, and specify default settings. 확인을 클릭하십시오.
3. Attach the FX Correlator to the chart, click INPUTS and change all currencies to FALSE except for USD and AUD. The reason why we are keeping these two as TRUE is outlined in the trade setup section. 확인을 클릭하십시오.
Trade Setup.
You will now see two indicators positioned on the chart window. The top overlay chart will highlight the price of silver in comparison to gold. You will notice that the general trend direction is quite similar (correlation), however there are points along the timeline where the prices widen and then regress (cointegration). These are the points that we are looking to profit from.
The FX correlator is a unique indicator that calculates a spread between the main chart window and specified other crosses. When we added the indicator to the chart, we only specified the AUD and USD currencies. Hence we can only see two coloured linear regression points along the time line. The reason we chose the Aussie dollar, was because of its susceptibility to commodity prices movements and the US dollar is the natural base cross with Gold and Silver.
• Long Gold and Short Silver when the USD crosses above the AUD on the FX Correlator.
• Short Gold and Long Silver when the USD crosses below the AUD on the FX Correlator.
In the diagram above, we have circled a number of trade setups. On the 14th of May at 4:00, the USD crossed higher than the AUD, triggering a potential Short Silver/Long Gold scenario. According to the chart, Silver regressed back to the mean and overlapped Gold at 12:00. The second possible trade scenario occured on the 15th of May at 20:00. As the AUD crossed above the USD, a Long Silver / Short Gold trade was triggered with the spread widening.
위기 관리.
• Tight Stops on both crosses.
• Calculate the correlation and cointegration of Gold and Silver regularly (daily basis). If the cointegration breaks down (below 80%) do not trade.
• Position size should be based on underlying value and may not be equal.
Charting a Linear Regression.
Linear Regression can be an effective tool when defining the overall momentum or trend of a series of prices. It can be adapted to all data. Fields outside of trading, including risk management and statistics, use the same statistical technique. Insurance providers will commonly plot the relationship between claims and age groups to determine premium levels.
To put it into perspective, if there were five people in a group who each owned two television sets, one person who owned no tv and two people that owned four tv sets, then the linear regression on a rough basis would indicate the trend is just slightly above the two sets. The standard error or deviation in this case would be the two outside samples of no tv and four televisions.
Can regression be an effective tool for trading on a longer term basis or is it too susceptible to market volatility and future pricing? To understand how linear regression really works, we need to chart the channel and its standard deviation levels.
The first tutorial below looks at a scatter graph in excel and how to plot a linear regression. Please note that it does not include the standard deviation channels.
Charting a Simple Regression in Excel.
Open your Metatrader platform and click on TOOLS, HISTORY CENTER. Choose the relevant pair for your regression analysis. Once you have chosen the time frame, click on EXPORT and SAVE the spread sheet. Open the spread sheet and highlight the two relevant columns you would like to use in the scatter chart. In the diagram above we used time (minutes) and price. Click INSERT and choose SCATTER. A drop down menu will appear. To get a true reflection, click on SCATTER WITH ONLY MARKERS. A chart will appear with dots representing the distribution of pricing data. To decipher the linear regression, highlight the chart and click on LAYOUT in the excel menu. Navigate to TREND LINE. A drop down menu will appear with several options. Choose LINEAR TREND LINE. The regression line will now appear.
Excel draws a linear regression of the EURSUD prices using data from MetaTrader M5 charts.
As discussed previously, the excel chart will only give a basic trend and will not supply the user with detailed standard deviations. It is also recommended that you do not highlight too much data for a realistic short term interpretation.
We specified eight hours of five minute data on the EURUSD cross in the above diagram.
Charting Linear Regression in Metatrader.
Open the desired chart and time frame in Metatrader Click on INSERT and CHANNELS. You will then be provided with a list. Choose LINEAR REGRESSION. Hold down your left mouse button and drag the linear regression over the desired time period. In the above diagram, we chose a linear regression with a starting date of the 13th May at 10:30. You will notice that the regression line will appear and adjust according to the data. One standard deviation will also appear. If you would like a second deviation channel on your chart, navigate back to the top of the terminal menu and click on INSERT – CHANNELS and choose Standard Deviation. You will then need to drag the standard deviation channel using your left mouse button and specify the same time period.
MetaTrader interprets the price movements and draws a liner regression.
추천.
It is recommended when trading using regression, that you specify a shorter range so as to manage the volatility. As prices shift, so will the channel, and profit potentials could quickly turn to losses.
It is important to always keep stops tight in case of violent swing backs in the price.
Correlation vs. Cointegration.
Correlation and cointegration are two regression based concepts that are commonly misused by the trading community. Complex in their formulation, both are inter related and are used to calculate the relationships between two or more products (ie commodities, forex, stock prices) over a specific time period.
상관 관계.
A value of +1 (positive correlation) or -1 (negative correlation) is assigned based on the how efficiently the two prices react to each other. Correlation identifies pairs that move in either tandem or opposing directions .
A good example of a long term correlation pairing is that of the EURUSD and the USDCHF crosses, which trade in a similar direction. On the other side of the coin, the EURGBP and the AUDNZD trade in opposing directions. They show a negative correlation of -0.81.
Although this figure indicates that the crosses moved against each other, there is a slight degree of uncertainty over the long term sustainability of this negative result. Professional traders commonly set the entry benchmark for pairs above or below 0.9 or -0.9.
Correlation does have a significant drawback, which can greatly affect profitability. Although two pairs may be correlated, they are still not in complete unison, which can cause a slight drift in the prices. In the case of the EURGBP and the AUDNZD, it is a drift -0.19.
Read the post on forex correlation for more details on the topic.
Image credit: Vassia Atanassova.
The left box shows a strong correlation. The middle shows a weak correlation. The far right shows an image with no correlation.
농축.
Cointegration analyses the movements in prices and identifies the degree to which two values are sensitive to the same mean or average price over a given time period. It doesn’t say anything about the direction that the pairs will move. Cointegration only measures whether or not the distance between them remains stable over time.
If we look at gold and silver, for example, we may find that they track a common average value. They may trade in opposite directions from day to day. At some unknown point in the future, they should revert back towards that average and hence they are cointegrated. Hedge funds commonly use this formula to program statistical arbitrage models to identify pairs to trade.
Another important factor to keep in mind is the look back period of the mean and standard deviation. In essence, if you make the look back value 700, then the regression channel will calculate what the average price is over 700 periods. This can be too inefficient and will limit the sensitivity to changes in the market dynamic.
On the other hand, if you set a short look back period, then it will cause a whipsaw effect and will be far too sensitive. It is important to get a balanced look back within the range of 200-350.
Gold / Silver Example.
• Top Section: Standard Deviation and Linear Regression.
• Middle Section: Relative Performance Gold (dark blue) and Silver (light/ turquoise blue)
• Bottom Section: Gold Daily Chart and Time Line.
The above chart highlights the overall correlation of Gold and Silver and the degree to which breakouts could trigger trade opportunities. I have circled a number of different cointegration scenarios and referenced these on the second section with P1, P2, P3 and P4 labels.
Silver Spike – March.
A significant spike in the price of Silver in March sent the linear regression value below the lower standard deviation channel of -2.0. To capitalize on the significant discrepancy in prices, the trader would have looked at shorting silver and going long gold. Performance wise, this would have resulted in an overall profit as silver weakened heavily, crossing below gold in May.
Silver Oversold – July.
The silver price continues to weaken on a relative level to gold. In June and July, the regression value passes above the top standard deviation channel, indicating that silver is oversold and the price will have to revert back to its mean. The trader decides to open a long position in silver and short gold. As forecast, it returns to its mean and the gap between both spot prices closes quickly.
Silver Overshoots – December.
Once again the silver price overshoots gold. This sets up a long gold, short silver opportunity. On a performance level, the trader would capitalize on.
the spread and profit from the position.
Silver Selloff – April.
Puncturing the second standard deviation channel, the gold price stabilises whilst silver weakens heavily. This has now supplied the trader with a long.
silver, short gold opportunity.
외환 상관.
Correlation strategies appeal to forex traders because it removes the stress associated with picking market direction. When two correlated pairs diverge from one another, the idea is to simply buy one pair and sell the other.
What are correlated currency pairs?
Correlation offers a mathematical probability of two “time series” moving in the same direction. Applying the idea to forex, it means that we need to pick two currency pairs. EURUSD and USDCHF are two popular choices due to their extremely high correlation, so we’ll use those.
Now we ask a simple question: “If the EURUSD rises, what is the probability of that the USDCHF will also rise”? Our calculations will pump out a simple a number between -1 and +1. +1 means that that if Currency A rose in value, then it is 100% certain that Currency B rose in value. -1 means that if Currency A increased in value, then it is 100% certain that Currency B decreased in value. A value of 0 means that the movement of Currency A exercises no effect at all on Currency B.
Traders generally consider a correlation significant whenever the number is greater than 70%. EURUSD and USDCHF are so popular because they hold the strongest correlation among the major currency pairs. When market volatility was very low a few years ago, it was around -93%. Today, the correlation tends to hang around -80%. The European debt problems and Swiss National Bank’s intervention have a lot to do with the decrease in this number. Their trading relationships are far less stable.
Risks of correlation strategies.
Let’s move back into familiar territory with my favorite example, the moving average. If you take the average over the past 20 bars, you know from experience that the average will differ if you study a 50 period versus a 200 period average. If you look at the average on a 5 minute chart versus an hourly chart, the number will vary yet again.
The take-away here is that the correlations work the same way. The correlation between EURUSD and USDCHF might even be positive if you look at a short enough time scale. As you back away in time, you will notice that the further out you go, the more steady the correlation numbers look. If the weekly correlation of the EURUSD and USDCHF is -80%, you would expect the numbers to get more wild and erratic as you scale all the way down to a tick chart.
The same problem with the moving average also appears. Studying the correlation over 50 periods provides a responsive number, but it is also far less consistent than the 200 period correlation. What a short period gains in responsiveness, it loses in stability.
You should also consider whether the correlation that you’re studying makes fundamental sense. Just because the temperature change in Mongolia predicted the direction of USDJPY for the past week does not make it a good idea to use in the future. The same goes with pair trading.
EURUSD and USDCHF should be highly correlated for two reasons. They both contain the same currency in the pair (USD), which half weights them with the same instrument. Additionally, the EUR and CHF both have strong trading relationships with the US. You would expect both the Euro Zone and Switzerland to share a need for buying and selling US dollars. They need them for buying oil, importing and exporting to the US, etc. Anyone with a cursory understanding of macroeconomics could explain why this relationship makes sense.
Correlation traders typically settle on pairs that share a common currency. The EURUSD and USDCHF trade both share the US dollar. When you buy EURUSD and buy USDCHF, you are really:
Buying EUR and selling USD.
Buying USD and selling CHF.
Notice that the USD cancels itself out. What you are really doing is buying EUR and selling CHF. This is commonly known as the EURCHF pair. Assuming that the spread is not outrageous, it makes more sense to simply buy or sell EURCHF directly rather than going through the convoluted process of managing two open trades.
If you decide to pursue the two pair approach, you must consider the need to balance the trade sizes against each other. Using standard lots as the example, 100,000 EUR is 137,500 USD. 100,000 USD is 90,900 CHF. If you buy one standard lot of EURUSD, you are buying $137,500 of it. When you buy a standard lot of USDCHF, you are only buying $100,000.
$137,500 obviously does not equal $100,000. Unless you intentionally decided to trade different sizes, you may want to consider equalizing them.
€100,000 / $137,500 = x * (₣90,900/$100,000)
x = €100,000 / ₣90,00 * $100,000 / $137,500 = 0.803.
You would need your EURUSD trade to be 80% of the size of the USDCHF trade.
What correlation is not.
Correlation only provides insight into the probability of direction. It says absolutely nothing about the strength of a particular move. A few months ago the USDCHF climbed 1,000 points in value within a single day. The EURUSD only moved a few hundred pips. The USDCHF moved dramatically further than the EURUSD both in terms of pips, but more importantly, as a percentage of price.
Consider if you were short EURUSD that day and short USDCHF. You lost a ton of money. On the flip side, if you were long EURUSD and long USDCHF, then you got lucky and earned the move. Regardless of what happened, correlation told you nothing about the outcome when they move in the same direction. For that reason, I prefer looking at a less intuitive method called cointegration.
농축.
Conintegration turns the problem on its head. Rather than asking whether or not two pairs move in the same direction, it asks how likely are they to remain a certain distance apart. Naturally, that distance tends to vary with time. What you want the cointegration formula to tell you is how likely two pairs are to come back to a standard distance. If you see two pairs spread unusually far apart and the numbers tell you that they usually come back together, then it makes sense to consider a pair trade.
Ernest Chan has a friendly introduction to cointegration that I highly recommend. A much uglier, math intensive introduction to the subject, albeit one that is also far more thorough, is in the book Pairs Trading by Ganapathy Vidyamurthy.

Comments

Popular Posts