PineCodersTASC

TASC 2022.07 Pairs Rotation With Ehlers Loops

█ OVERVIEW

TASC's July 2022 edition of Traders' Tips includes an article by John Ehlers titled "Pairs Rotation With ​Ehlers Loops". This is the code that implements the Ehlers Loops applied to pairs rotation trading.

█ CONCEPTS

John Ehlers developed Ehlers loops as a tool to visualize the performance of one data stream versus another. Initially, he used this tool to chart price versus volume. However, Ehlers loops proved to be suitable for determining the timing of the pairs rotation strategy. This strategy works by having a long position in only one of two securities, depending on which one is considered stronger at a given time.

When the prices of two securities (filtered and scaled with a standard deviation for consistent presentation) are plotted against each other, the curvature and direction of rotation on the chart can help guide decisions on long positions. For example, when plotting a stock versus a referenced symbol, a vertical upward movement while rotating clockwise is a sign of going long the stock. Similarly, a horizontal movement to the right while rotating counterclockwise is the sign to go long the reference. A higher probability of a reversal is expected when the price moves more than one or two standard deviations.

█ CALCULATIONS

The script uses the following steps to calculate the Ehlers Loops:
  • The price data of both securities in the pair are individually filtered using identical high-pass and SuperSmoother filters. This results in two band-limited data streams, having a nominally zero mean. The input parameters Low-Pass Period and High-Pass Period control the filter bandwidth and thus can modify the shape of the Ehlers Loops.
  • Subsequently, the filtered data streams are scaled in terms of standard deviation by dividing each of them by their root-mean-square (​RMS) values. These data streams are plotted as zero-mean oscillators.
  • Finally, the scaled data streams are displayed one against another for the selected time interval (defined by the input parameter Loop Segments). In the resulting scatterplot, the thicker line corresponds to the later data points. The fluctuations of the filtered price data of the chart symbol are plotted along the y-axis, and the price changes of the referenced symbol are shown along the x-axis.


Tools and ideas for all Pine coders: www.tradingview.com/u/PineCoders/
Pine news broadcasts: t.me/PineCodersSquawkBox or twitter.com/PineCoders
TASC: traders.com/
Script open-source

Dans le véritable esprit de TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par le règlement. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser ce script sur un graphique ?