답변완료
변환 부탁 합니다.
안녕하세요.트레이딩뷰 지표인데 죄송합니다.
//input ------
src = input(close, title="source")
len1 = input(3, title="short 1")
len2 = input(5, title="short 2")
len3 = input(7, title="short 3")
len4 = input(9, title="short 4")
len5 = input(10, title="short 5")
len6 = input(12, title="short 6")
len7 = input(17, title="long 1")
len8 = input(20, title="long 2")
len9 = input(23, title="long 3")
len10 = input(26, title="long 4")
len11 = input(29, title="long 5")
len12 = input(32, title="long 6")
trend_color = input(false, title="trend color")
//ema -----
s1 = ema(src, len1)
s2 = ema(src, len2)
s3 = ema(src, len3)
s4 = ema(src, len4)
s5 = ema(src, len5)
s6 = ema(src, len6)
l1 = ema(src, len7)
l2 = ema(src, len8)
l3 = ema(src, len9)
l4 = ema(src, len10)
l5 = ema(src, len11)
l6 = ema(src, len12)
//trend
trend_up_s = s1 > s2 and s2 > s3 and s3 > s4 and s4 > s5 and s5 > s6
trend_up_l = l1 > l2 and l2 > l3 and l3 > l4 and l4 > l5 and l5 > l6
trend_down_s = s1 < s2 and s2 < s3 and s3 < s4 and s4 < s5 and s5 < s6
trend_down_l = l1 < l2 and l2 < l3 and l3 < l4 and l4 < l5 and l5 < l6
color_s = trend_color and trend_up_s ? #32cd32 : trend_color and trend_down_s ? red : trend_color ? gray : #32cd32
color_l = trend_color and trend_up_l ? #32cd32 : trend_color and trend_down_l ? red : trend_color ? gray : red
//plot -----
p_l1 = plot(l1, color=color_l, title="long 1", linewidth=2)
p_l2 = plot(l2, color=color_l, title="long 2")
p_l3 = plot(l3, color=color_l, title="long 3")
p_l4 = plot(l4, color=color_l, title="long 4")
p_l5 = plot(l5, color=color_l, title="long 5")
p_l6 = plot(l6, color=color_l, title="long 6", linewidth=2)
p_s1 = plot(s1, color=color_s, title="short 1", linewidth=2)
p_s2 = plot(s2, color=color_s, title="short 2")
p_s3 = plot(s3, color=color_s, title="short 3")
p_s4 = plot(s4, color=color_s, title="short 4")
p_s5 = plot(s5, color=color_s, title="short 5")
p_s6 = plot(s6, color=color_s, title="short 6", linewidth=2)
//fill -----
fill(p_l1, p_l6, color_l, 80, "fill long 1-6")
fill(p_s1, p_s6, color_s, 80, "fill short 1-6")
감사합니다.
2025-04-21
247
글번호 190272
지표
답변완료
부틱드립니다
수고하십니다
아래수식을 예스로 부탁드립니다
//@version=6
indicator(title="Volume Weighted Moving Average", shorttitle="VWMA", overlay=true, timeframe="", timeframe_gaps=true)
len = input.int(20, "Length", minval=1)
src = input(close, "Source")
ma = ta.vwma(src, len)
offset = input.int(0, "Offset", minval = -500, maxval = 500)
plot(ma, title="VWMA", color=#2962FF, offset = offset)
2025-04-21
281
글번호 190271
지표
답변완료
수식좀 요청 드립니다.
ㅇ 매번 많은 도움에 고맙 습니다.
ㅇ아래 수식에서 VAR1 추세선 이러고 하셨는데....
<그림> 처럼 추세의 고점 과 저점을 나누어서 중심선을 연결 할수는 있나요?
input : i_lenHARSI(10),i_smoothing(3),i_lenRSI(3);
var : i_colUp(0),i_colDown(0),i_colWick(0),i_source(0);
var : _closeRSI(0),_openRSI(0),_highRSI_raw(0),_lowRSI_raw(0);
var : _highRSI(0),_lowRSI(0),_close(0),_open(0),_high(0),_low(0);
Var : cnt(0), DownAmt1(0), UpAmt1(0), UpSum1(0), DownSum1(0), UpAvg1(0), DownAvg1(0),RSIV1(0);
Var : DownAmt2(0), UpAmt2(0), UpSum2(0), DownSum2(0), UpAvg2(0), DownAvg2(0),RSIV2(0);
var : bodyColour(0),wickColour(0);
i_colUp = red;
i_colDown = teal;
i_colWick = gray;
i_source = (o+h+l+c)/4 ;
_closeRSI = rsi(i_lenHARSI)-50;
_openRSI = IFF(IsNaN(_closeRSI[1]) == False, _closeRSI[1], _closeRSI);
If CurrentBar == 1 AND i_lenHARSI > 0 Then Begin
UpSum1 = 0;
DownSum1 = 0;
For cnt = 0 To i_lenHARSI - 1 Begin
UpAmt1 = H[cnt] - H[cnt+1];
If UpAmt1 >= 0 Then
DownAmt1 = 0;
Else Begin
DownAmt1 = -UpAmt1;
UpAmt1 = 0;
End;
UpSum1 = UpSum1 + UpAmt1;
DownSum1 = DownSum1 + DownAmt1;
End;
UpAvg1 = UpSum1 / i_lenHARSI;
DownAvg1 = DownSum1 / i_lenHARSI;
End
Else
If CurrentBar > 1 AND i_lenHARSI > 0 Then Begin
UpAmt1 = H[0] - H[1];
If UpAmt1 >= 0 Then
DownAmt1 = 0;
Else Begin
DownAmt1 = -UpAmt1;
UpAmt1 = 0;
End;
UpAvg1 = (UpAvg1[1] * (i_lenHARSI - 1) + UpAmt1) / i_lenHARSI;
DownAvg1 = (DownAvg1[1] * (i_lenHARSI - 1) + DownAmt1) / i_lenHARSI;
End;
If UpAvg1 + DownAvg1 <> 0 Then
RSIV1 = 100 * UpAvg1 / (UpAvg1 + DownAvg1);
Else
RSIV1 = 0;
If CurrentBar == 1 AND i_lenHARSI > 0 Then Begin
UpSum2 = 0;
DownSum2 = 0;
For cnt = 0 To i_lenHARSI - 1 Begin
UpAmt2 = L[cnt] - L[cnt+1];
If UpAmt2 >= 0 Then
DownAmt2 = 0;
Else Begin
DownAmt2 = -UpAmt2;
UpAmt2 = 0;
End;
UpSum2 = UpSum2 + UpAmt2;
DownSum2 = DownSum2 + DownAmt2;
End;
UpAvg2 = UpSum2 / i_lenHARSI;
DownAvg2 = DownSum2 / i_lenHARSI;
End
Else
If CurrentBar > 2 AND i_lenHARSI > 0 Then Begin
UpAmt2 = L[0] - L[1];
If UpAmt2 >= 0 Then
DownAmt2 = 0;
Else Begin
DownAmt2 = -UpAmt2;
UpAmt2 = 0;
End;
UpAvg2 = (UpAvg2[1] * (i_lenHARSI - 1) + UpAmt2) / i_lenHARSI;
DownAvg2 = (DownAvg2[1] * (i_lenHARSI - 1) + DownAmt2) / i_lenHARSI;
End;
If UpAvg2 + DownAvg2 <> 0 Then
RSIV2 = 100 * UpAvg2 / (UpAvg2 + DownAvg2);
Else
RSIV2 = 0;
_highRSI_raw = RSIV1-50;
_lowRSI_raw = RSIV2-50;
_highRSI = max(_highRSI_raw, _lowRSI_raw);
_lowRSI = min(_highRSI_raw, _lowRSI_raw);
_close = (_openRSI + _highRSI + _lowRSI + _closeRSI) / 4;
_open = iff(isnan(_open[i_smoothing]) == true, (_openRSI + _closeRSI) / 2 , (_open[1] * i_smoothing + _close[1]) / (i_smoothing + 1));
_high = max(_highRSI, max(_open, _close));
_low = min(_lowRSI, min(_open, _close));
bodyColour = iff(_close > _open , i_colUp , i_colDown);
wickColour = i_colWick;
var1 = TL_New_Self(sDate,sTime,_open,sDate,sTime,_close);
//var2 = TL_New_Self(sDate,sTime,_high,sDate,sTime,max(_open,_close));
//var3 = TL_New_Self(sDate,sTime,_Low,sDate,sTime,min(_open,_close));
TL_SetColor(var1,bodyColour);
TL_SetColor(var2,i_colWick);
TL_SetColor(var2,i_colWick);
TL_SetSize(var1,3);
TL_SetSize(var2,1);
TL_SetSize(var3,1);
if LastBarOnChart == 1 Then
Plot1(0);
ㅇ 고맙습니다. 좋은 한주 되십시요.
1
2025-04-20
380
글번호 190263
지표