Thursday 1 March 2018

كونيغراشيون تداول العملات الأجنبية


التكامل المشترك في أزواج العملات الأجنبية.
التكامل المشترك في أزواج العملات الأجنبية هو أداة قيمة. بالنسبة لي، التكامل المشترك هو الأساس لاستراتيجية تجارية ميكانيكية محايدة السوق ممتازة التي تسمح لي للاستفادة في أي بيئة اقتصادية. سواء كان السوق في اتجاه صعودي، اتجاه هبوطي أو ببساطة تتحرك جانبية، وتداول أزواج الفوركس يسمح لي لحصاد المكاسب على مدار السنة.
يتم تصنيف إستراتيجية تداول أزواج العملات الأجنبية التي تستخدم التكامل المشترك كشكل من أشكال التداول المتقارب على أساس المراجحة الإحصائية والرجوع إلى المتوسط. هذا النوع من الاستراتيجية كان أول شعبية من قبل فريق التداول الكمي في مورغان ستانلي في 1980s باستخدام أزواج الأسهم، على الرغم من أنني والتجار الآخرين وجدوا أنه يعمل أيضا بشكل جيد جدا لتداول أزواج الفوركس، أيضا.
تداول أزواج الفوركس على أساس التكامل المشترك.
تداول أزواج الفوركس على أساس التكامل المشترك هو في الأساس استراتيجية عودة إلى متوسط. وباختصار، عندما يكون زوجين أو أكثر من أزواج الفوركس مدمجة، فإن ذلك يعني أن انتشار السعر بين أزواج الفوركس المنفصلة يميل إلى العودة إلى قيمته المتوسطة باستمرار مع مرور الوقت.
من المهم أن نفهم أن التكامل المشترك ليس ارتباطا. الترابط هو علاقة قصيرة الأجل فيما يتعلق بالتحركات المشتركة للأسعار. ويعني الترابط أن الأسعار الفردية تتحرك معا. على الرغم من الاعتماد على بعض الارتباط من قبل التجار، في حد ذاته انها أداة غير جديرة بالثقة.
ومن ناحية أخرى، فإن التكامل المشترك هو علاقة أطول أجلا مع التحركات المشتركة للأسعار، حيث تتحرك الأسعار معا في حدود أو فروق معينة، كما لو كانت مربوطة معا. لقد وجدت التكامل المشترك ليكون أداة مفيدة جدا في تداول أزواج الفوركس.
خلال تداول أزواج العملات الأجنبية، عندما ينتشر انتشار إلى قيمة عتبة يحسبها بلدي خوارزميات التداول الميكانيكية، وأنا "قصيرة" الفرق بين أسعار أزواج. وبعبارة أخرى، أنا أراهن على انتشار سوف يعود مرة أخرى نحو الصفر بسبب التكامل المشترك بينهما.
استراتيجيات التداول أزواج العملات الأساسية بسيطة جدا، وخصوصا عند استخدام أنظمة التداول الميكانيكية: اخترت اثنين من أزواج العملات المختلفة التي تميل إلى التحرك بالمثل. إنني أشتري زوج العملات الضعيفة وبيع الزوج المتداول. عندما يتقارب الفارق بين الزوجين، أغلق موقفي لتحقيق الربح.
تداول أزواج الفوركس على أساس التكامل المشترك هو استراتيجية محايدة السوق إلى حد ما. وكمثال على ذلك، إذا انخفض زوج العملات، فإن التداول من المحتمل أن يؤدي إلى خسارة على الجانب الطويل وكسب تعويض على الجانب القصير. لذلك، ما لم تفقد جميع العملات والأدوات الأساسية فجأة قيمة، يجب أن يكون صافي التجارة بالقرب من الصفر في أسوأ السيناريوهات.
وعلى نفس المنوال، فإن تداول الأزواج في العديد من الأسواق هو إستراتيجية تداول ذاتي التمويل، حيث أن العائدات من المبيعات القصيرة يمكن أن تستخدم أحيانا لفتح الصفقة الطويلة. حتى من دون هذه الفائدة، لا يزال تداول أزواج العملات الأجنبية التي تعمل بالوقود المشترك يعمل بشكل جيد جدا.
فهم التكامل المشترك لتداول أزواج الفوركس.
التكامل المشترك مفيد بالنسبة لي في أزواج الفوركس التداول لأنه يتيح لي برنامج بلدي نظام التداول الميكانيكية على أساس كل من الانحرافات على المدى القصير من أسعار التوازن وكذلك توقعات السعر على المدى الطويل، والتي أعني التصحيحات والعودة إلى التوازن.
ولفهم كيفية عمل أزواج الفوركس التي يحركها التكامل المشترك، من المهم أولا تحديد التكامل المشترك، ثم وصف كيفية عمله في أنظمة التداول الميكانيكية.
كما قلت أعلاه، يشير التكامل المشترك إلى علاقة التوازن بين مجموعات من السلاسل الزمنية، مثل أسعار أزواج الفوركس المنفصلة التي هي في حد ذاتها ليست في حالة توازن. أما في المصطلحات الرياضية، فإن التكامل المشترك هو تقنية لقياس العلاقة بين المتغيرات غير الثابتة في سلسلة زمنية.
وإذا كان لكل سلسلتين زمنيتين أو أكثر قيمة جذر مساوية للقيمة 1، إلا أن تركيبة الخطية هي ثابتة، ثم يقال إنها مركبة كوينيغراتد.
وكمثال بسيط، يجب النظر في أسعار مؤشر سوق الأسهم والعقود الآجلة ذات الصلة: على الرغم من أن أسعار كل من هذين الصكين قد يهيمون على وجوههم بشكل عشوائي على فترات قصيرة من الزمن، في نهاية المطاف سيعودون إلى التوازن، وانحرافاتهم ستكون ثابت.
هنا مثال آخر، ذكر من حيث الكلاسيكية "المشي العشوائي" سبيل المثال: دعونا نقول هناك اثنين من سكران الفردية المشي هومويارد بعد ليلة من الكاروس. دعونا نفترض أيضا أن هذين السكرين لا يعرفون بعضهم البعض، لذلك ليس هناك علاقة يمكن التنبؤ بها بين مساراتهم الفردية. لذلك، ليس هناك تكامل بين تحركاتهم.
في المقابل، والنظر في فكرة أن الفرد في حالة سكر هو تجول هوموارد في حين يرافقه كلبه على المقود. في هذه الحالة، هناك صلة محددة بين مسارات هذين المخلوقات الفقيرة.
على الرغم من أن كل من اثنين لا يزال على المسار الفردي على مدى فترة قصيرة من الزمن، وعلى الرغم من أن أي واحد من الزوج قد يؤدي عشوائيا أو تأخر الآخر في أي لحظة معينة من الزمن، لا يزال، وسوف تكون دائما على مقربة من بعضها البعض. المسافة بينهما يمكن التنبؤ بها إلى حد ما، وبالتالي يقال أن الزوج أن يكون كوينيغراتد.
وبعد العودة الآن إلى المصطلحات التقنية، إذا كان هناك نوعان من السلاسل الزمنية غير الثابتة، مثل مجموعة افتراضية من أزواج العملات أب و زي، التي تصبح ثابتة عند حساب الفرق بينهما، وتسمى هذه الأزواج سلسلة متكاملة من الدرجة الأولى - أيضا استدعاء I (1) سلسلة.
على الرغم من أن أيا من هذه السلسلة يبقى في قيمة ثابتة، إذا كان هناك تركيبة خطية من أب و زي التي هي ثابتة (وصفها I (0))، ثم أب و زي هي كوينيغراتد.
المثال البسيط أعلاه يتكون من سلسلتين زمنيتين فقط من أزواج الفوركس الافتراضية. ومع ذلك، فإن مفهوم التكامل المشترك ينطبق أيضا على سلسلة زمنية متعددة، وذلك باستخدام أوامر التكامل أعلى ... فكر من حيث سكر يتجول يرافقه العديد من الكلاب، كل على المقود مختلفة طول.
في اقتصاديات العالم الحقيقي، فإنه من السهل العثور على أمثلة تظهر التكامل بين الأزواج: الدخل والإنفاق، أو قسوة القوانين الجنائية وحجم السجناء. في تداول أزواج العملات الأجنبية، ينصب تركيزي على الاستفادة من العلاقة الكمية التي يمكن التنبؤ بها بين أزواج العملات المتراكمة.
على سبيل المثال، لنفترض أنني أشاهد هذين الزوجين المفترسين للعملة الافتراضية، أب و زي، والعلاقة المشتركة بينهما هي أب & # 8211؛ زي = Z، حيث يساوي Z سلسلة ثابتة بمتوسط ​​صفر، وهذا هو I (0).
ويبدو أن هذا يشير إلى استراتيجية تداول بسيطة: عندما أب - زي & غ؛ V، و V هو بلدي عتبة سعر الزناد، ثم نظام تداول أزواج الفوركس سوف تبيع أب وشراء زي، لأن التوقعات ستكون ل أب لتقليل في الأسعار و زي لزيادة. أو، عندما أب - زي & لوت؛ - V، وأتوقع لشراء أب وبيع زي.
تجنب الانحدار الهامشي في تداول أزواج الفوركس.
ومع ذلك، فإنه ليس بسيطا كما يقترح المثال أعلاه. في الممارسة العملية، يحتاج نظام التداول الميكانيكي لتداول أزواج الفوركس إلى حساب التكامل المشترك بدلا من الاعتماد على قيمة R-سكارد بين أب و زي.
وذلك لأن تحليل الانحدار العادي يقصر عند التعامل مع المتغيرات غير ثابتة. ويسبب ذلك ما يسمى الانحدار الهامشي، مما يوحي العلاقات بين المتغيرات حتى عندما لا يكون هناك أي.
لنفترض، على سبيل المثال، أنني أترتب على مسلسل زمني واحد منفصل "المشي العشوائي" ضد بعضها البعض. عندما اختبر لمعرفة ما إذا كان هناك علاقة خطية، في كثير من الأحيان سوف تجد قيم عالية ل R - التربيع وكذلك القيم P المنخفضة. ومع ذلك، لا توجد علاقة بين هذين المشيين العشوائيين.
الصيغ واختبار التكامل المشترك في تداول أزواج الفوركس.
وأبسط اختبار للتكامل المشترك هو اختبار إنغل-غرانجر الذي يعمل على النحو التالي:
التحقق من أن أب t و زي t هما على حد سواء I (1) حساب العلاقة التكامل المشترك [زي t = أب t + إت] باستخدام طريقة المربعات الصغرى تحقق من أن بقايا التكامل المشترك وثابتة باستخدام اختبار وحدة الجذر مثل المعزز ديكي فولر (أدف) الاختبار.
معادلة غرانجر مفصلة:
I (0) يصف علاقة التكامل المشترك.
ويصف زي T-1 - βAB t-1 مدى الاختلال بعيدا عن المدى الطويل، في حين أن αi هي السرعة والاتجاه الذي تصحح فيه السلاسل الزمنية لزوج العملات نفسها من الاختلال.
عند استخدام طريقة إنغل-غرانجر في تداول أزواج الفوركس، يتم استخدام قيم بيتا للانحدار لحساب أحجام التداول للأزواج.
عند استخدام طريقة إنغل-غرانجر في تداول أزواج الفوركس، يتم استخدام قيم بيتا للانحدار لحساب أحجام التداول للأزواج.
تصحيح الخطأ للتكامل المشترك في أزواج العملات الأجنبية:
عند استخدام التكامل المشترك لتداول أزواج الفوركس، من المفيد أيضا حساب كيفية ضبط المتغيرات المركزة والعودة إلى التوازن على المدى الطويل. لذلك، على سبيل المثال، وهنا هما عينة الوقت أزواج الفوركس سلسلة أظهرت أوتورجريسيفيلي:
تداول أزواج الفوركس على أساس التكامل المشترك.
عندما أستخدم نظام التداول الآلي الخاص بي لتداول أزواج الفوركس، فإن الإعداد والتنفيذ بسيطان إلى حد ما. أولا، أجد أزواج العملات التي تبدو وكأنها قد تكون مشتركة، مثل ور / أوسد و غبب / أوسد.
ثم، أحسب فروق السعر المقدرة بين الزوجين. بعد ذلك، تحقق من وجود استبانة باستخدام اختبار جذر الوحدة أو طريقة شائعة أخرى.
أتأكد من أن خلاصة البيانات الواردة تعمل بشكل مناسب، وأسمح لخوارزميات التداول الميكانيكية بإنشاء إشارات التداول. على افتراض لقد قمت بتشغيل الاختبارات الخلفية كافية لتأكيد المعلمات، وأنا أخيرا على استعداد لاستخدام التكامل المشترك في بلدي أزواج الفوركس التداول.
لقد وجدت مؤشر ميتاتريدر الذي يوفر نقطة انطلاق ممتازة لبناء نظام تداول أزواج الفوركس المشترك. يبدو وكأنه مؤشر بولينجر باند، ولكن في الواقع يظهر مذبذب الفرق السعر بين اثنين من أزواج العملات المختلفة.
عندما يتحرك هذا المذبذب نحو أعلى أو منخفض للغاية، فإنه يشير إلى أن أزواج هي فصل، مما يشير إلى الصفقات.
ومع ذلك، للتأكد من النجاح أعتمد على بلدي نظام البناء الميكانيكية بنيت بشكل جيد لتصفية الإشارات مع اختبار ديكي فولر المعزز قبل تنفيذ الصفقات المناسبة.
وبطبيعة الحال، أي شخص يريد استخدام التكامل المشترك له أو لها أزواج الفوركس التداول، ولكن يفتقر إلى المهارات المطلوبة ألغو البرمجة، ويمكن الاعتماد على مبرمج من ذوي الخبرة لخلق مستشار خبير الفوز.
من خلال سحر التداول الخوارزمي، وأنا برنامج بلدي نظام التداول الميكانيكية لتحديد ينتشر السعر على أساس تحليل البيانات. خوارزميات بلدي خوارزمية لانحرافات الأسعار، ثم تلقائيا يشتري ويبيع أزواج العملات من أجل حصاد أوجه القصور في السوق.
المخاطر التي يجب أن تكون على دراية عند استخدام التكامل المشترك مع تداول أزواج الفوركس.
تداول أزواج العملات الأجنبية ليس خاليا تماما من المخاطر. قبل كل شيء، أنا أضع في اعتبارنا أن أزواج العملات الأجنبية التداول باستخدام التكامل هو استراتيجية انعكاس المتوسط، الذي يقوم على افتراض أن القيم المتوسطة سوف تكون هي نفسها في المستقبل كما كانت في الماضي.
على الرغم من أن اختبار ديكي-فولر المعزز المذكور سابقا مفيد في التحقق من العلاقات المتآزرة لتداول أزواج الفوركس، إلا أنه لا يعني أن فروق الأسعار ستستمر في أن تكون مشتركة في المستقبل.
أنا أعتمد على قواعد قوية لإدارة المخاطر، مما يعني أن نظام التداول الآلي الخاص بي يخرج من الصفقات غير المربحة إذا أو عندما يتم إبطال العائد المحسوب إلى المتوسط.
عندما تتغير القيم المتوسطة، انها تسمى الانجراف. أحاول الكشف عن الانجراف في أقرب وقت ممكن. وبعبارة أخرى، إذا بدأت أسعار أزواج الفوركس السابقة التكوين في التحرك في اتجاه بدلا من العودة إلى المتوسط ​​المحسوب سابقا، فقد حان الوقت لخوارزميات نظام التداول الآلي الخاص بي لإعادة حساب القيم.
عندما أستخدم نظام التداول الميكانيكي الخاص بي لتداول أزواج الفوركس، أستخدم صيغة الانحدار الذاتي المذكورة سابقا في هذه المقالة من أجل حساب المتوسط ​​المتحرك للتنبؤ بالانتشار. ثم، أنا الخروج من التجارة في بلدي حدود الخطأ المحسوبة.
التكامل المشترك هو أداة قيمة لأزواج الفوركس بلدي التداول.
استخدام التكامل في أزواج الفوركس التداول هو استراتيجية التداول الميكانيكية محايدة السوق التي تسمح لي التجارة في أي بيئة السوق. انها استراتيجية ذكية تقوم على العودة إلى يعني، ومع ذلك فإنه يساعدني على تجنب المزالق لبعض استراتيجيات العودة إلى المتوسط ​​يعني تداول العملات الأجنبية.
ونظرا لاستخدامه المحتمل في أنظمة التداول الميكانيكية المربحة، فقد اجتذب التكامل المشترك لتداول أزواج العملات الأجنبية الاهتمام من التجار المحترفين وكذلك الباحثين الأكاديميين.
هناك الكثير من المقالات التي نشرت مؤخرا، مثل هذه المادة بلوق تركز على بلوق، أو هذه المناقشة العلمية للموضوع، فضلا عن الكثير من النقاش بين التجار.
التكامل المشترك هو أداة قيمة في بلدي أزواج الفوركس التداول، وأنا أوصي أن ننظر في الأمر لنفسك.
21 ردا.
مادة جيدة جدا. هو ملهم. شكرا لكتابة ذلك!
كما يتم تطبيق الارتباط في الأسهم (الأسهم). ماهو الفرق؟ هل يمكن تطبيق العملية المذكورة أعلاه على الأسهم؟
نعم، يمكن تطبيق نفس العملية على الأسهم وكذلك على المشتقات. ونظرا لوجود مثل هذا الكون الكبير من الأسهم عند مقارنته بأزواج الفوركس، ينبغي أن يكون هناك عدد أكبر من الفرص المحتملة للتداول. مع عدد من الطحن قوة اليوم & # 8217؛ s نظم التداول، العديد من مجموعات من العلاقات يمكن فحصها بسرعة، في الوقت الحقيقي. ويمكن أيضا استخدام التكامل المشترك من قبل التجار الخيارات. فإنه من المتوقع أن تنتج نتائج مثل انتشار كوكا كولا-بيبسي الشعبي الذي تسمح فيه العلاقات السعرية بين بعض الأسهم / الخيارات للمتداولين بالاشتراك في مسرحيات منخفضة المخاطر إلى حد ما مع فرصة جيدة إلى حد ما للفوز.
هل تتداول في غضون يوم أو أكثر من أسابيع باستخدام هذه الاستراتيجية؟ أيضا، ما لغة البرمجة التي تنصح بها. R يستغرق وقتا طويلا لتشغيل الحسابات وإذا كان في غضون التجارة اليوم، الكمون يأتي في اللعب.
لغة البرمجة لا تهم التداول في نهاية اليوم. أي لغة رئيسية مثل بيرل، بايثون، C / C ++ و C # على ما يرام. R يمكن أن يكون سريع للغاية لكنه يبطئ إذا كان & # 8217؛ s اضطر إلى تخصيص حيوي الذاكرة.
أنا التجارة باستخدام الرسوم البيانية اليومية، وأنا البقاء في معظم الصفقات لبضعة أيام لبضعة أسابيع. شون هو مبرمج خبير، وأنا أثق دائما حكمه لاستخدام أفضل لغة البرمجة للحصول على أفضل النتائج لاستراتيجية التداول معين. في الواقع، يمكن لشون خلق برنامج متوازن، الفوز لتحقيق الاستفادة من التكامل المشترك وعوامل أخرى كذلك. إذا كنت & # 8217؛ د مثل الاقتباس، يرجى الاتصال به مباشرة في معلومات @ أونيستيبريموفيد.
وهناك بعض االهتمام بتنفيذ هذا البرنامج ل MT4. إذا كنت تستطيع تقديم بعض التفاصيل على تنفيذ هذه الاستراتيجية في التعليمات البرمجية، يرجى إرسالها إلى زيمر @ أونيستيبريموفد.
أنا أفعل مشروع صغير على استراتيجيات التكامل المشترك في فكس لبلدي ماجستير. أعتقد أنك ركض اختبارات التكامل المشترك على الكثير من أزواج العملات. ما هي تلك التي وجدت أنها ذات دلالة إحصائية مركزة بشكل كبير؟
أنا لا & # 8217؛ ر أعتقد إدي ركض في الواقع الأرقام. والمقصود من هذه المادة أن تكون دليلا شاملا لهذا المفهوم، ولكن ليس تماما لدرجة كونه استراتيجية حسن النية.
1) أوسد / جبي و ور / تشف.
2) ور / بلن و ور / هف.
3) أوسد / تري و أوسد / زار.
4) أود / أوسد و نزد / أوسد.
5) ور / نوك ور / سيك.
وأنا أعلم أن هذه ترتبط ارتباطا وثيقا للغاية، ولكن هذا لا يعني التكامل المشترك.
هناك أزواج الفوركس جيدة سوينغاتراتد:
لن يكون الدولار أوسجبي / ورشف زوجا متآلفا لأنه لن يكون هناك استراتيجية محايدة للسوق.
شكرا للمشاركة.
هل نفذ أي شخص شفرة باكتست باستخدام إستراتيجية الإرجاع المتوسط؟
هل يجب أن أقيم القيم بين أزواج الفوركس؟
هل أضاف أي شخص تكلفة العمولة إلى باكتست كود وحصلت على نتائج مربحة؟
I & # 8217؛ m متأكد من شخص ما لديه، لكنه & # 8217؛ s ليس شيئا حيث أنت & # 8217؛ سوف تجد لإجابة واضحة على الرسوم البيانية على المدى القصير. قد تجد كوانتيغراتيونس على المدى الطويل، ولكن هذا & # 8217؛ s لا البحوث أنا & # 8217؛ القيام به.
ويتمثل التكامل المشترك الوحيد بين اليورو والفرنك السويسري وبين الدولار الأسترالي والدولار النيوزيلندي حيث أن التجارة والاقتصاد الحميمين الوحيدين بين هذه البلدان والمصارف المركزية يخلقان هذا التكامل المشترك.
ليس اليورو و الجنيه الإسترليني؟
مرحبا إدي. مقال ممتاز. لقد تم اختبار مرة أخرى 10 سنوات من الرسوم البيانية التفكير & # 8221؛ لا أستطيع أن أكون أول شخص فكر في هذا! & # 8221؛ عندما وجدت هذا الموقع. شكرا جزيلا لكتابة هذا. أنا لا & # 8217؛ ر يشعر تماما حتى وحده بعد الآن. 🙂 فقط أتساءل أي وسيط كنت تستخدم أو هل تستخدم وسطاء متعددة. شكرا على وقتك.
مع خالص التقدير روبرت J. أرماغوست.
الوسيط الرئيسي الذي أستخدمه هو بيبرستون و ستو (عبر توبترادر).
مرحبا شون لقد تم تداول هذه الاستراتيجية يدويا. هل لديك برنامج لأتمتة هذا؟ (حتى أنا لا & # 8217؛ ر لديك للحصول على ما يصل في منتصف الليل بعد الآن) شكرا على وقتك.
ليس من على الرف، ولكن ذلك & # 8217؛ ق شيء يمكننا أن نبني. تبادل لاطلاق النار لي رسالة بالبريد الالكتروني مع قواعد الدخول والخروج للحصول على تقدير. معلومات @ onestepremoved.
روبرت & # 8212؛ شكرا لردود فعل طيبة. شون لديه الأدوات المناسبة لتنفيذ هذا النوع من استراتيجية التداول، وأنا أتفق تماما مع توصيات وسيط له، شكرا مرة أخرى للتعليق! EF.

الميكانيكية الفوركس.
التداول في سوق الفوركس باستخدام استراتيجيات التداول الميكانيكية.
التكامل المشترك في سوق الفوركس.
من العديد من أنواع مختلفة من المراجحة الإحصائية المتاحة، قد يكون تداول أزواج واحدة من الأكثر شعبية. في تداول أزواج سوف يحاول المتداول استغلال العلاقة الخطية بين قيم اثنين من الصكوك، في محاولة لشراء / بيعها عندما العلاقة بين قيمها يزيد / ينخفض ​​إلى القيم التي توفر ما يكفي من الأرباح المحتملة. ومع ذلك، فإن تداول الأزواج لا يتطلب فقط ارتباطا خطيا بالوجود، بل يتطلب أيضا أن تكون الأدوات مجتمعة، وهي خاصية أساسية تضمن اتصالا أساسيا بين الأدوات التي تقلل من احتمال الانتشار بين كلا الجهازين & # 8220؛ 8221؛ (اتسعت إلى ما هو أبعد مما هو متوقع إحصائيا). على الرغم من أن تداول الأزواج عادة ما يتم وصفه في الأسهم / السلع، إلا أننا نادرا ما نرى أي دراسة للتكامل المشترك في سوق العملات الأجنبية. اليوم نحن & # 8217؛ لننظر في بعض الكوينغراتيونس المحتملة في سوق العملات الأجنبية، لماذا موجودة وكيف يمكن استغلالها.
دعونا نبدأ بتحديد ما نعنيه بالتكامل المشترك. يتم تجميع سلسلة اثنين من كوينيغراتد عندما تتشارك الانجراف العشوائي المشترك. مثال نموذجي لشرح محادثات التكامل المشترك حول رجل يذهب إلى شريط مع كلبه. بعد الحصول على حالة سكر وترك شريط كل من الرجل والكلب السير على نفس الطريق المنزل، على الرغم من الانجراف العشوائي & # 8211؛ وهي الطريقة العشوائية التي يمشي بها الرجل ويتعجب الكلب على طول الطريق & # 8211؛ مختلفة. وعندما يحدث هذا، فإن مساراتها ترتبط في الواقع ولكنها ليست مشتركة. إذا قرر الرجل بدلا من ذلك وضع المقود على الكلب تصبح مساراتها كوينيغراتد لأنها الآن تشترك الانجراف العشوائي المشترك الذي يحدده طول المقود. الرجل والكلب لا يمكن فصل أكثر من المقود يسمح بها، مما يجعل أي حركات عشوائية أنها تجعل وراء طول معين مشترك لكلا (كما أنها سوف سحب على بعضها البعض). في الإحصاء يمكننا تقييم للتكامل المشترك باستخدام العديد من الاختبارات المختلفة التي يستخدمها اختبار المعزز ديكي فولر (أدف) الأكثر شعبية. لاحظ أن هذا الاختبار يقيم فقط ستاتيوناريتي & # 8211؛ ليس بالضبط كوينغراشيون & # 8211؛ لذلك اختبار آخر مثل اختبار يوهانسن ضروري لتأكيد التكامل المشترك.
عند النظر في الأمثلة الكلاسيكية للتكامل المشترك في سلسلة زمنية مالية، ستلاحظ أن الأدوات التي يتم دمجها بشكل عام لديها بعض الأسباب الأساسية القوية لتكون مشتركة. المقطع & # 8220؛ المقطع & # 8221؛ هي علاقة أساسية بين كلا الصكين، الانجراف العشوائي المشترك بينهما. وعادة ما تكون هذه العلاقة قوية جدا، على سبيل المثال، شركتان منتجهتان للنفط تتقاسمان مصافي التكرير في نفس البلدان بشكل عام، ولديهما نفس العملاء، يتم وضعهما معا بإحكام بحيث يكون من غير المحتمل جدا لأي حدث عشوائي التأثير على أحدهما دون التأثير على الآخر. هذا هو ما يجعل الانحرافات محيرة بحيث تستغل. ولكن في الفوركس، فإن القصة مختلفة بعض الشيء لأن البلدان تواجه صعوبة كبيرة في أن تكون متشابهة بشكل أساسي.
يمكنك أن ترى فعلا هذا بسهولة عندما ننظر في العام الماضي من البيانات لعدة أزواج فكس أننا عادة ما ينظر إليها على أنها مترابطة. على سبيل المثال ور / أوسد و غبب / أوسد تقليديا لديها علاقة كبيرة. مؤامرة تطبيع تظهر السنة الأخيرة من البيانات يظهر لك أن كلا الزوجين في الواقع تميل إلى التحرك في نفس الاتجاه ولكن من الواضح أن هذه العلاقة لا تتبع نفس الانجراف العشوائي. اختبار أدف باستخدام السنة الأخيرة من البيانات لهذين الزوجين سوف تعطيك قيمة 0.28 التي هي ببساطة كبيرة جدا لرفض فرضية نول. النظر إلى أزواج مماثلة أخرى تكشف عن نتائج مشابهة جدا، أزواج مثل أودوس | نزدوسد & # 8211؛ والتي هي أكثر ارتباطا من اليورو مقابل الدولار الأميركي (غبوسد).
ھل ھناك أي تکامل مشترك في سوق العملات الأجنبیة؟ في الواقع الجواب هو نعم. أصدر البنك الوطني السويسري قرار إنشاء أرضية على اليورو مقابل الفرنك السويسري عند 1.20 على & # 8220؛ المقود & # 8221؛ التي جعلت عدة أزواج حصة الانجراف العشوائي. على سبيل المثال، اليورو يوروس و تشفوسد الآن كوينتيغراتد بسبب هذه الحقيقة. سيعطيك اختبار وحدة تغذية المستندات التلقائية قيمة أقل من 0.01 لهذا الزوج، مما يشير إلى أنها بالفعل مدمجة (مؤكدة من اختبار يوهانسن كذلك). كل تشف مماثلة تحتوي على أزواج تظهر أيضا كوينتيغراتيونس، مثل ورجبي | تشفجبي و ورود | أودف. تنشأ هذه التجمعات المشتركة من ربط اليورو مقابل الفرنك السويسري (ورشف)، وهو أمر واضح عند النظر إلى قيمة الانتشار كدالة للوقت بين أي من هذه الأزواج. الصورة الثالثة تظهر لك انتشار زوج اليورو مقابل الدولار الأميركي (تشفوسد) كدالة للوقت، فإنه ليس من المستغرب أن هذا هو نفس الرسم البياني بالضبط مثل اليورو مقابل الفرنك السويسري للعام الماضي. بطول المقطع & # 8220؛ المقطع & # 8221؛ يختلف، لذلك لا قيمة انتشار على أزواج كوينيغراتد.
هل يمكننا الاستفادة من هذه المجموعات المشتركة؟ حسنا، أنت بالتأكيد يمكن. هناك العديد من الطرق التي يمكن أن يتم تداول التكامل المشترك ولكن مع متفاوتة & # 8220؛ المقود & # 8221؛ ومن المحتمل أن تكون هناك طريقة جيدة للتداول بين فرق البولنجر حول الانتشار. يمكنك التداول على أي الأطر الزمنية ولكن حتى عند التداول في الإطار الزمني اليومي يمكنك جعل بعض المال. الصورة الرابعة تظهر محاكاة بسيطة جدا في R حيث تداولت 3 أزواج المذكورة أعلاه، وذلك باستخدام رافعة 1:10، على المتوسط ​​المتحرك 10 فترة باستخدام 1 الانحراف المعياري لمسافات الفرقة. تظهر المحاكاة ربح بنسبة 25٪ مع سحب بنسبة 10٪ خلال العام الماضي، ليست كبيرة جدا ولكن ليست سيئة للغاية أيضا. ومن الممكن أن يؤدي المزيد من التحسينات والإدخالات / المخارج على فترات زمنية أقل إلى زيادة هذه الهوامش.
من المهم أن نتذكر هنا أن المقود هو ربط من البنك المركزي. إذا توقف هذا الربط لسبب ما يتوقف من الممكن أن هذا التكامل المشترك سوف تتلاشى ببساطة. ولذلك فمن المستحسن أن نبقي على التطورات الأساسية ووقف التداول في التكامل إذا حدث ذلك. ومن المهم أيضا أن نكرر باستمرار الاختبارات الإحصائية للتكامل المشترك حيث تأتي البيانات الجديدة بحيث يمكنك التوقف عن تداول أي من هذه الأزواج بمجرد أن يظهر التكامل المشترك للكسر. إذا كنت ترغب في معرفة المزيد عن تداول العملات الأجنبية وكيف يمكنك أيضا تصميم استراتيجيات التداول الخاصة بك يرجى النظر في الانضمام إلى أسيريكوي، موقع على شبكة الانترنت مليئة أشرطة الفيديو التعليمية، ونظم التداول، والتنمية، ونهج سليم وصريح وشفاف نحو التداول الآلي بشكل عام. آمل أن يحظى هذا المقال بإعجابكم ! : س)
6 الردود على & # 8220؛ التكامل المشترك في سوق الفوركس & # 8221؛
& # 8221؛ في الإحصاء يمكننا تقييم للتكامل المشترك باستخدام ثلاثة اختبارات مختلفة من اختبار ديكي فولر (أدف) المعزز هو الأكثر شعبية. & # 8221؛
يو، وهذا هو الاختيار ستاتياريتي. فإنه لا يعني التكامل المشترك.
هذا صحيح، ولكن عندما تكون نتيجة هذا الاختبار إيجابية لسلسلة المالية أنها دائما كوينيغراتد، وهذا هو السبب في ذلك هو شعبيا تستخدم لهذا الغرض وأعتقد. ومع ذلك يمكنك إجراء اختبار يوهانسن كذلك أو اختبار إنغلين "جرانجر اختبارين. في الأمثلة المستخدمة في هذه المقالة كل سلسلة التي تمر اختبار أدف أيضا اجتياز اختبار جوهانسن، تبين أنها كوينيغراتد.
وسوف أكون أكثر من سعيد إذا كنت يمكن أن حصة رمز r الخاص بك من أجل معرفة كيفية القيام بهذه العملية.
تداول الفروقات على اليورو مقابل الدولار الأميركي (تشفوسد) يساوي تداول اليورو مقابل الفرنك السويسري (يورشف) نفسه، والذي، كما هو في الواقع ممكن بشكل مباشر في معظم الوسطاء، يجب أن يفضل (يدفع فقط نصف تكاليف الانتشار / العمولة). انتشار اليورو مقابل الدولار الأميركي (تشفوسد) هو في الواقع أداة اصطناعية لليوروشف.
فكيف يتم تداول هذا التداول بأي شكل مختلف (للأفضل)؟
شكرا على التعليق: o) أنت & # 8217؛ الحق بوضوح، انها نفس التداول على استراتيجية الفرقة البولينجر على اليورو / فرنك سويسري. كما هو مذكور في المقال فإن الانتشار هو في الواقع نفس الرسم البياني مثل ور / تشف. تنعكس قيمة اليورو مقابل الدولار الأميركي (تشفوسد) في الواقع كميل للعودة إلى المتوسط ​​على زوج اليورو مقابل الفرنك السويسري (ور / تشف). إذا كنت ذاهبا إلى تداول هذا في الممارسة التي سوف تستخدم بالفعل ور / تشف لحفظ تكاليف التداول بدلا من شراء / بيع اليورو مقابل الدولار الأميركي و أوسشف.
مادة كبيرة عموما ولكن مربكة في بعض الأماكن. كما تعليق واحد & # 8217؛ أو أشار، اختبار أدف هو اختبار الجذر وحدة. وهو اختبار رسمي يستخدم لتحديد ما إذا كانت سلسلة الأسعار ثابتة أم لا. إذا كنت تحصل على قيمة P أكثر من 1٪، 5٪ أو 10٪ يمكنك أن تفشل فقط في رفض نول من الجذر وحدة على أساس مستوى الأهمية كنت مرتاحا مع. وهذا لا يستدل على وجود التكامل المشترك.
كما تم توثيق قوة وحدة تغذية المستندات التلقائية (أدف) لتكون منخفضة بحيث يمضي معظم الباحثين الآن للمراجعة عبر اختبار تكميلي مثل كبس.
سيكون من المثير للاهتمام أن نرى رمز R حتى نتمكن من تشغيله أيضا ونرى النتائج. يمكنك أن تذكر أن اختبار يوهانسن يؤكد وجود التكامل المشترك، لذلك في كل شيء أعتقد أن النتائج الخاصة بك هي على أرض صلبة.
بعض الأسئلة المثيرة للاهتمام التي تأتي هي كيف مستقرة هي علاقة التكامل المشترك؟ كم عدد المرات التي تتغير فيها علاقة المدى الطويل وتغير حجم هذه التغييرات عندما تحدث.
مقالة كبيرة عموما، والحفاظ عليها القادمة والقيام بمشاركة بعض رمز R.

