예스스탁
예스스탁 답변
2025-06-27 10:11:57
안녕하세요
예스스탁입니다.
차트 하단 표시는 가능하지 않습니다.
input : length(20);
var : wma0(0),wma1(0),a(0),a1(0),diff(0);
var : x(0),len(0),xMax(0),xMin(0),Range_(0),y(0),g(0);
// Hma
wma0 = wma(close, length);
wma1 = wma(close, length);
a = 3 * wma0 - 2 * wma1;
// Sma
a1 = ma(close, length);
// Extract the difference (HMA - SMA)
diff = a - a1;
// Normalize
x = diff;
len = 100;
xMax = highest(x, len);
xMin = lowest(x, len);
range_ = xMax - xMin;
y = x / range_;
// Convertation searies float to searies int with round()
plot1(a, "HEMA");
plot2(a1, "SMA");
즐거운 하루되세요
> 다올 님이 쓴 글입니다.
> 제목 : 적용가능하도록 부탁드립니다.
> indicator("Trend Strength Gauge", 'HSMA',overlay = true)
// Inputs
length = input(20, "HSMA Length")
color_up = input.color(color.teal, "Color Up", group = "Theme")
color_dn = input.color(color.white, "Color Down", group = "Theme")
// Hma
wma = ta.wma(close, length)
wma1 = ta.wma(close, length)
a = 3 * wma - 2 * wma1
// Sma
a1 = ta.sma(close, length)
// Extract the difference (HMA - SMA)
diff = a - a1
// Table Function
printTable(txt, col, row, color, txt1, col1, row1, color1) => var table t = table.new(position.bottom_center, 60, 3),
table.cell(t, col, row, txt, bgcolor = color),
table.cell(t, col1, row1, txt1, bgcolor = color1, text_color = color.white)
// Normalize
x = diff
len = 100
xMax = ta.highest(x, len)
xMin = ta.lowest(x, len)
range_ = xMax - xMin
y = x / range_
// Convertation searies float to searies int with round()
g = math.round(y*40)
// Plot
color1 = color.from_gradient(g, -2, 2, color_dn, color_up)
p1 = plot(a, 'HEMA', color1, 2)
p2 = plot(a1, 'SMA', color1, 2)
fill(p1, p2, color = color1)
// Convertation negative values to positive
g := g < 0 ? g *- 1 : g
// Plot trend strength gauge
if barstate.islast
for i = 1 to 40
color_ = math.round(y*40) < 0 ? color_dn : color_up
color = color.from_gradient(i, 1, 50, color.rgb(0, 137, 123, 100), color_)
printTable("", i, 1, color, "V", g, 1, color.rgb(255, 255, 255, 100))