Monday 5 February 2018

통합 통화 거래 외환


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
외환 거래의 통합은 중요한 도구입니다. 나에게 공적분은 모든 경제적 환경에서 이익을 얻을 수있는 우수한 중립적 기계 무역 전략의 기초입니다. 시장이 상승 추세, 하락 추세 또는 단순히 옆으로 움직이든, 외환 거래는 일년 내내 이익을 얻을 수 있습니다.
공적분을 활용하는 외환 거래 전략은 통계적 재정 거래와 평균으로의 전환을 기반으로하는 컨버전스 거래의 한 형태로 분류됩니다. 이 유형의 전략은 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 쌍 무역 안에 귀중한 공구이고, 나는 너 자신을 위해 그것으로 볼 것을 높게 추천한다.
페어 트레이딩 & # 8211; 기술 지표를 사용한 진입 점 확인.
적절한 확인이없는 거래 쌍은 구조 엔지니어없이 집을 짓는 것과 같습니다. 단기간에 설계는 안정적이고 안전 할 수 있지만 장기간에 걸쳐 기상 조건 및 기타 요인에 대한 민감성은 위험 할 수 있습니다.
하나의 요소만으로 이루어진 시스템만으로는 유통 기한이 유지되며 시장 상황의 변화에 ​​따라 재교육을 받아야합니다. 공적분에 관한 이전 기사에서 논의 된 바와 같이, 상인이 이러한 엄격한 지침을 따르지 않는 정도는 그 / 그녀의 수익성에 큰 영향을 미칠 수있다.
페어 트레이드에 대한 입장 신호 기술 지표.
진입 신호 확인을 위해 잘 작동 할 수있는 핵심 기술 지표 및 패턴에는 상대 강도 지수 (RSI), 시장 촉진 지수 (MFI) 및 촛대 차트가 있습니다. 각 속성에는 고유 한 속성이 있으며 키 입력 및 종료 지점을 정의하는 데 도움이 될 수 있습니다.
상대 강도 지수 (RSI)
이것은 시간의 테스트를 자체적으로지지하지 않는 비교적 일반적인 지표이지만 RSI는 쌍 거래에서 효과적인 도구가 될 수 있습니다. 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.
Recommendation.
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.
Correlation.
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.
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.
Forex Correlation.
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.
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.

