예스스탁
예스스탁 답변
2025-06-11 16:55:03
안녕하세요
예스스탁입니다.
input : cumulativePeriod(5);
var : typicalPrice(0),typicalPriceVolume(0),cumulativeTypicalPriceVolume(0);
var : cumulativeVolume(0),vwapValue(0);
typicalPrice = (high + low + close) / 3;
typicalPriceVolume = typicalPrice * volume;
cumulativeTypicalPriceVolume = AccumN(typicalPriceVolume, cumulativePeriod);
cumulativeVolume = AccumN(volume, cumulativePeriod);
vwapValue = cumulativeTypicalPriceVolume / cumulativeVolume;
//VWMA
input : shortlen(10);
input : longlen(5);
var : short(0),long(0),osc(0);
short = ema(volume, shortlen);
long = ema(volume, longlen);
osc = 100 * (short - long) / long;
//ATR-Stop
input : p(100);
input : n(11);
var : mx(0),mn(0),stop(0),hi(0);
var : c1(0),atrcolor(0);
var : alpha(0),ATRV(0);
alpha = 1 / p ;
ATrV = IFf(IsNan(ATrV[1]) == true, ma(TrueRange,p) , alpha * TrueRange + (1 - alpha) * IFf(isnan(ATrV[1])==true,0,ATrV[1]));
mx=close[1]+atrv[1]*n;
mn=close[1]-atrv[1]*n;
stop=mn;
hi = 1;
hi = iff(hi[1] == 1, iff(high[1]>=stop[1] , 0 , 1) ,IFf(low[1]<=stop[1],1,0));
stop = iff(hi == 1, mx, mn);
stop = iff(hi == 1, IFf(hi[1]==0 , stop ,IFf(stop>stop[1],stop[1], stop)), IFf(hi[1] == 1, stop, IFf(stop<stop[1] , stop[1],stop)));
c1 =(stop+osc+vwapValue)/2;
atrcolor=IFf(c1>close,red,green);
plot1(c1, "Adapted-ATR",atrcolor);
즐거운 하루되세요
> 해암 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 아래의 수식을 변환부탁드립니다.
=======================
study(title="VWAP-VWMA-ATR", shorttitle="Adapted-ATR", overlay=true)
//VWAP
cumulativePeriod = input(5, "Period")
typicalPrice = (high + low + close) / 3
typicalPriceVolume = typicalPrice * volume
cumulativeTypicalPriceVolume = sum(typicalPriceVolume, cumulativePeriod)
cumulativeVolume = sum(volume, cumulativePeriod)
vwapValue = cumulativeTypicalPriceVolume / cumulativeVolume
//VWMA
shortlen = input(10, minval=1)
longlen = input(5, minval=1)
short = ema(volume, shortlen)
long = ema(volume, longlen)
osc = 100 * (short - long) / long
//ATR-Stop
p=input(100,"Period")
m=input(11,"Multiplier")
max=close[1]+atr(p)[1]*m
min=close[1]-atr(p)[1]*m
stop=min
hi=true
hi:=hi[1]?high[1]>=stop[1]?false:true:low[1]<=stop[1]?true:false
stop:=hi?max:min
stop:=hi?hi[1]==false?stop:stop>stop[1]?stop[1]:stop:hi[1]?stop:stop<stop[1]?stop[1]:stop
//VWAP-VWMA-ATR
c1 =(stop+osc+vwapValue)/2
//ATRCOLOR
atrcolor=(c1>close?color.red:color.green)
//Plot
plot(c1, title="Adapted-ATR", linewidth=2, color=atrcolor, transp=0)
//BarColor
barcolor(close>c1 ? color.green : color.red)
================
감사합니다. 수고하세요!!!