PineCodersTASC

TASC 2022.11 Phasor Analysis

█ OVERVIEW

TASC's November 2022 edition Traders' Tips includes an article by John ​Ehlers titled "Recurring Phase Of Cycle Analysis". This is the code that implements the ​phasor analysis indicator presented in this publication.


█ CONCEPTS

The article explores the use of phasor analysis to identify market trends.

An ordinary rotating phasor diagram is a two-dimensional vector, anchored to the origin, whose rotation rate corresponds to the cycle period in the price data stream. Similarly, Ehlers' phasor is a representation of angular phase rotation along the course of time. Its angle reflects the current phase of the cycle. Angles -180, -90, +90 and +180 degrees correspond to the beginning, valley, peak and end of the cycle, respectively.

If the observed cycle is very long, the market can be considered trending. In his article, John ​Ehlers defined trending behavior to occur when the derived instantaneous cycle period value is greater that 60 bars. The author also introduced guidelines for long and short entries in a trending state. Depending on the tuning of the indicator period input, a long entry position may occur when the phasor angle is around the approximate vicinity of −90 degrees, while a short entry position may occur when the phasor angle will be around the approximate vicinity of +90 degrees. Applying these definitive guidelines, the author proposed a state variable that is indicated by +1 for a trending long position, 0 for cycling, and −1 for a trending short position (or out).

The phasor angle, the cycle period, and the state variable are made available with three selectable display modes provided for this TradingView indicator.

█ CALCULATIONS

The calculations are carried out as follows.

First, the price data stream is correlated with cosine and sine of a fixed cycle period. This produces two new data streams that correspond to the projections of the frequency domain phasor diagram to the horizontal (so-called real) and vertical (so-called imaginary) axis respectively. The wavelength of the cycle period input should be set for the midrange vicinities of the phasor to coincide with the peaks and valleys of the charted price data.

Secondly, the phase angle of the phasor is easily computed as the arctangent of the ratio of the imaginary component to the real component. The difference between the current phasor values and its last is then employed to calculate a derived instantaneous period and market state. This computation is then repeated successively for each individual bar over the entire duration of the data set.

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/
오픈 소스 스크립트

이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

차트에 이 스크립트를 사용하시겠습니까?