예스스탁
예스스탁 답변
2025-05-07 15:16:17
안녕하세요
예스스탁입니다.
1
input : len(20);
input : src(close);
input : offset(0);
var : mav(0);
mav = ma(src * volume, len) / ma(volume, len);
plot1(mav, "VWMA");
FixPlotShift(1,offset);
2
input : src(close),len1(12),len2(26);
var : len(0),mav(0);
len = len2-len1;
mav = ma(src*Volume,len)/ma(Volume,len);
plot1(mav, "VWMA");
3
input : Periods(10);
input : Multiplier(3.0);
input : changeATR(true);
input : showsignals(true);
input : highlighting(true);
var : src(0),alpha(0),atr1(0),atr2(0),atrv(0);
var : up(0),up1(0),dn(0),dn1(0);
var : trend(0),tx(0);
src = (h+l)/2;
alpha = 1/Periods;
atr1 = iff(IsNan(atr1[1]) == true,ma(TrueRange, Periods), alpha * TrueRange + (1 - alpha) * iff(IsNan(atr1[1])==true,0,atr1[1]));
atr2 = ma(TrueRange, Periods);
atrv = iff(changeATR ==true,atr1, atr2);
up = src-(Multiplier*atrv);
up1 = iff(isnan(up[1])==true,up,up[1]);
up = iff(close[1] > up1 , max(up,up1), up);
dn = src+(Multiplier*atrv);
dn1 = iff(isnan(dn[1])==true,dn,dn[1]);
dn = iff(close[1] < dn1 , min(dn, dn1) , dn);
trend = 1;
trend = iff(isnan(trend[1])==true,trend,trend[1]);
trend = iff(trend == -1 and close > dn1 , 1 , iff(trend == 1 and close < up1 , -1 , trend));
if trend == 1 Then
plot1(up,"Trend",Yellow);
Else
plot1(dn,"Trend",Yellow);
if trend == 1 and trend[1] == -1 Then
{
tx = Text_New(sDate,sTime,up,"●");
Text_SetColor(tx,Green);
Text_SetStyle(tx,2,2);
}
if trend == -1 and trend[1] == 1 Then
{
tx = Text_New(sDate,sTime,dn,"●");
Text_SetColor(tx,Red);
Text_SetStyle(tx,2,2);
}
즐거운 하루되세요
> 해암 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 아래의 트레이딩뷰 수식을 변환 부탁드립니다.
1
====================
/@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)
2
=======================
//@version=3
study(title="VWMACD", shorttitle="VWMACD", overlay=true)
src = close, len1 = input(12, minval=1), len2 = input(26, minval=1)
len = len2-len1
ma = vwma(src, len)
plot(ma, title="VWMA", color=blue)
3
===================
Periods = input(title="ATR Period", type=input.integer, defval=10)
src = input(hl2, title="Source")
Multiplier = input(title="ATR Multiplier", type=input.float, step=0.1, defval=3.0)
changeATR= input(title="Change ATR Calculation Method ?", type=input.bool, defval=true)
showsignals = input(title="Show Buy/Sell Signals ?", type=input.bool, defval=true)
highlighting = input(title="Highlighter On/Off ?", type=input.bool, defval=true)
atr2 = sma(tr, Periods)
atr= changeATR ? atr(Periods) : atr2
up=src-(Multiplier*atr)
up1 = nz(up[1],up)
up := close[1] > up1 ? max(up,up1) : up
dn=src+(Multiplier*atr)
dn1 = nz(dn[1], dn)
dn := close[1] < dn1 ? min(dn, dn1) : dn
trend = 1
trend := nz(trend[1], trend)
trend := trend == -1 and close > dn1 ? 1 : trend == 1 and close < up1 ? -1 : trend
upPlot = plot(trend == 1 ? up : na, title="Up Trend", style=plot.style_linebr, linewidth=2, color=color.green)
buySignal = trend == 1 and trend[1] == -1
plotshape(buySignal ? up : na, title="UpTrend Begins", location=location.absolute, style=shape.circle, size=size.tiny, color=color.green, transp=0)
plotshape(buySignal and showsignals ? up : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white, transp=0)
dnPlot = plot(trend == 1 ? na : dn, title="Down Trend", style=plot.style_linebr, linewidth=2, color=color.red)
sellSignal = trend == -1 and trend[1] == 1
plotshape(sellSignal ? dn : na, title="DownTrend Begins", location=location.absolute, style=shape.circle, size=size.tiny, color=color.red, transp=0)
plotshape(sellSignal and showsignals ? dn : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white, transp=0)
mPlot = plot(ohlc4, title="", style=plot.style_circles, linewidth=0)
매번 감사드립니다. 수고하세요!!!