예스스탁
예스스탁 답변
2025-04-14 14:42:42
안녕하세요
예스스탁입니다.
채우기는 수식안에서 지정이 되지 않습니다.
지표속성창의 차트표시탭에서 직접 설정하셔야 합니다.
input : length(33);
input : smoothFactor(5);
var : volAdjPrice(0),priceChange(0),priceDelta(0),oscillator(0);
var : basis(0),dev1(0),dev2(0),bbHigh(0),bbLow(0),bbHighExp(0),bbLowExp(0);
var : mean(0),middleHighMean(0),middleMeanLow(0);
volAdjPrice = ema(trueRange, length);
priceChange = close - close[length];
priceDelta = close - volAdjPrice;
oscillator = ema(avg(priceDelta, priceChange), smoothFactor);
basis = ma(oscillator, length * 5);
dev1 = 1 * std(oscillator, length * 5);
dev2 = 2 * std(oscillator, length * 5);
bbHigh = basis + dev1;
bbLow = basis - dev1;
bbHighExp = basis + dev2;
bbLowExp = basis - dev2;
mean = avg(bbHighExp, bbLowExp);
// ~~ Middle Lines
middleHighMean = (bbHigh + mean) / 2;
middleMeanLow = (mean + bbLow) / 2;
plot1(oscillator, "Dynamic Price Oscillator");
plot2(mean, "Dynamic Mean");
plot3(bbHigh, "Bollinger High");
plot4(bbHighExp, "Expanded Bollinger High");
plot5(bbLow, "Bollinger Low");
plot6(bbLowExp, "Expanded Bollinger Low");
plot7(middleHighMean, "Middle High-Mean");
plot8(middleMeanLow, "Middle Mean-Low");
즐거운 하루되세요
> 신대륙발견 님이 쓴 글입니다.
> 제목 : 지표 문의 드립니다.
> // ~~ Tooltips
t1 = "Defines the lookback period for the oscillator and Bollinger Bands calculation. Increasing this value will consider a longer history, potentially smoothing out the oscillator and making the Bollinger Bands wider, leading to fewer signals. Decreasing this value will make the oscillator more sensitive to recent price changes, and the Bollinger Bands will become narrower, possibly increasing the number of signals."
t2 = "Determines how much the oscillator's calculation is smoothed. A higher smoothing factor reduces noise and makes the oscillator's line smoother, which may help in identifying the dominant trend more clearly but can delay signal generation. A lower smoothing factor makes the oscillator more responsive to recent price movements, which can be beneficial for short-term trading strategies but may increase the risk of false signals."
// ~~ Inputs
length = input.int(33, "Length", minval=1, group="Dynamic Price Oscillator", tooltip=t1)
smoothFactor = input.int(5, "Smoothing Factor", minval=1, group="Dynamic Price Oscillator", tooltip=t2)
// ~~ Function to calculate True Range
trueRange(high, low, close) =>
tr1 = high - low
tr2 = math.abs(high - close[1])
tr3 = math.abs(low - close[1])
math.max(tr1, tr2, tr3)
// ~~ Function to calculate Bollinger Bands
bollingerBands(src, length, mult) =>
basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)
upper = basis + dev
lower = basis - dev
[upper, lower]
// ~~ Adjusted Price based on True Range
volAdjPrice = ta.ema(trueRange(high, low, close), length)
// ~~ Price calculation
priceChange = close - close[length]
priceDelta = close - volAdjPrice
oscillator = ta.ema(math.avg(priceDelta, priceChange), smoothFactor)
// ~~ Bollinger Bands on Oscillator
[bbHigh, bbLow] = bollingerBands(oscillator, length * 5, 1)
[bbHighExp, bbLowExp] = bollingerBands(oscillator, length * 5, 2)
mean = math.avg(bbHighExp, bbLowExp)
// ~~ Middle Lines
middleHighMean = (bbHigh + mean) / 2
middleMeanLow = (mean + bbLow) / 2
// ~~ Plot
p1 = plot(oscillator, "Dynamic Price Oscillator", color=color.rgb(227, 161, 54))
plot(mean, "Dynamic Mean", color=color.new(#f7cb85, 0))
p2 = plot(bbHigh, "Bollinger High", color=color.new(#089981, 60))
p3 = plot(bbHighExp, "Expanded Bollinger High", color=color.new(#089981, 0))
p4 = plot(bbLow, "Bollinger Low", color=color.new(#f23645, 60))
p5 = plot(bbLowExp, "Expanded Bollinger Low", color=color.new(#f23645, 0))
plot(middleHighMean, "Middle High-Mean", color=color.new(#0099cc, 40))
plot(middleMeanLow, "Middle Mean-Low", color=color.new(#cc9900, 40))
fill(p1, p2, oscillator > bbHigh ? color.new(#089981, 80) : na, "Oscillator Above Bollinger High")
fill(p1, p3, oscillator > bbHighExp ? color.new(#089981, 80) : na, "Oscillator Above Expanded Bollinger High")
fill(p1, p4, oscillator < bbLow ? color.new(#f23645, 80) : na, "Oscillator Below Bollinger Low")
fill(p1, p5, oscillator < bbLowExp ? color.new(#f23645, 80) : na, "Oscillator Below Expanded Bollinger Low")
트레이딩뷰 지표인데 예스로 좀 바꿔주세요.