taylor_o

two_leg_spread_returns_zscore

taylor_o Atualizado   
This script helps assess the relative returns of each leg in a two-legged spread. It shows the z-score of each period's returns, along with a moving average of the difference between the two returns. A negative moving average implies that the second leg is strengthening, on a relative return basis, against the first leg, and vice versa. The inputs are:

- timeframe: the timeframe for the calculations. the default is five minutes.
- leg1_sym: the symbol for the first leg
- leg2_sym: the symbol for the second leg
- ma_length: the length of the moving average. by default it is 48, or the previous four hours, given the default timeframe.

The default symbols are RB and HO, simply as an example of an intercommodity spread.
Notas de Lançamento:
- made lines transparent so they don't block each other
- added 0 line
Notas de Lançamento:
- set background faint pink if returns have different signs
Notas de Lançamento:
- colored background faint blue if leg1 advances while leg 2 declines, and orange if leg 2 advances and leg 1 declines
Notas de Lançamento:
- moving average line is blue if above 0 (leg1 returns strengthening relative to leg 2), orange if below (opposite).
Script de código aberto

Dentro do verdadeiro espírito TradingView, o autor deste script publicou ele como um script de código aberto, para que os traders possam compreender e checar ele. Um viva ao autor! Você pode usá-lo gratuitamente, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.

Quer usar esse script no gráfico?