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.
สคริปต์โอเพนซอร์ซ

ด้วยจิตวิญญาณของ TradingView อย่างแท้จริง ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้ผู้ค้าสามารถเข้าใจและตรวจสอบได้ ไชโยให้กับผู้เขียน! คุณสามารถใช้ได้ฟรี แต่การใช้รหัสนี้ซ้ำในสิ่งพิมพ์อยู่ภายใต้กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ เงื่อนไขการใช้บริการ

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?
// 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)