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 open-source

Nello spirito di condivisione promosso da TradingView, l'autore (al quale vanno i nostri ringraziamenti) ha deciso di pubblicare questo script in modalità open-source, così che chiunque possa comprenderlo e testarlo. Puoi utilizzarlo gratuitamente, ma il riutilizzo del codice è subordinato al rispetto del Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.

Vuoi usare questo script sui tuoi grafici?
// 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)