Ni6HTH4wK

[LAVA] Heiken Ashi Re-Enter Levels

384
Using Heiken Ashi at customizable higher intervals and some standard deviation of candle lengths, some of the guesswork of picking tops and bottoms can be reduced using this tool.

This indicator is a variation of another tool that I plan on certifying as a low-cost subscription option.
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?
// Tradingview.com Pinescript @author Ni6HTH4wK [LAVA]
study(title="[LAVA] Heiken Ashi Re-Enter Levels", overlay=true)

// Inputs
n1  = input(20, title="Multiplier", minval=1)
n2  = input(100, title="Trend Length", minval=1)

// Sources
hk_open = security(heikenashi(tickerid), tostring((interval*n1)), open)
hk_stop = security(heikenashi(tickerid), tostring((interval*n1)), close)
hk_local_open = na(hk_open[1])?open:(hk_open[1]+ohlc4[1])/2
hk_local_stop = ohlc4
hk_cci = cci(ohlc4, n1)

// Source logic
oc2 = avg(hk_open,hk_stop)
oc_hi = max(hk_local_open,hk_local_stop)
oc_lo = min(hk_local_open,hk_local_stop)
oc_dif = avg(oc_hi-oc_lo, high-low)
dif_ema = ema(oc_dif, 14)
std_dev = stdev(dif_ema, 20)*3+dif_ema

// Heiken Ashi Logic
hk_bull = hk_stop>hk_open?low>=hk_open?3*std_dev+hk_bull[1]:1*std_dev+hk_bull[1]:0
hk_bear = hk_open>hk_stop?high<=hk_open?3*std_dev+hk_bear[1]:1*std_dev+hk_bear[1]:0
hk_bearfish = sma(hk_bear, n2)
hk_bearwale = sma(hk_bearfish, n2*2)
hk_bullfish = sma(hk_bull, n2)
hk_bullwale = sma(hk_bullfish, n2*2)
hk_bot  = hk_bullfish>hk_bullwale?hk_bull and hk_cci<0?oc2-std_dev:0:0
hk_top  = hk_bearfish>hk_bearwale?hk_bear and hk_cci>0?oc2+std_dev:0:0

// Plotting
plot(hk_top>0?hk_top:na, title="Bearish Tops", color=red, style=circles, linewidth=2)
plot(hk_bot>0?hk_bot:na, title="Bullish Bottoms", color=green, style=circles, linewidth=2)