QuantStart.
Join the Quantcademy private membership portal that caters to the rapidly-growing retail quant trader community . You'll find a knowledgeable, like-minded group of quant traders ready to answer your most pressing quant trading questions.
퀀트 트레이딩에 관한 나의 eBook을 확인해보십시오. 여기서 저는 파이썬 툴로 수익성 높은 체계적인 트레이딩 전략을 만드는 법을 가르쳐드립니다.
Take a look at my new ebook on advanced trading strategies using time series analysis, machine learning and Bayesian statistics, with Python and R .
By Michael Halls-Moore on June 2nd, 2016.
A while back we considered a trading model based on the application of the ARIMA and GARCH time series models to daily S&P500 data. We mentioned in that article as well as other previous time series analysis articles that we would eventually be considering mean reverting trading strategies and how to construct them.
In this article I want to discuss a topic called cointegration, which is a time series concept that allows us to determine if we are able to form a mean reverting pair of assets. We will cover the time series theory related to cointegration here and in the next article we will show how to apply that to real trading strategies using the new open source backtesting framework: QSTrader.
We will proceed by discussing mean reversion in the traditional "pairs trading" framework. This will lead us to the concept of stationarity of a linear combination of assets, ultimately leading us to cointegration and unit root tests . Once we have outlined these tests we will simulate various time series in the R statistical environment and apply the tests in order to assess cointegration.
Mean Reversion Trading Strategies.
The traditional idea of a mean reverting "pairs trade" is to simultaneously long and short two separate assets sharing underlying factors that affect their movements. An example from the equities world might be to long McDonald's (NYSE:MCD) and short Burger King (NYSE:BKW - prior to the merger with Tim Horton's).
The rationale for this is that their long term share prices are likely to be in equilibrium due to the broad market factors affecting hamburger production and consumption. A short-term disruption to an individual in the pair, such as a supply chain disruption solely affecting McDonald's, would lead to a temporary dislocation in their relative prices. This means that a long-short trade carried out at this disruption point should become profitable as the two stocks return to their equilibrium value once the disruption is resolved. This is the essence of the classic "pairs trade".
As quants we are interested in carrying out mean reversion trading not solely on a pair of assets, but also baskets of assets that are separately interrelated.
To achieve this we need a robust mathematical framework for identifying pairs or baskets of assets that mean revert in the manner described above. This is where the concept of cointegrated time series arises.
The idea is to consider a pair of non-stationary time series, such as the random-walk like assets of MCD and BKW, and form a linear combination of each series to produce a stationary series, which has a fixed mean and variance.
This stationary series may have short term disruptions where the value wanders far from the mean, but due to its stationarity this value will eventually return to the mean. Trading strategies can make use of this by longing/shorting the pair at the appropriate disruption point and betting on a longer-term reversion of the series to its mean.
Mean reverting strategies such as this permit a wide range of instruments to create the "synthetic" stationary time series. We are certainly not restricted to "vanilla" equities. For instance, we can make use of Exchange Traded Funds (ETF) that track commodity prices, such as crude oil, and baskets of oil producing companies. Hence there is plenty of scope for identifying such mean reverting systems.
Before we delve into the mechanics of the actual trading strategies, which will be the subject of the next article, we must first understand how to statistically identify such cointegrated series. For this we will utilise techniques from time series analysis, continuing the usage of the R statistical language as in previous articles on the topic.
Cointegration.
Now that we've motivated the necessity for a quantitative framework to carry out mean reversion trading we can define the concept of cointegration. Consider a pair of time series, both of which are non-stationary. If we take a particular linear combination of theses series it can sometimes lead to a stationary series. Such a pair of series would then be termed cointegrated .
The mathematical definition is given by:
Cointegration.
Let $\ $ and $\ $ be two non-stationary time series, with $a, b \in \mathbb $, constants. If the combined series $a x_t + b y_t$ is stationary then we say that $\ $ and $\ $ are cointegrated .
While the definition is useful it does not directly provide us with a mechanism for either determining the values of $a$ and $b$, nor whether such a combination is in fact statistically stationary. For the latter we need to utilise tests for unit roots .
Unit Root Tests.
In our previous discussion of autoregressive AR(p) models we explained the role of the characteristic equation . We noted that it was simply an autoregressive model, written in backward shift form, set to equal zero. Solving this equation gave us a set of roots .
In order for the model to be considered stationary all of the roots of the equation had to exceed unity. An AR(p) model with a root equal to unity - a unit root - is non-stationary. Random walks are AR(1) processes with unit roots and hence they are also non-stationary.
Thus in order to detect whether a time series is stationary or not we can construct a statistical hypothesis test for the presence of a unit root in a time series sample.
We are going to consider three separate tests for unit roots: Augmented Dickey-Fuller (AFD), Phillips-Perron and Phillips-Ouliaris. We will see that they are based on differing assumptions but are all ultimately testing for the same issue, namely stationarity of the tested time series sample.
Let's now take a brief look at all three tests in turn.
Augmented Dickey-Fuller Test.
Dickey and Fuller [2] were responsible for introducing the following test for the presence of a unit root. The original test considers a time series $z_t = \alpha z_ + w_t$, in which $w_t$ is discrete white noise. The null hypothesis is that $\alpha = 1$, while the alternative hypothesis is that $\alpha < 1$.
Said and Dickey [6] improved the original Dickey-Fuller test leading to the Augmented Dickey-Fuller (ADF) test, in which the series $z_t$ is modified to an AR(p) model from an AR(1) model. I've discussed the test in a previous article where we've used Python to calculate it. In this article we will carry out the same test using R.
Phillips-Perron Test.
The ADF test assumes an AR(p) model as an approximation for the time series sample and uses this to account for higher order autocorrelations. The Phillips-Perron test [5] does not assume an AR(p) model approximation. Instead a non-parametric kernel smoothing method is utilised on the stationary process $w_t$, which allows it to account for unspecified autocorrelation and heteroscedasticity.
Phillips-Ouliaris Test.
The Phillips-Ouliaris test [4] is different from the previous two tests in that it is testing for evidence of cointegration among the residuals between two time series. The main idea here is that tests such as ADF, when applied to the estimated cointegrating residuals, do not have the Dickey-Fuller distributions under the null hypothesis where cointegration isn't present. Instead, these distributions are known as Phillips-Ouliaris distributions and hence this test is more appropriate.
Difficulties with Unit Root Tests.
While the ADF and Phillips-Perron test are equivalent asymptotically they can produce very different answers in finite samples [7] . This is because they handle autocorrelation and heteroscedasticity differently. It is necessary to be very clear which hypotheses are being tested for when applying these tests and not to simply apply them blindly to arbitrary series.
In addition unit root tests are not great at distinguishing highly persistent stationary processes from non-stationary processes. One must be very careful when using these on certain forms of financial time series. This can be especially problematic when the underlying relationship being modelled (i. e. mean reversion of two similar pairs) naturally breaks down due to regime change or other structural changes in the financial markets.
Simulated Cointegrated Time Series with R.
Let's now apply the previous unit root tests to some simulated data that we know to be cointegrated. We can make use of the defiition of cointegration to artificially create two non-stationary time series that share an underlying stochastic trend, but with a linear combination that is stationary.
Our first task is to define a random walk $z_t = z_ + w_t$, where $w_t$ is discrete white noise. Take a look at the previous article on white noise and random walks if you need to brush up on these concepts .
With the random walk $z_t$ let's create two new time series $x_t$ and $y_t$ that both share the underlying stochastic trend from $z_t$, albeit by different amounts:
\begin x_t &=& p z_t + w_ \\ y_t &=& q z_t + w_ \end.
If we then take a linear combination $a x_t + b y_t$:
\begin a x_t + b y_t &=& a (p z_t + w_ ) + b (q z_t + w_ ) \\ &=& (ap + bq) z_t + a w_ + b w_ \end.
We see that we only achieve a stationary series (that is a combination of white noise terms) if $ap + bq = 0$. We can put some numbers to this to make it more concrete. Suppose $p=0.3$ and $q=0.6$. After some simple algebra we see that if $a=2$ and $b=-1$ we have that $ap +bq = 0$, leading to a stationary series combination. Hence $x_t$ and $y_t$ are cointegrated when $a=2$ and $b=-1$.
Let's simulate this in R in order to visualise the stationary combination. Firstly, we wish to create and plot the underlying random walk series, $z_t$:
Realisation of a random walk, $z_t$
If we plot both the correlogram of the series and its differences we can see little evidence of autocorrelation:
Correlograms of $z_t$ and the differenced series of $z_t$
Hence this realisation of $z_t$ clearly looks like a random walk. The next step is to create $x_t$ and $y_t$ from $z_t$, using $p=0.3$ and $q=0.6$, and then plot both:
Plot of $x_t$ and $y_t$ series, each based on underlying random walk $z_t$
As you can see they both look similar. Of course they will be by definition - they share the same underlying random walk structure from $z_t$. Let's now form the linear combination, comb , using $p=2$ and $q=-1$ and examine the autocorrelation structure:
Plot of comb - the linear combination series - and its correlogram.
It is clear that the combination series comb looks very much like a stationary series. This is to be expected given its definition.
Let's try applying the three unit root tests to the linear combination series. Firstly, the Augmented Dickey-Fuller test:
The p-value is small and hence we have evidence to reject the null hypothesis that the series possesses a unit root. Now we try the Phillips-Perron test:
Once again we have a small p-value and hence we have evidence to reject the null hypothesis of a unit root. Finally, we try the Phillips-Ouliaris test (notice that it requires matrix input of the underlying series constituents):
Yet again we see a small p-value indicating evidence to reject the null hypothesis. Hence it is clear we are dealing with a pair of series that are cointegrated.
What happens if we instead create a separate combination with, say $p=-1$ and $q=2$?
Plot of badcomb - the "incorrect" linear combination series - and its correlogram.
In this case we do not have sufficient evidence to reject the null hypothesis of the presence of a unit root, as determined by p-value of the Augmented Dickey-Fuller test. This makes sense as we arbitrarily chose the linear combination of $a$ and $b$ rather than setting them to the correct values of $p=2$ and $b=-1$ to form a stationary series.
다음 단계.
In this article we examined multiple unit root tests for assessing whether a linear combination of time series was stationary, that is, whether the two series were cointegrated.
In future articles we are going to consider full implementations of mean reverting trading strategies for daily equities and ETFs data using QSTrader based on these cointegration tests.
In addition we will extend our analysis to cointegration across more than two assets leading to trading strategies that take advantage of cointegrated portfolios.
참조.
Just Getting Started with Quantitative Trading?
3 Reasons to Subscribe to the QuantStart List:
1. Quant Trading Lessons.
You'll get instant access to a free 10-part course packed with hints and tips to help you get started in quantitative trading!
2. All The Latest Content.
매주 나는 퀀트 스타트에서 모든 활동의 포장을 보내드릴 것입니다. 그래서 당신은 결코 다시 글을 놓치지 않을 것입니다.
Real, actionable quant trading tips with no nonsense.

Mechanical Forex.
Trading in the FX market using mechanical trading strategies.
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 . I hope you enjoyed this article ! :o)
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.

No comments:

Post a Comment