예스스탁
예스스탁 답변
2025-06-02 13:00:46
안녕하세요
예스스탁입니다.
input : length(50);
input : factor(1.0);
input : col_up(lime);
input : col_dn(Red);
input : col_ul(Cyan);
var : direction(0),count_up(0),count_dn(0);
var : volatility(0),upper(0),lower(0),sig_up(False),sig_dn(False);
var : upper_band(0),lower_band(0);
var : hlc3(0),alpha(0),ATrv(0);
var :tx1(0),tx2(0);
var1 = ma(C,25);
var2 = ma(C,length);
hlc3 = (H+L+C)/3;
volatility = ma(high-low, 70) * factor;
upper = highest(var1 + volatility, int(length/2));
lower = lowest(var2 - volatility, int(length/2));
sig_up = CrossUp(hlc3, upper);
sig_dn = CrossDown(hlc3, lower);
if sig_up == true Then
direction = 1;
if sig_dn == true Then
direction = -1;
upper = iff(direction == 1 , Nan , upper);
lower = iff(direction == -1 , Nan , lower);
if direction == 1 Then
{
count_up = count_up+ 0.5;
count_dn = 0;
}
if direction == -1 Then
{
count_dn = count_dn+0.5;
count_up = 0;
}
count_up = iff(count_up > 70 , 70 , count_up);
count_dn = iff(count_dn > 70 , 70 , count_dn);
alpha = 1 / 100 ;
ATrV = IFf(IsNan(ATrV[1]) == true, ma(TrueRange,100) , alpha * TrueRange + (1 - alpha) * IFf(isnan(ATrV[1])==true,0,ATrV[1]));
upper_band = lower + ATRV*5;
lower_band = upper - ATRV*5;
if IsNaN(upper_band) == False Then
plot1(upper_band, "Upper Wave",iff(index % 2 == 0 , nan , col_ul));
Else
NoPlot(1);
if IsNaN(lower_band) == False Then
plot2(lower_band, "Lower Wave",iff(index % 2 == 0 , nan , col_ul));
Else
NoPlot(2);
if IsNaN(upper) == False Then
plot3(upper, "Upper Band",col_dn);
Else
NoPlot(3);
if IsNaN(lower) == False Then
plot4(lower, "Lower Band",col_up);
Else
NoPlot(4);
if direction != direction[1] and direction == 1 Then
{
tx1 = Text_New_Self(sDate,sTime,Lower,"●");
Text_SetStyle(tx1,2,2);
Text_SetColor(tx1,col_up);
tx2 = Text_New_Self(sDate,sTime,L,"▲");
Text_SetStyle(tx2,2,0);
Text_SetColor(tx2,col_up);
}
if direction != direction[1] and direction == -1 Then
{
tx1 = Text_New_Self(sDate,sTime,upper,"●");
Text_SetStyle(tx1,2,2);
Text_SetColor(tx1,col_dn);
tx2 = Text_New_Self(sDate,sTime,H,"▼");
Text_SetStyle(tx2,2,1);
Text_SetColor(tx2,col_dn);
}
즐거운 하루되세요
> 뽀스뽀스 님이 쓴 글입니다.
> 제목 : 지표로 변환 부탁드려요
>
선은 필요없구요
매수 매도 삼각형 표시 부탁드려요 건강하세요
// This work is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
// https://creativecommons.org/licenses/by-nc-sa/4.0/
// © BigBeluga
//@version=6
indicator("TrendWave Bands [BigBeluga]", overlay = true)
// INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
int length = input(33)
float factor = input.float(1.0, "Factor", step = 0.1)
// Color
color col_up = input(color.lime, "", inline = "col")
color col_dn = input(color.rgb(221, 26, 26), "", inline = "col")
color col_ul = input(color.aqua, "", inline = "col")
// }
// CALCULATIONS――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
trend(length)=>
var direction = 0
var count_up = 0.
var count_dn = 0.
float volatility = ta.sma(high-low, 70) * factor
float upper = ta.highest(ta.sma(close, 25) + volatility, int(length/2))
float lower = ta.lowest(ta.sma(close, length) - volatility, int(length/2))
bool sig_up = ta.crossover(hlc3, upper) and barstate.isconfirmed
bool sig_dn = ta.crossunder(hlc3, lower) and barstate.isconfirmed
switch
sig_up => direction := 1
sig_dn => direction := -1
upper := direction == 1 ? float(na) : upper
lower := direction == -1 ? float(na) : lower
// Trends Duration
if direction == 1
count_up += 0.5
count_dn := 0
if direction == -1
count_dn += 0.5
count_up := 0
count_up := count_up > 70 ? 70 : count_up
count_dn := count_dn > 70 ? 70 : count_dn
[upper, lower, direction, count_up, count_dn]
[upper, lower, direction, count_up, count_dn] = trend(length)
float upper_band = lower + ta.atr(100)*5
float lower_band = upper - ta.atr(100)*5
color upper_col = color.new(col_dn, int(count_dn))
color lower_col = color.new(col_up, int(count_up))
color upper_band_col = color.new(col_ul, 70 - int(count_up))
color lower_band_col = color.new(col_ul, 70 - int(count_dn))
// }
// PLOT ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
plot(upper_band, "Upper Wave", style = plot.style_linebr, color = bar_index % 2 == 0 ? na : upper_band_col, linewidth = 1)
plot(lower_band, "Lower Wave", style = plot.style_linebr, color = bar_index % 2 == 0 ? na : lower_band_col, linewidth = 1)
plot(upper, "Upper Band", style = plot.style_linebr, color = upper_col, linewidth = 2)
plot(lower, "Lower Band", style = plot.style_linebr, color = lower_col, linewidth = 2)
plot(upper, "Upper Band Shadow", style = plot.style_linebr, color = color.new(col_dn, int(count_dn*2)), linewidth = 6)
plot(lower, "Lower Band Shadow", style = plot.style_linebr, color = color.new(col_up, int(count_up*2)), linewidth = 6)
plotshape(direction != direction[1] and direction == 1 ? lower : na, "Trend Up", shape.circle, location.absolute, size = size.tiny, color = col_up)
plotshape(direction != direction[1] and direction == 1 ? lower : na, "Trend Up", shape.circle, location.absolute, size = size.small, color = color.new(col_up, 70))
plotshape(direction != direction[1] and direction == -1 ? upper : na, "Trend Down", shape.circle, location.absolute, size = size.tiny, color = col_dn)
plotshape(direction != direction[1] and direction == -1 ? upper : na, "Trend Down", shape.circle, location.absolute, size = size.small, color = color.new(col_dn, 70))
// Trend Duration (70 max)
// if barstate.islast
// if direction == 1
// label.delete(label.new(bar_index, lower, str.tostring(count_up), color = color(na), style = label.style_label_left, textcolor = chart.fg_color)[1])
// if direction == -1
// label.delete(label.new(bar_index, upper, str.tostring(count_dn), color = color(na), style = label.style_label_left, textcolor = chart.fg_color)[1])
// }
바쁘시더라도 꼭 살펴주시길 기원함미다
매수 매도 삼각형 표시 부탁드려요 선 필요없어요