예스스탁
예스스탁 답변
2024-10-28 11:19:20
안녕하세요
예스스탁입니다.
해당 수식에 채우기(fill)은 처리할 수 없습니다.
input : stp(0.15);
input : multi(2);
var : trend(False),multi1(0),multi2(0),n(3),band(0);
var : distance(0),distance1(0),Sband(0),color(0);
var : band_upper(0),band_lower(0),band1(0);
distance = ma(abs(high-low), 100) * multi;
distance1 = ma(abs(high-low), 100) * 0.2;
if Index == 101 Then
{
trend = true;
band = low * 0.8;
}
if close < band Then
trend = false;
if close > band Then
trend = true;
if trend[1] == false and trend != trend[1] Then
band = low - distance;
if trend[1] == true and trend != trend[1] Then
band = high + distance;
if index % n == 0 and trend Then
{
multi1 = 0;
multi2 = multi2+stp;
band = band + (distance1 * multi2);
}
if index % n == 0 and trend == False Then
{
multi1 = multi1+stp;
multi2 = 0;
band = band - (distance1 * multi1);
}
Sband = ma(band, n);
color = iff(trend , blue,red);
band_upper = ma(band + distance*0.5, n);
band_lower = ma(band - distance*0.5, n);
band1 = iff(trend , band_upper , band_lower);
plot1(band1,"band1",color);
if trend == trend[1] Then
plot2(Sband,"sband",color);
Else
NoPlot(2);
즐거운 하루되세요
> 동해바다01 님이 쓴 글입니다.
> 제목 : 문의 드립니다.
> 안녕하세요
아래 지표 수식도 예스로 변경이 변경이 가능한지 궁금합니다.
감사합니다.
indicator("Radius Trend [ChartPrime]", overlay = true)
// --------------------------------------------------------------------------------------------------------------------}
// 𝙐𝙎𝙀𝙍 𝙄𝙉𝙋𝙐𝙏𝙎
// --------------------------------------------------------------------------------------------------------------------{
// @variable Step size for radius adjustment
float step = input.float(0.15, "Radius Step", step = 0.001)
// @variable Multiplier for initial distance calculation
float multi = input.float(2, "Start Points Distance", step = 0.1)
// Initialize variables
bool trend = na
var float multi1 = 0.
var float multi2 = 0.
int n = 3
var float band = 0.
// --------------------------------------------------------------------------------------------------------------------}
// 𝙄𝙉𝘿𝙄𝘾𝘼𝙏𝙊𝙍 𝘾𝘼𝙇𝘾𝙐𝙇𝘼𝙏𝙄𝙊𝙉𝙎
// --------------------------------------------------------------------------------------------------------------------{
// Calculate distances for band placement
float distance = ta.sma(math.abs(high-low), 100) * multi
float distance1 = ta.sma(math.abs(high-low), 100) * 0.2
// Initialize trend and band on the 101st bar
if bar_index == 101
trend := true
band := low * 0.8
// trend based on price relation to band
if close < band
trend := false
if close > band
trend := true
// Adjust band on trend changes
if trend[1] == false and ta.change(trend)
band := low - distance
if trend[1] == true and ta.change(trend)
band := high + distance
// Apply step angle to trend lines
if bar_index % n == 0 and trend
multi1 := 0
multi2 += step
band += distance1 * multi2
if bar_index % n == 0 and not trend
multi1 += step
multi2 := 0
band -= distance1 * multi1
// Smooth the band
Sband = ta.sma(band, n)
// Set color based on trend
color = trend ? #54b6d4 : #cf2b2b
// Calculate upper and lower bands
band_upper = ta.sma(band + distance*0.5, n)
band_lower = ta.sma(band - distance*0.5, n)
band1 = trend ? band_upper : band_lower
// --------------------------------------------------------------------------------------------------------------------}
// 𝙑𝙄𝙎𝙐𝘼𝙇𝙄𝙕𝘼𝙏𝙄𝙊𝙉
// --------------------------------------------------------------------------------------------------------------------{
// Plot the outer band
plot(band1, color = bar_index % 2 == 0 ? color.new(chart.fg_color, 50) : na)
// Plot the main band and fill area
p1 = plot(ta.change(trend) ? na : Sband, style = plot.style_linebr, color = color.gray)
p2 = plot(ta.sma(hl2, 20), display = display.none)
fill(p1, p2, band, ta.sma(hl2, 20), color.new(color, 60), na)
// --------------------------------------------------------------------------------------------------------------------}