답변완료
지표변환 부탁드립니다~
안녕하세요~^^
많은 도움을 주셔서 항상 감사드립니다~
트레이딩뷰 수식인데 예스로 면환 가능하면 부탁드립니다.
buy sell은 삼각형 강조표시로 부탁드립니다
indicator("Purple Cloud [MMD]",overlay=true, timeframe="", timeframe_gaps=true)
atrPeriod = input(10, "Supertrend ATR Length")
factor = input.float(3.0, "Supertrend Factor", step = 0.01)
[supertrend, direction] = ta.supertrend(factor, atrPeriod)
x1 = input(23, "Period")
alpha = input.float(0.9, "Alpha", step = 0.1)
x2 = ta.atr(x1) * alpha
xh = close + x2
xl = close - x2
a1=ta.vwma(hl2*volume,math.ceil(x1/4))/ta.vwma(volume,math.ceil(x1/4))
a2=ta.vwma(hl2*volume,math.ceil(x1/2))/ta.vwma(volume,math.ceil(x1/2))
a3=2*a1-a2
a4=ta.vwma(a3,x1)
b1 = 0.0
b1 := na(b1[1]) ? ta.sma(close, x1) : (b1[1] * (x1 - 1) + close) / x1
buy = a4<=xl and close>b1
sell = a4>=xh and close<b1
xs = 0
xs := buy ? 1 : sell ? -1 : xs[1]
barcolor( color = xs==1 ? color.green :xs==-1? color.red:na)
plotshape(buy and xs != xs[1] , title = "BUY", text = 'B', style = shape.labelup, location = location.belowbar, color= color.green, textcolor = color.white, size = size.tiny)
plotshape(sell and xs != xs[1] , title = "SELL", text = 'S', style = shape.labeldown, location = location.abovebar, color= color.red, textcolor = color.white, size = size.tiny)
plotshape(buy and xs != xs[1] and direction < 0 , title = "Strong BUY", text = '🚀', style = shape.labelup, location = location.belowbar, color= color.green, textcolor = color.white, size = size.tiny)
plotshape(sell and xs != xs[1] and direction > 0 , title = "Strong SELL", text = '☄️', style = shape.labeldown, location = location.abovebar, color= color.red, textcolor = color.white, size = size.tiny)
ema200=input(false,"Ema 200")
ema50=input(false,"Ema 50")
ema20=input(false,"Ema 20")
plot(ta.ema(close,200),color=ema200?color.black:na,title="Ema 200",linewidth = 4)
plot(ta.ema(close,50),color=ema50?color.blue:na,title="EMA 50",linewidth = 3)
plot(ta.ema(close,20),color=ema20?color.orange:na,title="EMA 20",linewidth = 2)
alertcondition(buy and xs != xs[1], "PC Long", "PC Long")
alertcondition(sell and xs != xs[1], "PC Short", "PC Short")
2023-12-02
1146
글번호 174524
강조
답변완료
부탁 드립니다.
아랫 수식에서 Rsima지표를 구현하고자 합니다.
적용가능하도록 수정 부탁 드립니다.
indicator(title="Relative Strength Index", shorttitle="RSI", format=format.price, precision=2, timeframe="", timeframe_gaps=true)
ma(source, length, type) =>
switch type
"SMA" => ta.sma(source, length)
"Bollinger Bands" => ta.sma(source, length)
"EMA" => ta.ema(source, length)
"SMMA (RMA)" => ta.rma(source, length)
"WMA" => ta.wma(source, length)
"VWMA" => ta.vwma(source, length)
rsiLengthInput = input.int(14, minval=1, title="RSI Length", group="RSI Settings")
rsiSourceInput = input.source(close, "Source", group="RSI Settings")
maTypeInput = input.string("SMA", title="MA Type", options=["SMA", "Bollinger Bands", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="MA Settings")
maLengthInput = input.int(14, title="MA Length", group="MA Settings")
bbMultInput = input.float(2.0, minval=0.001, maxval=50, title="BB StdDev", group="MA Settings")
showDivergence = input.bool(false, title="Show Divergence", group="RSI Settings")
up = ta.rma(math.max(ta.change(rsiSourceInput), 0), rsiLengthInput)
down = ta.rma(-math.min(ta.change(rsiSourceInput), 0), rsiLengthInput)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
rsiMA = ma(rsi, maLengthInput, maTypeInput)
isBB = maTypeInput == "Bollinger Bands"
rsiPlot = plot(rsi, "RSI", color=#7E57C2)
plot(rsiMA, "RSI-based MA", color=color.yellow)
2023-12-01
1079
글번호 174517
지표
답변완료
부탁드립니다.
건강 조심하시고 적용 가능하도록 간절히 부탁 드립니다.
indicator("ALMA Smoothed Gaussian Moving Average", shorttitle = "ASGMA", overlay=true)
//ALMA Smoothing
src = input(close, title='Source', group = "ALMA Smoothing")
smooth = input.int(1, title='Smoothing', minval=1, group = "ALMA Smoothing")
length1 = input.int(25, title='Lookback', minval=1, group = "ALMA Smoothing")
offset = 0.85
sigma1 = 7
pchange = ta.change(src, smooth) / src * 100
avpchange = ta.alma(pchange, length1, offset, sigma1)
//RSI
rsi = ta.rsi(close, 14)
rsiL = rsi > rsi[1]
rsiS = rsi < rsi[1]
//Chande Momentum
length11 = 9
src1 = close
momm = ta.change(src1)
f1(m) => m >= 0.0 ? m : 0.0
f2(m) => m >= 0.0 ? 0.0 : -m
m1 = f1(momm)
m2 = f2(momm)
sm1 = math.sum(m1, length11)
sm2 = math.sum(m2, length11)
percent(nom, div) => 100 * nom / div
chandeMO = percent(sm1-sm2, sm1+sm2)
cL = chandeMO > chandeMO[1]
cS = chandeMO < chandeMO[1]
//GAMA credit to author: © LeafAlgo https://www.tradingview.com/v/th7NZUPM/
length = input.int(14, minval=1, title="Length", group = "Gaussian Adaptive Moving Average")
adaptive = input.bool(true, title="Adaptive Parameters", group = "Gaussian Adaptive Moving Average")
volatilityPeriod = input.int(20, minval=1, title="Volatility Period", group = "Gaussian Adaptive Moving Average")
// Calculate Gaussian Moving Average
gma = 0.0
sumOfWeights = 0.0
sigma = adaptive ? ta.stdev(close, volatilityPeriod) : input.float(1.0, minval=0.1, title="Standard Deviation", group = "Gaussian Adaptive Moving Average")
for i = 0 to length - 1
weight = math.exp(-math.pow(((i - (length - 1)) / (2 * sigma)), 2) / 2)
value = ta.highest(avpchange, i + 1) + ta.lowest(avpchange, i + 1)
gma := gma + (value * weight)
sumOfWeights := sumOfWeights + weight
gma := (gma / sumOfWeights) / 2
gma:= ta.ema(gma, 7)
gmaColor = avpchange >= gma ? color.rgb(0, 161, 5) : color.rgb(215, 0, 0)
// Color bars based on signals until the next signal occurs
var int currentSignal = 0
currentSignal := avpchange >= gma ? 1 : -1//le_final ? -1 : currentSignal
var color barColor = na
if currentSignal == 1
barColor := color.rgb(0, 186, 6)
else if currentSignal == -1
barColor := color.rgb(176, 0, 0)
barcolor(barColor)
plotcandle(open, high, low, close, "Bar Color", barColor, barColor, bordercolor = barColor)
//Plotting
ema = ta.ema(close, 7)
plot(ema, color=gmaColor, linewidth=3, title="Gaussian Moving Average")
plotshape(ta.crossover(avpchange,gma) and barstate.isconfirmed, "Buy Signal", text = "B", textcolor = color.white, style = shape.labelup, location = location.belowbar, color = color.rgb(0, 161, 5), offset = -1)
plotshape(ta.crossunder(avpchange,gma) and barstate.isconfirmed, "Sell Signal", text = "S", textcolor = color.white, style = shape.labeldown, location = location.abovebar, color = color.rgb(215, 0, 0), offset = -1)
bgcolor(ta.crossover(avpchange,gma) and barstate.isconfirmed and rsiL and cL ? color.rgb(0, 162, 5, 85): na, offset = -1)
bgcolor(ta.crossunder(avpchange,gma) and barstate.isconfirmed and rsiS and cS ? color.rgb(207, 0, 0, 85): na, offset = -1)
barcolor(gmaColor)
alertcondition(ta.crossover(avpchange,gma) and barstate.isconfirmed, title="Buy Signal", message="Go Long! {{exchange}}:{{ticker}}")
alertcondition(ta.crossunder(avpchange,gma) and barstate.isconfirmed, title="Sell Signal", message="Go Short! {{exchange}}:{{ticker}}")
2023-12-01
1180
글번호 174512
지표