커뮤니티

지표변환 부탁드립니다.

프로필 이미지
고저중
2026-01-11 16:40:17
107
글번호 229704
답변완료

// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/

// © MisinkoMaster


//@version=6

indicator("Extreme HMA ATR Bands", "EHA Bands | MisinkoMaster", overlay =true,

behind_chart = false)

//////////////////////////////////////////////////////////////////////////////////////////////////////

//Import Libraries

import TradingView/ta/12

//////////////////////////////////////////////////////////////////////////////////////////////////////

//Get User Defined Inputs

len = input.int(33, "Length")

src = input.source(close, "Source")


atr_len = input.int(30, "ATR Length")

atr_mul = input.float(0.7, title = "ATR Multiplier", step = 0.05)

//////////////////////////////////////////////////////////////////////////////////////////////////////

//Calculations

sqrtlen = math.round(math.sqrt(len))

halflen = math.round(len/2)


hma = ta.ema(src, sqrtlen)

h = ta.highest(hma, len)

l = ta.lowest(hma, len)


hh = ta.lowest(h, halflen)

ll = ta.highest(l, halflen)


hhh = ta.lowest(hh, sqrtlen)

lll = ta.highest(ll, sqrtlen)


mid = (hh+ll)/2

atr = ta.atr(atr_len)*atr_mul


Upper = mid+atr

Lower = mid-atr

//////////////////////////////////////////////////////////////////////////////////////////////////////

//Trend Logic

var trend = 0


L = src > Upper

S = src < Lower


if L

trend := 1

if S

trend := -1

//////////////////////////////////////////////////////////////////////////////////////////////////////

//Plotting

var col = color.rgb(81, 81, 81)

var colT = color.rgb(81, 81, 81, 50)

if L

col := color.rgb(0, 217, 197)

colT := color.rgb(0, 217, 197, 50)

if S

col := color.rgb(217, 0, 197)

colT := color.rgb(217, 0, 197, 50)


up = plot(Upper, "Upper", col, 2)

lp = plot(Lower, "Lower", col, 2)


mp = plot(mid, "Base Line", color = col, linewidth = 2, linestyle = plot.linestyle_dashed)


fill(up, lp, colT)


plotcandle(open, high, low, close, color = col, wickcolor = col, bordercolor = col, display = display.pane)

지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2026-01-12 15:58:04

안녕하세요 예스스탁입니다. input : len(33); input : atr_len(30); input : atr_mul(0.7); var : src(0),sqrtlen(0),halflen(0); var : hma(0),hv(0),lv(0),hh(0),ll(0),hhh(0),lll(0); var : mid(0),ap(0),a(0),ATR(0),Upper(0),lower(0); src = close; sqrtlen = round(sqrt(len),0); halflen = round(len/2,0); hma = ema(src, sqrtlen); hv = highest(hma, len); lv = lowest(hma, len); hh = lowest(hv, halflen); ll = highest(lv, halflen); hhh = lowest(hh, sqrtlen); lll = highest(ll, sqrtlen); mid = (hh+ll)/2; ap = 1 / atr_len ; A = IFf(IsNan(A[1]) == true, ma(TrueRange,atr_len) , ap * TrueRange + (1 - ap) * IFf(isnan(A[1])==true,0,A[1])); atr = A*atr_mul; Upper = mid+atr; Lower = mid-atr; var : trend(0),lcond(False),Scond(False); var : col(rgb(81, 81, 81)),colt(rgb(81, 81, 81)); Lcond = src > Upper; Scond = src < Lower; if Lcond == true Then { trend = 1; col = rgb(0, 217, 197); colT = rgb(0, 217, 197); } if Scond == true then { trend = -1; col = rgb(217, 0, 197); colT = rgb(217, 0, 197); } plot1(Upper, "Upper", col); plot2(Lower, "Lower", col); plot3(mid, "Base Line", col); 즐거운 하루 되세요