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 abierto

Siguiendo el verdadero espíritu de TradingView, el autor de este script lo ha publicado en código abierto, para que los traders puedan entenderlo y verificarlo. ¡Un hurra por el autor! Puede utilizarlo de forma gratuita, aunque si vuelve a utilizar este código en una publicación, debe cumplir con lo establecido en las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

Exención de responsabilidad

La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.

¿Quiere utilizar este script en un 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)