PHP Code:
//@version=5
// Copyright (c) 2019-present, Franklin Moormann (cheatcountry)
// Reverse Moving Average Convergence Divergence [CC] script may be freely distributed under the MIT license.
indicator('*', max_bars_back=500, overlay=true)
inp = input(title='Source', defval=close)
res = input.timeframe(title='Resolution', defval='')
rep = input(title='Allow Repainting?', defval=false)
bar = input(title='Allow Bar Color Change?', defval=false)
src1 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
fastLength = input.int(title='FastLength', defval=12, minval=1)
slowLength = input.int(title='SlowLength', defval=26, minval=1)
signalLength = input.int(title='SignalLength', defval=9, minval=1)
macdLevel = input.float(title='MacdLevel', defval=0, minval=0)
fastAlpha = 2.0 / (1 + fastLength)
slowAlpha = 2.0 / (1 + slowLength)
fastEma = ta.ema(src1, fastLength)
slowEma = ta.ema(src1, slowLength)
pMacdEq = fastAlpha - slowAlpha != 0 ? ((nz(fastEma[1]) * fastAlpha) - (nz(slowEma[1]) * slowAlpha)) / (fastAlpha - slowAlpha) : 0
pMacdEqSig = ta.ema(pMacdEq, signalLength)
pMacdLevel = fastAlpha - slowAlpha != 0 ? (macdLevel - (nz(fastEma[1]) * (1 - fastAlpha)) + (nz(slowEma[1]) * (1 - slowAlpha))) / (fastAlpha - slowAlpha) : 0
slo = src1 - pMacdEq
sig = slo > 0 ? slo > nz(slo[1]) ? 2 : 1 : slo < 0 ? slo < nz(slo[1]) ? -2 : -1 : 0
//alertcondition(ta.crossover(sig, 1), 'Strong Buy Signal', 'Strong Bullish Change Detected')
//alertcondition(ta.crossunder(sig, -1), 'Strong Sell Signal', 'Strong Bearish Change Detected')
//alertcondition(ta.crossover(sig, 0), 'Buy Signal', 'Bullish Change Detected')
//alertcondition(ta.crossunder(sig, 0), 'Sell Signal', 'Bearish Change Detected')
rmacdColor = sig > 1 ? color.green : sig > 0 ? color.yellow : sig < -1 ? color.maroon : sig < 0 ? color.red : color.white
//barcolor(bar ? rmacdColor : na)
plot(pMacdEq, title='Macd', style=plot.style_cross, color=rmacdColor, linewidth=2)
//plot(pMacdEqSig, title='Sinyal', style=plot.style_stepline, color=color.orange, linewidth=1)
//plot(pMacdLevel, title='Mcd-0', color=color.blue, linewidth=2)
///////////////////////////////////////////////////////////////////
inp14 = input(title='Source', defval=close)
res14 = input.timeframe(title='Resolution', defval='')
rep14 = input(title='Allow Repainting?', defval=false)
//bar14 = input(title='Allow Bar Color Change?', defval=true)
src14 = request.security(syminfo.tickerid, res14, inp14[rep14 ? 0 : barstate.isrealtime ? 1 : 0])[rep14 ? 0 : barstate.isrealtime ? 0 : 1]
length14 = input.int(title='Length', defval=15, minval=1)
ma14 = ta.sma(src14, length14)
a14 = ta.linreg(src14, length14, 0)
m14 = a14 - nz(a14[1]) + ma14
ie2 = (m14 + a14) / 2
slo14 = src14 - ie2
sig14 = slo14 > 0 ? slo14 > nz(slo14[1]) ? 2 : 1 : slo14 < 0 ? slo14 < nz(slo14[1]) ? -2 : -1 : 0
//alertcondition(ta.crossover(sig14, 1), 'Strong Buy Signal', 'Strong Bullish Change Detected')
//alertcondition(ta.crossunder(sig14, -1), 'Strong Sell Signal', 'Strong Bearish Change Detected')
//alertcondition(ta.crossover(sig14, 0), 'Buy Signal', 'Bullish Change Detected')
//alertcondition(ta.crossunder(sig14, 0), 'Sell Signal', 'Bearish Change Detected')
ie2Color = sig14 > 1 ? color.green : sig14 > 0 ? color.lime : sig14 < -1 ? color.maroon : sig14 < 0 ? color.red : color.white
//barcolor(bar14 ? ie2Color : na)
//plot(ie2, title='IE2', color=ie2Color, linewidth=2)
///////////////////////////////////
inp33 = input(title='Source', defval=close)
res33 = input.timeframe(title='Resolution', defval='')
rep33 = input(title='Allow Repainting?', defval=false)
//bar33 = input(title='Allow Bar Color Change?', defval=true)
src33 = request.security(syminfo.tickerid, res33, inp33[rep33 ? 0 : barstate.isrealtime ? 1 : 0])[rep33 ? 0 : barstate.isrealtime ? 0 : 1]
acc33 = input.float(title='Accelerator', defval=1.0, minval=1.0, step=0.01)
minLength33 = input.int(title='MinLength', defval=5, minval=1)
maxLength33 = input.int(title='MaxLength', defval=50, minval=1)
smoothLength33 = input.int(title='SmoothLength', defval=4, minval=1)
mult33 = input.float(title='Multiple', defval=2.0, minval=.01)
// We are checking current volatility to see how high it is and adjust accordingly.
// If volatility is very high then we use the minLength and vice versa
// Reason behind this is to hug price closely during high volatility but lag for low volatility
mean33 = ta.sma(src33, maxLength33)
stdDev33 = ta.stdev(src33, maxLength33)
a33 = mean33 - 1.75 * stdDev33
b33 = mean33 - 0.25 * stdDev33
c33 = mean33 + 0.25 * stdDev33
d33 = mean33 + 1.75 * stdDev33
length33 = 0.0
length33 := src33 >= b33 and src33 <= c33 ? nz(length33[1], maxLength33) + 1 : src33 < a33 or src33 > d33 ? nz(length33[1], maxLength33) - 1 : nz(length33[1], maxLength33)
length33 := math.max(math.min(length33, maxLength33), minLength33)
len33 = math.round(length33)
// We are providing a dynamic weight depending on the current momentum
// When momentum is at an extreme for overbought/oversold then we give more weight to the current price
mf33 = na(volume) or volume == 0 ? 100.0 - 100.0 / (1.0 + src33 / len33) : ta.mfi(src33, len33)
mfScaled = mf33 * 2 - 100
p33 = acc33 + math.abs(mfScaled) / 25
sum33 = 0.0
weightSum33 = 0.0
for i = 0 to len33 - 1 by 1
weight33 = math.pow(len33 - i, p33)
sum33 += src33[i] * weight33
weightSum33 += weight33
weightSum33
uma = ta.wma(sum33 / weightSum33, smoothLength33)
stdev44 = ta.stdev(src33, len33)
upperBand33 = uma + stdev44 * mult33
lowerBand33 = uma - stdev44 * mult33
slo33 = src33 - uma
sig33 = src33 > upperBand33 and nz(src33[1]) <= nz(upperBand33[1]) or src33 > lowerBand33 and nz(src33[1]) <= nz(lowerBand33[1]) ? 1 : src33 < lowerBand33 and nz(src33[1]) >= nz(lowerBand33[1]) or src33 < upperBand33 and nz(src33[1]) >= nz(upperBand33[1]) ? -1 : slo33 > 0 ? slo33 > nz(slo33[1]) ? 2 : 1 : slo33 < 0 ? slo33 < nz(slo33[1]) ? -2 : -1 : 0
//alertcondition(ta.crossover(sig33, 1), 'Strong Buy Signal', 'Strong Bullish Change Detected')
//alertcondition(ta.crossunder(sig33, -1), 'Strong Sell Signal', 'Strong Bearish Change Detected')
//alertcondition(ta.crossover(sig33, 0), 'Buy Signal', 'Bullish Change Detected')
//alertcondition(ta.crossunder(sig33, 0), 'Sell Signal', 'Bearish Change Detected')
umaColor = sig33 > 1 ? color.green : sig33 > 0 ? color.lime : sig33 < -1 ? color.maroon : sig33 < 0 ? color.red : color.black
//barcolor(bar ? umaColor : na)
//plot(upperBand33, title='UpperBand', linewidth=2, color=umaColor)
//plot(uma, title='MiddleBand', linewidth=1, color=color.new(color.white, 0))
//plot(lowerBand33, title='LowerBand', linewidth=2, color=umaColor)
///////////////////////////////////
float inp2 = input(title = 'Source', defval = close)
string res2 = input.timeframe(title = 'Resolution', defval = '')
bool rep2 = input(title = 'Allow Repainting?', defval = false)
bool bar2 = input(title = 'Allow Bar Color Change?', defval = false)
float src2 = request.security(syminfo.tickerid, res, inp[rep2 ? 0 : barstate.isrealtime ? 1 : 0])[rep2 ? 0 : barstate.isrealtime ? 0 : 1]
int length2 = input.int(title = 'Length', defval = 40, minval = 2)
float mult2 = input.float(title = 'Mult', defval = 10.0, minval = 0.01)
float alpha = 2.0 / (length2 + 1)
float trL = ta.lowest(ta.tr, length2)
float trH = ta.highest(ta.tr, length2)
float trAdj = trH - trL != 0 ? (ta.tr - trL) / (trH - trL) : 0
float trAdjEma = 0.0
trAdjEma := nz(trAdjEma[1]) + (alpha * (1 + (trAdj * mult2)) * (src2 - nz(trAdjEma[1])))
float slo2 = src2 - trAdjEma
int sig2 = slo2 > 0 ? slo2 > nz(slo2[1]) ? 2 : 1 : slo2 < 0 ? slo2 < nz(slo2[1]) ? -2 : -1 : 0
//alertcondition(ta.crossover(sig2, 1), 'Strong Buy Signal', 'Strong Bullish Change Detected')
//alertcondition(ta.crossunder(sig2, -1), 'Strong Sell Signal', 'Strong Bearish Change Detected')
//alertcondition(ta.crossover(sig2, 0), 'Buy Signal', 'Bullish Change Detected')
//alertcondition(ta.crossunder(sig2, 0), 'Sell Signal', 'Bearish Change Detected')
color tradjemaColor = sig2 > 1 ? color.green : sig2 > 0 ? color.lime : sig2 < -1 ? color.maroon : sig2 < 0 ? color.red : color.black
//barcolor(bar ? tradjemaColor : na)
//plot(trAdjEma, title = 'TrAdjEma', color = tradjemaColor, linewidth = 1)
/////////////////////////////////////////////////////////////
f_security(_symbol, _res, _src, _repaint) =>
request.security(_symbol, _res, _src[_repaint ? 0 : barstate.isrealtime ? 1 : 0])[_repaint ? 0 : barstate.isrealtime ? 0 : 1]
res3 = input.timeframe(title='Resolution', defval='')
rep3 = input(title='Allow Repainting?', defval=false)
//bar3 = input(title='Allow Bar Color Change?', defval=false)
length3 = input.int(title='Length', defval=14, minval=1)
factor3 = input.int(title='Factor', defval=2, minval=1)
p = f_security(syminfo.tickerid, res, hl2, rep3)
h = f_security(syminfo.tickerid, res, high, rep3)
l = f_security(syminfo.tickerid, res, low, rep3)
t = f_security(syminfo.tickerid, res, ta.tr, rep3)
mpEma = ta.ema(p, length3)
trEma = ta.ema(t, length3)
stdDev = ta.stdev(trEma, length3)
ad = p > nz(p[1]) ? mpEma + trEma / 2 : p < nz(p[1]) ? mpEma - trEma / 2 : mpEma
adm = ta.ema(ad, length3)
trndDn = 0.0
trndDn := ta.crossunder(adm, mpEma) ? h[2] : p < nz(p[1]) ? p + stdDev * factor3 : nz(trndDn[1], h[2])
trndUp = 0.0
trndUp := ta.crossover(adm, mpEma) ? l[2] : p > nz(p[1]) ? p - stdDev * factor3 : nz(trndUp[1], l[2])
trndr = 0.0
trndr := adm < mpEma ? trndDn : adm > mpEma ? trndUp : nz(trndr[1], 0)
sig3 = p > trndr ? 1 : p < trndr ? -1 : 0
//alertcondition(ta.crossover(sig3, 0), 'Buy Signal', 'Bullish Change Detected')
//alertcondition(ta.crossunder(sig3, 0), 'Sell Signal', 'Bearish Change Detected')
trndrColor = sig3 > 0 ? color.green : sig3 < 0 ? color.red : color.black
//barcolor(bar3 ? trndrColor : na)
//plot(trndr, color=trndrColor, linewidth=2)
//plot(mpEma, color=color.new(color.blue, 0), linewidth=2)
//plot(adm, color=color.new(color.black, 0), linewidth=1)
//////////////////////////////////////////////////////////////////
inp4 = input(title='Source', defval=close)
res4 = input.timeframe(title='Resolution', defval='')
rep4 = input(title='Allow Repainting?', defval=false)
//bar4 = input(title='Allow Bar Color Change?', defval=false)
src4 = request.security(syminfo.tickerid, res4, inp4[rep4 ? 0 : barstate.isrealtime ? 1 : 0])[rep4 ? 0 : barstate.isrealtime ? 0 : 1]
length4 = input(title='Length', defval=5)
sum = 0.0
weightSum = 0.0
owma = 0.0
for i = 0 to length4 - 1 by 1
corr = ta.correlation(src4, owma, length4)
weight = math.pow(length4 - i, corr)
sum += src4[i] * weight
weightSum += weight
weightSum
owma := sum / weightSum
sig4 = src4 > owma ? 1 : src4 < owma ? -1 : 0
//alertcondition(ta.crossover(sig4, 0), 'Buy Signal', 'Bullish Change Detected')
//alertcondition(ta.crossunder(sig4, 0), 'Sell Signal', 'Bearish Change Detected')
owmaColor = sig4 > 0 ? color.green : sig4 < 0 ? color.red : color.black
//barcolor(bar ? owmaColor : na)
//plot(owma, title='OWMA', linewidth=1, color=owmaColor)
///////////////////////////////////////////////////////////////////////////
inp6 = input(title='Source', defval=close)
res6 = input.timeframe(title='Resolution', defval='')
rep6 = input(title='Allow Repainting?', defval=false)
//bar6 = input(title='Allow Bar Color Change?', defval=false)
length6 = input.int(title='Length', defval=5, minval=1)
momLength = input.int(title='MomentumLength', defval=5, minval=1)
src6 = request.security(syminfo.tickerid, res6, inp6[rep6 ? 0 : barstate.isrealtime ? 1 : 0])[rep6 ? 0 : barstate.isrealtime ? 0 : 1]
num = 0.0
coefSum = 0.0
for i = 0 to length6 - 1 by 1
coef = math.abs(nz(src6[i]) - nz(src6[i + momLength]))
num += coef * nz(src6[i])
coefSum += coef
coefSum
filt = coefSum != 0 ? num / coefSum : 0
sig6 = src6 > filt ? 1 : src6 < filt ? -1 : 0
//alertcondition(ta.crossover(sig6, 0), 'Buy Signal', 'Bullish Change Detected')
//alertcondition(ta.crossunder(sig6, 0), 'Sell Signal', 'Bearish Change Detected')
filtColor = sig6 > 0 ? color.green : sig6 < 0 ? color.red : color.black
//barcolor(bar ? filtColor : na)
//plot(filt, title='Filter', color=filtColor, linewidth=1)
//////////////////////////////////////////////////////////////////
inp7 = input(title='Source', defval=close)
res7 = input.timeframe(title='Resolution', defval='')
rep7 = input(title='Allow Repainting?', defval=false)
//bar7 = input(title='Allow Bar Color Change?', defval=false)
src7 = request.security(syminfo.tickerid, res7, inp7[rep7 ? 0 : barstate.isrealtime ? 1 : 0])[rep7 ? 0 : barstate.isrealtime ? 0 : 1]
pi = 2 * math.asin(1)
period = 0.0
smooth = (4 * src7 + 3 * nz(src7[1]) + 2 * nz(src7[2]) + nz(src7[3])) / 10
detrender = (0.0962 * smooth + 0.5769 * nz(smooth[2]) - 0.5769 * nz(smooth[4]) - 0.0962 * nz(smooth[6])) * (0.075 * nz(period[1]) + 0.54)
q1 = (0.0962 * detrender + 0.5769 * nz(detrender[2]) - 0.5769 * nz(detrender[4]) - 0.0962 * nz(detrender[6])) * (0.075 * nz(period[1]) + 0.54)
i1 = nz(detrender[3])
jI = (0.0962 * i1 + 0.5769 * nz(i1[2]) - 0.5769 * nz(i1[4]) - 0.0962 * nz(i1[6])) * (0.075 * nz(period[1]) + 0.54)
jQ = (0.0962 * q1 + 0.5769 * nz(q1[2]) - 0.5769 * nz(q1[4]) - 0.0962 * nz(q1[6])) * (0.075 * nz(period[1]) + 0.54)
i2 = i1 - jQ
i2 := 0.2 * i2 + 0.8 * nz(i2[1])
q2 = q1 + jI
q2 := 0.2 * q2 + 0.8 * nz(q2[1])
re = i2 * nz(i2[1]) + q2 * nz(q2[1])
re := 0.2 * re + 0.8 * nz(re[1])
im = i2 * nz(q2[1]) - q2 * nz(i2[1])
im := 0.2 * im + 0.8 * nz(im[1])
period := im != 0 and re != 0 ? 2 * pi / math.atan(im / re) : 0
period := math.min(math.max(period, 0.67 * nz(period[1])), 1.5 * nz(period[1]))
period := math.min(math.max(period, 6), 50)
period := 0.2 * period + 0.8 * nz(period[1])
smoothPeriod = 0.0
smoothPeriod := 0.33 * period + 0.67 * nz(smoothPeriod[1])
dcPeriod = math.ceil(smoothPeriod + 0.5)
iTrend = 0.0
for i = 0 to dcPeriod - 1 by 1
iTrend += nz(src7[i])
iTrend
iTrend := dcPeriod > 0 ? iTrend / dcPeriod : iTrend
trendline = (4 * iTrend + 3 * nz(iTrend[1]) + 2 * nz(iTrend[2]) + nz(iTrend[3])) / 10
sig7 = smooth > trendline ? 1 : smooth < trendline ? -1 : 0
//alertcondition(ta.crossover(sig7, 0), 'Buy Signal', 'Bullish Change Detected')
//alertcondition(ta.crossunder(sig7, 0), 'Sell Signal', 'Bearish Change Detected')
tlColor = sig7 > 0 ? color.green : sig7 < 0 ? color.red : color.black
//barcolor(bar ? tlColor : na)
//plot(trendline, title='Trend', color=tlColor, linewidth=1)
//////////////////////////////////////////////////////////////////////
inp8 = input(title='Source', defval=close)
res8 = input.timeframe(title='Resolution', defval='')
rep8 = input(title='Allow Repainting?', defval=false)
//bar8 = input(title='Allow Bar Color Change?', defval=false)
length8 = input.int(title='Length', defval=5, minval=1)
src8 = request.security(syminfo.tickerid, res8, inp8[rep8 ? 0 : barstate.isrealtime ? 1 : 0])[rep8 ? 0 : barstate.isrealtime ? 0 : 1]
num8 = 0.0
coefSum8 = 0.0
for i = 0 to length8 - 1 by 1
distance = 0.0
for lb = 1 to length8 - 1 by 1
distance += math.pow(nz(src8[i]) - nz(src8[i + lb]), 2)
distance
num8 += distance * nz(src8[i])
coefSum8 += distance
coefSum8
filt8 = coefSum8 != 0 ? num8 / coefSum8 : 0
sig8 = src8 > filt8 ? 1 : src8 < filt8 ? -1 : 0
//alertcondition(ta.crossover(sig8, 0), 'Buy Signal', 'Bullish Change Detected')
//alertcondition(ta.crossunder(sig8, 0), 'Sell Signal', 'Bearish Change Detected')
filtColor8 = sig8 > 0 ? color.green : sig8 < 0 ? color.red : color.black
//barcolor(bar ? filtColor : na)
//plot(filt8, title='Filter', color=filtColor8, linewidth=1)
///////////////////////////////////////////////////////////
inp9 = input(title='Source', defval=close)
res9 = input.timeframe(title='Resolution', defval='')
rep9 = input(title='Allow Repainting?', defval=false)
//bar9 = input(title='Allow Bar Color Change?', defval=false)
src9 = request.security(syminfo.tickerid, res9, inp9[rep9 ? 0 : barstate.isrealtime ? 1 : 0])[rep9 ? 0 : barstate.isrealtime ? 0 : 1]
length9 = input.int(title='Length', defval=20, minval=1)
pi9 = 2 * math.asin(1)
twoPiPrd = 2 * pi9 / length9
alpha9 = (math.cos(twoPiPrd) + math.sin(twoPiPrd) - 1) / math.cos(twoPiPrd)
dec9 = 0.0
dec9 := alpha9 / 2 * (src9 + nz(src9[1])) + (1 - alpha9) * nz(dec9[1])
sig9 = src9 > dec9 ? 1 : src9 < dec9 ? -1 : 0
//alertcondition(ta.crossover(sig9, 0), 'Buy Signal', 'Bullish Change Detected')
//alertcondition(ta.crossunder(sig9, 0), 'Sell Signal', 'Bearish Change Detected')
decColor = sig9 > 0 ? color.green : sig9 < 0 ? color.red : color.black
//barcolor(bar ? decColor : na)
//plot(dec9, title='DEC', color=decColor, linewidth=2)
/////////////////////////////////////////////////////////////////
inp11 = input(title='Source', defval=close)
res11 = input.timeframe(title='Resolution', defval='')
rep11 = input(title='Allow Repainting?', defval=false)
//bar11 = input(title='Allow Bar Color Change?', defval=false)
src11 = request.security(syminfo.tickerid, res11, inp11[rep11 ? 0 : barstate.isrealtime ? 1 : 0])[rep11 ? 0 : barstate.isrealtime ? 0 : 1]
length11 = input(title='Length', defval=14)
p11 = input.float(title='Power', minval=0, defval=1.0)
sum11 = 0.0
weightSum11 = 0.0
for i = 0 to length11 - 1 by 1
weight = math.pow(length11 - i, p11)
sum11 += src11[i] * weight
weightSum11 += weight
weightSum11
vpwma = sum11 / weightSum11
sig11 = src11 > vpwma ? 1 : src11 < vpwma ? -1 : 0
//alertcondition(ta.crossover(sig, 0), 'Buy Signal', 'Bullish Change Detected')
//alertcondition(ta.crossunder(sig, 0), 'Sell Signal', 'Bearish Change Detected')
vpwmaColor = sig11 > 0 ? color.green : sig11 < 0 ? color.red : color.black
//barcolor(bar ? vpwmaColor : na)
//plot(vpwma, title='VPWMA', linewidth=2, color=vpwmaColor)
//////////////////////////////////////
inp22 = input(title='Source', defval=close)
res22 = input.timeframe(title='Resolution', defval='')
rep22 = input(title='Allow Repainting?', defval=false)
//bar22 = input(title='Allow Bar Color Change?', defval=true)
src22 = request.security(syminfo.tickerid, res22, inp22[rep22 ? 0 : barstate.isrealtime ? 1 : 0])[rep22 ? 0 : barstate.isrealtime ? 0 : 1]
minLength22 = input.int(title='MinLength', defval=5, minval=1)
maxLength22 = input.int(title='MaxLength', defval=50, minval=1)
mean22 = ta.sma(src22, maxLength22)
stdDev22 = ta.stdev(src22, maxLength22)
a22 = mean22 - 1.75 * stdDev22
b22 = mean22 - 0.25 * stdDev22
c22 = mean22 + 0.25 * stdDev22
d22 = mean22 + 1.75 * stdDev22
length22 = 0.0
length22 := src22 >= b22 and src22 <= c22 ? nz(length22[1], maxLength22) + 1 : src22 < a22 or src22 > d22 ? nz(length22[1], maxLength22) - 1 : nz(length22[1], maxLength22)
length22 := math.max(math.min(length22, maxLength22), minLength22)
sc22 = 2 / (length22 + 1)
vlma22 = 0.0
vlma22 := src22 * sc22 + (1 - sc22) * nz(vlma22[1], src22)
sig22 = src22 > vlma22 ? 1 : src22 < vlma22 ? -1 : 0
//alertcondition(ta.crossover(sig22, 0), 'Buy Signal', 'Bullish Change Detected')
//alertcondition(ta.crossunder(sig22, 0), 'Sell Signal', 'Bearish Change Detected')
vlmaColor = sig22 > 0 ? color.green : sig22 < 0 ? color.red : color.black
//barcolor(bar22 ? vlmaColor : na)
///plot(vlma22, title='VLMA', linewidth=2, color=vlmaColor)
inp15 = input(title='Source', defval=close)
res15 = input.timeframe(title='Resolution', defval='')
rep15 = input(title='Allow Repainting?', defval=false)
//bar15 = input(title='Allow Bar Color Change?', defval=true)
src15 = request.security(syminfo.tickerid, res15, inp15[rep15 ? 0 : barstate.isrealtime ? 1 : 0])[rep15 ? 0 : barstate.isrealtime ? 0 : 1]
length15 = input(title='Length', defval=14)
sum15 = 0.0
weightSum15 = 0.0
for i = 0 to length15 - 1 by 1
weight15 = math.pow(length15 - i, 2)
sum15 += src15[i] * weight15
weightSum15 += weight15
weightSum15
swma15 = sum15 / weightSum15
sig15 = src15 > swma15 ? 1 : src15 < swma15 ? -1 : 0
//alertcondition(ta.crossover(sig15, 0), 'Buy Signal', 'Bullish Change Detected')
//alertcondition(ta.crossunder(sig15, 0), 'Sell Signal', 'Bearish Change Detected')
swmaColor = sig15 > 0 ? color.green : sig15 < 0 ? color.red : color.black
//barcolor(bar15 ? swmaColor : na)
//plot(swma15, title='SWMA', linewidth=2, color=swmaColor)
////////////////////////////
inp16 = input(title='Source', defval=close)
res16 = input.timeframe(title='Resolution', defval='')
rep16 = input(title='Allow Repainting?', defval=false)
//bar16 = input(title='Allow Bar Color Change?', defval=true)
src16 = request.security(syminfo.tickerid, res16, inp16[rep16 ? 0 : barstate.isrealtime ? 1 : 0])[rep16 ? 0 : barstate.isrealtime ? 0 : 1]
length16 = input(title='Length', defval=14)
sum16 = 0.0
weightSum16 = 0.0
for i = 0 to length16 - 1 by 1
weight16 = math.pow(length16 - i, 0.5)
sum16 += src16[i] * weight16
weightSum16 += weight16
weightSum16
srwma = sum16 / weightSum16
sig16 = src16 > srwma ? 1 : src16 < srwma ? -1 : 0
//alertcondition(ta.crossover(sig16, 0), 'Buy Signal', 'Bullish Change Detected')
//alertcondition(ta.crossunder(sig16, 0), 'Sell Signal', 'Bearish Change Detected')
srwmaColor = sig16 > 0 ? color.green : sig16 < 0 ? color.red : color.black
//barcolor(bar16 ? srwmaColor : na)
//plot(srwma, title='SRWMA', linewidth=2, color=srwmaColor)
Yer İmleri