taylor_o

two_leg_spread_diff

This script helps you discern the relative change of each leg in a two-legged spread over a given period. The main plot is a difference in log return over the number of bars identified by the "lag" parameter. E.g. if "lag" is 10 and leg one has increased 3% over the past ten bars, while leg two has only increased 1%, the plot value is 2%. The main plot is also colored blue when leg one increases while leg two decreases on a given bar, and red if the opposite is true. This feature identifies periods where the correlation between the two legs diminishes. The one and two standard deviation of the main plot is also plotted in faint background lines. Additionally, a table indicates the percentage in which the main plot is within one standard deviation (acc 1) and two standard deviations (acc 2). Note that the standard deviation updates on each bar, so the current standard deviation is not the one used to calculate the accuracy. Rather, if there are N bars, N different standard deviation readings have been used to compute the accuracy statistics.

The inputs are:

- timeframe: the timeframe of the chart
- leg1_sym: the symbol of the first leg
- leg2_sym: the symbol of the second leg
- lag: the number of bars back to reference for computing the log return of each leg
- anchor_to_session_start: for intraday charts only, this overwrites the "lag" input so that the "lag" always sets the point of comparison to the session start. This setting is used to compute the relative change over a single session.
Skrypt open-source

Zgodnie z prawdziwym duchem TradingView, autor tego skryptu opublikował go jako open-source, aby traderzy mogli go zrozumieć i zweryfikować. Brawo dla autora! Możesz używać go za darmo, ale ponowne wykorzystanie tego kodu w publikacji jest regulowane przez Dobre Praktyki. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.

Chcesz użyć tego skryptu na wykresie?