كونيغراتيون ترادينغ فوريكس
آخر تحديث للصفحة.
16 فبراير 2003.
استراتيجيات التداول القائمة على التكامل المشترك:
نهج جديد لتعزيز تتبع المؤشرات والمراجحة الإحصائية.
البحث عن التقنيات الكمية المناسبة لبناء استراتيجيات قصيرة الأجل للأسهم ليس آخر تطورات اللحظة في الأسواق المالية. الوافدين الجدد في هذه اللعبة والانضمام باستمرار اللاعبين التقليديين، وفي الوقت الراهن، والباحثين الأكثر حماسا في الاستراتيجيات الكمية هي صناديق التحوط المشاركة في تداول الأسهم. إن المرونة التشغيلية وعدم وجود قيود مناسبة بشكل مثالي للسماح لها بالاستفادة من تطبيق هذه الأنواع من استراتيجيات التداول.
في هذا الخط من البحث، نقترح عدة استراتيجيات "التكامل المشترك"، مثل تتبع مؤشر والمراجحة الإحصائية. وتهدف الاستراتيجية الأولى إلى تكرار معيار مرجعي من حيث العائدات والتقلب، في حين تسعى الأخرى إلى تحقيق عوائد ثابتة في ظل جميع ظروف السوق. وعلی عکس الاستراتیجیات التجاریة التقلیدیة الأخرى، فإن تحسین المحفظة یستند إلی التکامل المشترك بدلا من الارتباط. عندما تطبق على الأسهم في دجيا، وقد أسفرت هذه الاستراتيجيات التجارية نتائج مطردة جدا. فعلى سبيل المثال، بين كانون الثاني / يناير 1995 وكانون الأول / ديسمبر 2001، أعادت استراتيجيات المراجحة الإحصائية ذات التمويل الذاتي الأكثر نجاحا (بعد خصم تكاليف المعاملات وتكاليف إعادة الشراء) قرابة 10 في المائة مع تقلب سنوي بنسبة 2 في المائة تقريبا، وارتباط ضئيل بالسوق (الكسندر وديميتريو، 2002). وبطبيعة الحال، فإن الاستراتيجيات الممولة التي نوقشت في تلك الورقة تعود إلى حد بعيد، ولكن لديها تقلبات أعلى قليلا. في معظم السنوات كانت استراتيجياتنا نسب شارب قريبة من واحد.
كان تطبيق تقنية التكامل المشترك لتخصيص الأصول رائدا من قبل لوكاس (1997) والكسندر (1999). وخصائصها الرئيسية، أي تعادل خطأ التتبع وتعزيز الأوزان للاستقرار والاستخدام الأفضل للمعلومات المتضمنة في أسعار الأسهم، وتتيح تصميما مرنا لمختلف استراتيجيات التداول الممولة والتمويل الذاتي، بدءا من الفهرس وتعزيز تتبع المؤشرات، وتقنيات نقل السوق المحايدة وألفا.
لماذا تستخدم التكامل المشترك في إدارة المحافظ؟
وقد طبق مفهوم التكامل المشترك على نطاق واسع في الاقتصاد القياسي المالي فيما يتصل بتحليل السلاسل الزمنية والاقتصاد الكلي. وقد تطورت على أنها تقنية إحصائية قوية للغاية لأنها تسمح بتطبيق أساليب تقدير بسيطة (مثل العادي العادي الحد الأدنى وأقصى احتمال) للمتغيرات غير ثابتة. ومع ذلك، فإن أهميتها بالنسبة لتحليل االستثمار كانت محدودة إلى حد ما حتى اآلن، ويرجع ذلك أساسا إلى حقيقة أن المعيار في إدارة المحفظة وقياس المخاطر هو تحليل ارتباط عائدات األصول.
ومع ذلك، فإن تحليل الارتباط صالح فقط للمتغيرات الثابتة. ويتطلب ذلك عدم التجاهل في الأسعار والمتغيرات المالية الأخرى التي عادة ما يتم دمجها في النظام الواحد أو أعلى. أخذ الفارق الأول في أسعار السجل هو الإجراء القياسي لضمان الاستقرارية ويقود كل الاستدلال الإضافي إلى أن يقوم على العوائد. بيد أن هذا الإجراء ينطوي على عيب فقدان المعلومات القيمة. وعلى وجه الخصوص، فإن إزالة المتغيرات قبل التحليل يزيل أي إمكانية للكشف عن الاتجاهات المشتركة في الأسعار. على النقيض من ذلك، فإن الهدف من تحليل التكامل المشترك هو الكشف عن أي اتجاه مؤشر ستوكاستيك في بيانات الأسعار واستخدام هذه الاتجاهات المشتركة لتحليل ديناميكي للارتباط في العائدات (الكسندر، 2001).
والملاحظة الأساسية التي تبرر تطبيق مفهوم التكامل المشترك، على سبيل المثال، تحليل أسعار الأسهم، هي أن نظام أسعار الأسهم غير الثابتة في المستوى يمكن أن يشترك في اتجاهات مؤشر ستوكاستيك المشتركة (ستوك أند واتسون، 1991). وفقا ل بيفريدج ونيلسون (1981)، متغير لديه اتجاه مؤشر ستوكاستيك إذا كان الفرق له أرما الثابتة (p، q) التمثيلية بالإضافة إلى عنصر حاسم. وبما أن نماذج أريما (p، 1، q) يبدو أنها تميز العديد من المتغيرات المالية، فإنه يتبع أن النمو في هذه المتغيرات يمكن وصفه بالاتجاهات العشوائية.
وعند تطبيقه على أسعار األسهم في مؤشر سوق األسهم، فإن التكامل المشترك موجود عندما توجد محفظة واحدة على األقل من األسهم ذات خطأ تتبع ثابت) نستخدم خطأ تتبع المصطلح كما يفعل اإلحصائيون، لإلشارة إلى الفرق بين المؤشر والمحفظة (، . وبعبارة أخرى، يحدث التكامل المشترك عندما يكون هناك انعكاس في انتشار السعر بين المحفظة والمؤشر. ولا توفر هذه النتيجة أي معلومات للتنبؤ بالأسعار الفردية في النظام، أو موقف النظام في مرحلة ما في المستقبل، ولكنها توفر معلومات قيمة، بصرف النظر عن موقعه، وأسعار الحافظة والمؤشر ستبقى معا على المدى الطويل.
مخطط استراتيجيات التداول.
Considering the above, finding a cointegration relationship, i. e. a stationary linear combination of the market index and a number of stocks from its components (usually specified as log prices), is equivalent to having a mean reverting spread between the market index and a tracking portfolio. Under such circumstances, by means of construction, the returns on the tracking portfolio will equal the returns on the index, on a long-run basis.
Additionally, being constructed on a rather long history of prices, the portfolio weights tend to ignore short-term movements in stock prices, such as bubbles or just noise, and focus on the long-run behaviour of the prices. As already shown, the fact that the tracking error is, by construction, mean reverting ensures that the tracking portfolio will stay 'tied together' with the index in the long-run, irrespective to short-term movements in individual stock prices. There can, however, be short-term de-correlations between the tracking portfolio and the index. In fact, this is a potential source of 'alpha', i. e. excess return, in the tracking portfolios.
A number of trading strategies can be constructed based on cointegration relationships:
A. Index tracking.
The first cointegration-based trading strategy investigated is a classical index tracking aiming to replicate a benchmark in terms of returns and volatility. An index tracking process entails two, equally important stages: first, selecting the stocks to be included in the tracking portfolio and then, determining the portfolio holdings in each stock based on a cointegration optimisation technique.
The first stage, stock selection, can be the result of proprietary selection models, technical analysis, or just stock picking skills of a portfolio manager. The degree of cointegration and consequently the tracking performance will depend very much on the selection process. However critical, the selection process does not have special features in a cointegration-based tracking technique. It constitutes rather a control variable in identifying the most appropriate tracking strategy.
The second stage of index tracking concerns determining the portfolio holdings in each of the stocks selected in the previous stage. The stocks weights in each portfolio are estimated based on the ordinary least square (OLS) coefficients of the cointegration equation regressing the index log-price on the portfolio stocks log-prices over a given calibration period prior to the portfolio's construction moment. We note that the application of OLS to non-stationary dependent variables such as log(index) is only valid in the special case of a cointegration relationship. Unless the residuals from the cointegration regression are found to be stationary, the OLS coefficients will be inconsistent and further inference based on them will be invalid. Therefore, testing for cointegration is an essential step in constructing cointegration-based tracking portfolios.
Further to estimation, the OLS coefficients are normalised to sum up to one, thus providing the weights of each stock in the tracking portfolio.
As shown in Alexander and Dimitriu (2002), even by using simple stock selection rules such as ranking the stocks by their weight in the index, the tracking portfolios constructed based on this methodology can accurately replicate the market index.
B. Enhanced index tracking and statistical arbitrage.
Having constructed the simple tracking strategy, a natural extension for exploiting the tracking potential of the cointegrated portfolios would be to replicate artificial indexes, 'plus' or 'minus', constructed as to linearly over-perform or under-perform the market index by a given amount per annum. Then, self-financing long-short strategies can be set up by being short on a portfolio tracking the 'minus' benchmark, and long on a portfolio tracking the 'plus' benchmark.
This type of statistical arbitrage strategy should generate returns according to the 'plus'/'minus' spread (i. e. double alpha) with fairly low volatility and no significant correlation with the market returns. We expect to become more and more difficult to find cointegrated portfolios as the magnitude of the spread between the benchmarks tracked increases. The cointegration relationship between the market index and its component stocks has a solid rationale, but this is not necessarily the case for portfolios tracking artificial benchmarks, which may be chosen to over-perform the market index by 50%, for example. The difficulty in finding an appropriate cointegration relationship leads to an increased instability of the stock weights, higher transaction costs and higher volatility of returns. To avoid this, it is essential to ensure that all the portfolios tracking 'plus' or 'minus' benchmarks pass the cointegration test.
C. Combining index tracking with statistical arbitrage.
In case market neutrality is not a requirement and an exposure to a market index is desired, another possibility would be to transport the alpha gained in the market neutral framework to an index, through the use of derivatives (e. g. index futures). Or, instead of derivatives, an enhanced cointegration-based index tracking procedure can be implemented.
This type of strategy, combining enhanced index tracking with statistical arbitrage, should have a high correlation with the market index, while gaining alpha from two sources: first, the excess return from enhanced index tracking and then, double alpha from the statistical arbitrage. When applying alpha transfer strategies to the stocks in DJIA, Alexander and Dimitriu (2002) have obtained significantly better Sharpe ratios then the market, even after accounting for transaction and repo costs.
As already pointed out, the cointegration concept has a number of attractive features in modelling asset prices, which recommend it as a significantly better alternative to the classic correlation analysis in portfolio management. Its key characteristics, i. e. mean reverting tracking error, enhanced weights stability and better use of the information comprised in stock prices, allow a flexible design of trading strategies, from enhanced index tracking to statistical arbitrage. Moreover, its application in constructing trading strategies within the DJIA stocks has produced encouraging results, which can be further refined.
Alexander, C. O. (1999) "Optimal hedging using cointegration" Philosophical Transactions of the Royal Society A 357, pp. 2039-2058.
Alexander, C. O. (2001) Market Models: A Guide to Financial Data Analysis, John Wiley, pp. 347-388.
Alexander, C. O. and A. Dimitriu (2002) "The Cointegration Alpha: Enhanced Index Tracking and Long-Short Equity Market Neutral Strategies", Discussion Paper 2002-08, ISMA Centre Discussion Papers in Finance Series.
Beveridge, S. and C. R. Nelson (1981) "A New Approach to Decomposition of Economic Time Series into Permanent and Transitory Components with Particular Attention to Measurement of the Business Cycle", Journal of Monetary Economics 7, pp. 151-74.
Lucas, A. (1997) "Strategic and Tactical Asset Allocation and the Effect of Long - Run Equilibrium Relations", Research Memorandum 1997-42, Vrije Universiteit Amsterdam.

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.
Check out my ebook on quant trading where I teach you how to build profitable systematic trading strategies with Python tools, from scratch.
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, 2018.
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 Email List:
1. Quant Trading Lessons.
You'll get instant access to a free 10-part email course packed with hints and tips to help you get started in quantitative trading!
2. All The Latest Content.
Every week I'll send you a wrap of all activity on QuantStart so you'll never miss a post again.
Real, actionable quant trading tips with no nonsense.

Gekko Quant – Quantitative Trading.
Quantitative Trading, Statistical Arbitrage, Machine Learning and Binary Options.
آخر الملاحة.
Statistical Arbitrage – Trading a cointegrated pair.
In my last post gekkoquant/2018/12/17/statistical-arbitrage-testing-for-cointegration-augmented-dicky-fuller/ I demonstrated cointegration, a mathematical test to identify stationary pairs where the spread by definition must be mean reverting.
In this post I intend to show how to trade a cointegrated pair and will continue analysing Royal Dutch Shell A vs B shares (we know they’re cointegrated from my last post). Trading a cointegrated pair is straight forward, we know the mean and variance of the spread, we know that those values are constant. The entry point for a stat arb is to simply look for a large deviation away from the mean.
A basic strategy is:
If spread(t) >= Mean Spread + 2*Standard Deviation then go Short If spread(t) <= Mean Spread – 2*Standard Deviation then go Long.
If spread(t) >= nDay Moving Average + 2*nDay Rolling Standard deviation then go Short If spread(t) <= nDay Moving Average – 2*nDay Rolling Standard deviation then go long.
If spread(t) <= Mean Spread + 2*Std AND spread(t-1)> Mean Spread + 2*Std If spread(t) >= Mean Spread – 2*Std AND spread(t-1)< Mean Spread – 2*Std Advantage is that we only trade when we see the mean reversion, where as the other models are hoping for mean reversion on a large deviation from the mean (is the spread blowing up?)
This post will look at the moving average and rolling standard deviation model for Royal Dutch Shell A vs B shares, it will use the hedge ratio found in the last post.
Sharpe Ratio Shell A & B Stat Arb Shell A.
Annualized Sharpe Ratio (Rf=0%):
Shell A&B Stat Arb 0.8224211.
Shell A 0.166307.
The stat arb has a Superior Sharpe ratio over simply investing in Shell A. At a first glance the sharpe ratio of 0.8 looks disappointing, however since the strategy spends most of it’s time out of the market it will have a low annualized sharpe ratio. To increase the sharpe ratio one can look at trading higher frequencies or have a portfolio pairs so that more time is spent in the market.
22 أفكار حول & لدكو؛ Statistical Arbitrage – Trading a cointegrated pair ”
it also means that when identified the maximum divergence i can take position in derivatives like options?
-selling ATM Call option on first stock.
-buy Call option on the second one.
or with a BacKSpreadCall on the first and a BackSpreadPut on the second so I can set the protections and I can roll them if they go out control…
The short positions should be moneyness ATM or lightly OTM in my opinion.
What do yo think about?
Did you tried using Johansen’s testing approach in order to perform a more rigorous testing of cointegration? What do you think about combining Engle-Granger with Johansen?
The spread in the above does not oscillate around it mean, ideally, a cointegrated pair should trade sideways not in a trending manner as shown above….your write-up was perfect on proper cointegration you demonstrated. but this spread is not a perfect spread.
I 100% agree with you.
However for practical purposes as long as the mean reversion happens faster than the mean changes then you’ll do well.
I guess that’s something I’ve missed, how to quantify the half life/reversion speed.
Please note that in the above demo the look back period is 90days. This is fairly short. Choosing 200 days will result in a mean that is less responsive / changes direction. It will most likely increase the size of the standard deviation bands and result in less trades per year. This usually results in a lower Sharpe ratio.
Very interesting post. Would love to see the implementation on a basket of pairs.
I do some changes in your programme to calculate the bollinger bands and I wanna know why you’re put the Standard deviation to the right? (movingStd = rollapply(spread, lookback, sd, align=”right”, na. pad=TRUE))
OK thank you for answering!
Your blog give me the chance to implement and build more quickly my stat arb strategy.
I am going to test different models for statistical arbitrage. I keep all the visitors in the loop!
In your program, the martingale effect is not here. How can I add this effect?
I am running my iwn backtests with differents programs (Excel, R et ProRealTime (a french platform)) and in order to do some comparison, I need to add the martingale effect.
Thanks for the clarification. By the same argument, rollmean has to have the same: rollmean(spread, lookback, na. pad=TRUE, align=’right’)
With this new modification the Sharpe ratio drops dramatically ..
Great stuff!! I think there are two bugs in your code, though. First one is in calculation of moving average. You forgot to set align parameter to “right” (like you do for standard deviation). Function uses default “center” and your data – spread and moving average are not aligned. You can see this from the plot as well. Moving average ends 45 days before the spread. Second bug is in calculation of trading returns. I think you should take return from the next day as we enter the position at the closing price.
Thanks for your elegant code. I noticed that your line of code:
is meant to apply the function shortPositionFunc to (-1*aboveUpperBand+belowMAvg).
However, the function shortPositionFunc takes two arguments x and y.
Is there any typo in the code?
Thank you for your clarification!
Thanks Gekko for the backtesting code. It is very useful. Couple of comments below:
1) Another reader has already commented about this above. movingAvg needs to be amended by adding align=”right” in order to have the first moving avg number on day 90:
movingAvg = rollmean(spread, lookback, align=”right”, na. pad=TRUE)
2) since we enter trades at end of day, the return on trade date shouldn’t count. we can simply shift every element in the “positions” vector down by using the “shift” function in the taRifx library.
Also, I don’t believe daily return is (aRet – stockPair$hedgeRatio*bRet). Imagine if you had a large hedge ratio, i. e. if stock A is priced at $100 and stock B is priced at $10, then the hedgeRatio would be in the neighborhood of 10. Since aRet and bRet are in % terms, the formula won’t work. Daily return should be aRet – bRet * (ratio between dollar neutral ratio vs hedge ratio).
#Calculate spread daily ret.
dailyRet <- aRet – bRet*hedgeRatioOVERdollarNeutralRatio.
tradingRet <- dailyRet * shift(positions,-1)
I am looking for new strategies in equity pair trading that improve the standard cointegration approach (for instance I started looking into the pair trading with copulas, which still seems an “unstable” alternative to cointegration). Do you have any new paper to suggest me? Thank you very much and congrats for the great blog.
The second half of the book goes through lots of more advanced techniques for hedging a portfolio / finding stationary pairs.
i am a bit confused in this step.
when i plotted the longPositions and ShortPositions along with the spread, bands and moving average lines found then there are consecutive long signals and short signals. According to my understanding.
longPostions <- if spread is below lowerband.
longExit <- if spread is above movAvg while long.
shortPostions <- if spread is above upperband.
shortExit <- if spread is below movAvg while short.
is this same thing your code is doing. Please help me understand this part.
Hi Gekko, I read the books of EP Chan that talks about this topic and I a little bit confused about mean reservion. When two assets ara cointegrated we are supposing that they will come back to their mean, but their moving average or their total mean in a fixed period? I’m giving better results using static parameters than using bollinger bands. I will show you an image with my doubt. prntscr/51jofw Could you write another article of mean reversion! Thanks for all.
Hi Gekko. Great Code. Could you closer explain an idea behind this cappedCumSum function ? I do not understand the moment when you are specifing two input variables, but in Reduce() function is only one parameter, – is it because of 0?
There is a mistake. Your algorithm looks in the future, the problem in rollmean function. Algorithm using moving average from future days to close position.

No comments:

Post a Comment