accidentje

4/2 pivot levels

Plots...
  • Confirmed highs when 1. it's higher than the 4 prior (lower) highs AND 2. higher than the 2 following (lower) highs.
  • Confirmed lows when 1. it's lower than the 4 prior (higher) lows AND 2. lower than the 2 following (higher) lows.
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?
study(title="4/2 pivot levels", shorttitle="4/2 pivot", overlay=true)
//
useAlternativeTF = input(false)
AlternativeTF = input("W")
tf = useAlternativeTF ? AlternativeTF : period
//
h0 = security(tickerid, tf, high[0])
h1 = security(tickerid, tf, high[1])
h2 = security(tickerid, tf, high[2])
h3 = security(tickerid, tf, high[3])
h4 = security(tickerid, tf, high[4])
h5 = security(tickerid, tf, high[5])
h6 = security(tickerid, tf, high[6])

l0 = security(tickerid, tf, low[0])
l1 = security(tickerid, tf, low[1])
l2 = security(tickerid, tf, low[2])
l3 = security(tickerid, tf, low[3])
l4 = security(tickerid, tf, low[4])
l5 = security(tickerid, tf, low[5])
l6 = security(tickerid, tf, low[6])
//
pivoth = h2 > h1 and h2 > h0 and h6 < h2 and h5 < h2 and h4 < h2 and h3 < h2 ? h2 : pivoth[1]
pivotl = l1 < l0 and l2 < l0 and l6 > l2 and l5 > l2 and l4 > l2 and l3 > l2 ? l2 : pivotl[1]
//
plot(pivoth, color= pivoth != pivoth[1] ? na : red, linewidth=2)
plot(pivotl, color= pivotl != pivotl[1] ? na : green, linewidth=2)