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)
////////////////////Ana Kalıp/////////////////////////
inp = input(title='Source', defval=close)
res = input.timeframe(title='Resolution', defval='')
rep = input(title='Allow Repainting?', defval=false)
//////////////////////////////////////////////////////
src1 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
fastLength1 = input.int(title='FastLength', defval=12, minval=1)
slowLength1 = input.int(title='SlowLength', defval=26, minval=1)
signalLength1 = input.int(title='SignalLength', defval=9, minval=1)
macdLevel1 = input.float(title='MacdLevel', defval=0, minval=0)
fastAlpha1 = 2.0 / (1 + fastLength1)
slowAlpha1 = 2.0 / (1 + slowLength1)
fastEma1 = ta.ema(src1, fastLength1)
slowEma1 = ta.ema(src1, slowLength1)
pMacdEq1 = fastAlpha1 - slowAlpha1 != 0 ? ((nz(fastEma1[1]) * fastAlpha1) - (nz(slowEma1[1]) * slowAlpha1)) / (fastAlpha1 - slowAlpha1) : 0
pMacdEqSig1 = ta.ema(pMacdEq1, signalLength1)
pMacdLevel1 = fastAlpha1 - slowAlpha1 != 0 ? (macdLevel1 - (nz(fastEma1[1]) * (1 - fastAlpha1)) + (nz(slowEma1[1]) * (1 - slowAlpha1))) / (fastAlpha1 - slowAlpha1) : 0
slo1 = src1 - pMacdEq1
sig1 = slo1 > 0 ? slo1 > nz(slo1[1]) ? 2 : 1 : slo1 < 0 ? slo1 < nz(slo1[1]) ? -2 : -1 : 0
rmacdColor = sig1 > 1 ? color.green : sig1 > 0 ? color.lime : sig1 < -1 ? color.maroon : sig1 < 0 ? color.red : color.white
plot(pMacdEq1, title='MACD',style=plot.style_cross, color=rmacdColor, linewidth=2)
plot(pMacdEqSig1, title='MacdEqSignal', color=color.rgb(255, 255, 255, 100), linewidth=1)
//plot(pMacdLevel1, title='MacdLevel', color=color.blue, linewidth=2)
memo1=(pMacdEq1+pMacdEqSig1+pMacdLevel1)/3
plot(memo1, title='Avarage', color=color.rgb(241, 225, 8, 100), linewidth=2)
////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
src3 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length3 = input.int(title='Length', defval=12, minval=1)
rmsLength3 = input.int(title='RMSLength', defval=50, minval=1)
mom3 = src3 - nz(src3[length3])
hannLength3 = math.ceil(length3 / 1.4)
filt3 = 0.0
coef3 = 0.0
for i = 1 to hannLength3 by 1
cos3 = 1 - math.cos(2 * math.pi * i / (hannLength3 + 1))
filt3 += cos3 * nz(mom3[i - 1])
coef3 += cos3
coef3
hFilt3 = coef3 != 0 ? filt3 / coef3 : 0
filtMa3 = math.sum(math.pow(hFilt3, 2), rmsLength3) / rmsLength3
rms3 = filtMa3 > 0 ? math.sqrt(filtMa3) : 0
scaledFilt3 = rms3 != 0 ? hFilt3 / rms3 : 0
a13 = math.exp(-1.414 * math.pi * math.abs(scaledFilt3) / length3)
b13 = 2 * a13 * math.cos(1.414 * math.pi * math.abs(scaledFilt3) / length3)
c23 = b13
c33 = -a13 * a13
c13 = 1 - c23 - c33
dsss3 = 0.0
dsss3 := c13 * ((src3 + nz(src3[1])) / 2) + c23 * nz(dsss3[1]) + c33 * nz(dsss3[2])
slo3 = src3 - dsss3
sig3 = slo3 > 0 ? slo3 > nz(slo3[1]) ? 2 : 1 : slo3 < 0 ? slo3 < nz(slo3[1]) ? -2 : -1 : 0
dsssColor = sig3 > 1 ? color.green : sig3 > 0 ? color.lime : sig3 < -1 ? color.maroon : sig3 < 0 ? color.red : color.black
plot(dsss3, title='Filter', color=dsssColor, linewidth=2)
///////////////////////////////////////////////////////////
src4 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length4 = input.int(title='Length', defval=27, minval=1)
a14 = math.exp(-1.414 * math.pi / length4)
b14 = 2 * a14 * math.cos(1.414 * math.pi / length4)
c24 = b14
c34 = -a14 * a14
c14 = 1 - c24 - c34
ssf4 = 0.0
ssf4 := bar_index < 3 ? src4 : 0.5 * c14 * (src4 + nz(src4[1])) + c24 * nz(ssf4[1]) + c34 * nz(ssf4[2])
e14 = 0.0
e14 := bar_index < 3 ? 0 : c14 * (src4 - ssf4) + c24 * nz(e14[1]) + c34 * nz(e14[2])
aef4 = ssf4 + e14
slo4 = src4 - nz(aef4[1])
sig4 = slo4 > 0 ? slo4 > nz(slo4[1]) ? 2 : 1 : slo4 < 0 ? slo4 < nz(slo4[1]) ? -2 : -1 : 0
aefColor = sig4 > 1 ? color.green : sig4 > 0 ? color.lime : sig4 < -1 ? color.maroon : sig4 < 0 ? color.red : color.black
//plot(aef4, title='Filter', color=aefColor, linewidth=2)
//////////////////////////////////////////////////////////////
src5 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
acc5 = input.float(title='Accelerator', defval=1.0, minval=1.0, step=0.01)
minLength5 = input.int(title='MinLength', defval=5, minval=1)
maxLength5 = input.int(title='MaxLength', defval=50, minval=1)
smoothLength5 = input.int(title='SmoothLength', defval=4, minval=1)
mult5 = 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
mean5 = ta.sma(src5, maxLength5)
stdDev5 = ta.stdev(src5, maxLength5)
a5 = mean5 - 1.75 * stdDev5
b5 = mean5 - 0.25 * stdDev5
c5 = mean5 + 0.25 * stdDev5
d5 = mean5 + 1.75 * stdDev5
length5 = 0.0
length5 := src5 >= b5 and src5 <= c5 ? nz(length5[1], maxLength5) + 1 : src5 < a5 or src5 > d5 ? nz(length5[1], maxLength5) - 1 : nz(length5[1], maxLength5)
length5 := math.max(math.min(length5, maxLength5), minLength5)
len5 = math.round(length5)
// 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
mf5 = na(volume) or volume == 0 ? 100.0 - 100.0 / (1.0 + src5 / len5) : ta.mfi(src5, len5)
mfScaled5 = mf5 * 2 - 100
p5 = acc5 + math.abs(mfScaled5) / 25
sum5 = 0.0
weightSum5 = 0.0
for i = 0 to len5 - 1 by 1
weight5 = math.pow(len5 - i, p5)
sum5 += src5[i] * weight5
weightSum5 += weight5
weightSum5
uma5 = ta.wma(sum5 / weightSum5, smoothLength5)
stdev55 = ta.stdev(src5, len5)
upperBand5 = uma5 + stdev55 * mult5
lowerBand5 = uma5 - stdev55 * mult5
slo5 = src5 - uma5
sig5 = src5 > upperBand5 and nz(src5[1]) <= nz(upperBand5[1]) or src5 > lowerBand5 and nz(src5[1]) <= nz(lowerBand5[1]) ? 1 : src5 < lowerBand5 and nz(src5[1]) >= nz(lowerBand5[1]) or src5 < upperBand5 and nz(src5[1]) >= nz(upperBand5[1]) ? -1 : slo5 > 0 ? slo5 > nz(slo5[1]) ? 2 : 1 : slo5< 0 ? slo5 < nz(slo5[1]) ? -2 : -1 : 0
umaColor = sig5 > 1 ? color.green : sig5 > 0 ? color.lime : sig5 < -1 ? color.maroon : sig5 < 0 ? color.red : color.black
//plot(upperBand5, title='UpperBand', linewidth=2, color=umaColor)
//plot(uma5, title='MiddleBand', linewidth=1, color=color.new(color.white, 0))
//plot(lowerBand5, title='LowerBand', linewidth=2, color=umaColor)
/////////////////////////////////////////////////////////////////////////////////////
src6 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
acc6 = input.float(title='Accelerator', defval=1.0, minval=1.0, step=0.01)
minLength6 = input.int(title='MinLength', defval=5, minval=1)
maxLength6 = input.int(title='MaxLength', defval=50, minval=1)
smoothLength6 = input.int(title='SmoothLength', defval=4, minval=1)
// 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
mean6 = ta.sma(src6, maxLength6)
stdDev6 = ta.stdev(src6, maxLength6)
a6 = mean6 - 1.75 * stdDev6
b6 = mean6 - 0.25 * stdDev6
c6 = mean6 + 0.25 * stdDev6
d6 = mean6 + 1.75 * stdDev6
length6 = 0.0
length6 := src6 >= b6 and src6 <= c6 ? nz(length6[1], maxLength6) + 1 : src6 < a6 or src6 > d6 ? nz(length6[1], maxLength6) - 1 : nz(length6[1], maxLength6)
length6 := math.max(math.min(length6, maxLength6), minLength6)
len6 = math.round(length6)
// 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
mf6 = na(volume) or volume == 0 ? 100.0 - 100.0 / (1.0 + src6 / len6) : ta.mfi(src6, len6)
mfScaled6 = mf6 * 2 - 100
p6 = acc6 + math.abs(mfScaled6) / 25
sum6 = 0.0
weightSum6 = 0.0
for i = 0 to len6 - 1 by 1
weight6 = math.pow(len6 - i, p6)
sum6 += src6[i] * weight6
weightSum6 += weight6
weightSum6
uma6 = ta.wma(sum6 / weightSum6, smoothLength6)
slo6 = src6 - uma6
sig6 = slo6 > 0 ? slo6 > nz(slo6[1]) ? 2 : 1 : slo6 < 0 ? slo6 < nz(slo6[1]) ? -2 : -1 : 0
umaColor6 = sig6 > 1 ? color.green : sig6 > 0 ? color.lime : sig6 < -1 ? color.maroon : sig6 < 0 ? color.red : color.black
//plot(uma6, title='UMA', linewidth=2, color=umaColor6)
//////////////////////////////////////////////////////////
src7 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length7 = input.int(title='Length', defval=15, minval=1)
ma7 = ta.sma(src7, length7)
a7 = ta.linreg(src7, length7, 0)
m7 = a7 - nz(a7[1]) + ma7
ie27 = (m7 + a7) / 2
slo7 = src7 - ie27
sig7 = slo7 > 0 ? slo7 > nz(slo7[1]) ? 2 : 1 : slo7 < 0 ? slo7 < nz(slo7[1]) ? -2 : -1 : 0
ie2Color = sig7 > 1 ? color.green : sig7 > 0 ? color.lime : sig7 < -1 ? color.maroon : sig7 < 0 ? color.red : color.white
//plot(ie27, title='IE2', color=ie2Color, linewidth=2)
////////////////////////////////////////////////////////
src8 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length8 = input(title='Length', defval=14)
sum8 = 0.0
weightSum8 = 0.0
for i = 0 to length8 - 1 by 1
weight8 = math.pow(length8 - i, 3)
sum8 += src8[i] * weight8
weightSum8 += weight8
weightSum8
cwma8 = sum8 / weightSum8
sig8 = src8 > cwma8 ? 1 : src8 < cwma8 ? -1 : 0
cwmaColor = sig8 > 0 ? color.green : sig8 < 0 ? color.red : color.black
//plot(cwma8, title='CWMA', linewidth=2, color=cwmaColor)
////////////////////////////////////////////////////////////
src9 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length9 = input.int(title='Length', defval=15, minval=1)
pi9 = 2 * math.asin(1)
a9 = math.exp(-1.414 * pi9 / length9)
b9 = 2 * a9 * math.cos(1.414 * pi9 / length9)
c29 = b9
c39 = -a9 * a9
c19 = (1 - b9 + math.pow(a9, 2)) / 4
bf9 = 0.0
bf9 := bar_index < 3 ? src9 : c19 * (src9 + 2 * nz(src9[1]) + nz(src9[2])) + c29 * nz(bf9[1]) + c39 * nz(bf9[2])
sig9 = src9 > bf9 ? 1 : src9 < bf9 ? -1 : 0
bfColor9 = sig9 > 0 ? color.green : sig9 < 0 ? color.red : color.black
//plot(bf9, title='2PBF', color=bfColor9, linewidth=2)
///////////////////////////////////////////////////////
src10 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length10 = input.int(title='Length', defval=10, minval=1)
pi10 = 2 * math.asin(1)
a10 = math.exp(-1.414 * pi10 / length10)
b10 = 2 * a10 * math.cos(1.414 * 1.25 * pi10 / length10)
c210 = b10
c310 = -a10 * a10
c110 = 1 - c210 - c310
bf10 = 0.0
bf10 := c110 * src10 + c210 * nz(bf10[1]) + c310 * nz(bf10[2])
sig10 = src10 > bf10 ? 1 : src10 < bf10 ? -1 : 0
bfColor10 = sig10 > 0 ? color.green : sig10 < 0 ? color.red : color.black
//plot(bf10, title='2PBF', color=bfColor10, linewidth=2)
///////////////////////////////////////////////////////
src11 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length11 = input.int(title='Length', defval=15, minval=1)
pi11 = 2 * math.asin(1)
a111 = math.exp(-1.414 * pi11 / length11)
b111 = 2 * a111 * math.cos(1.414 * pi11 / length11)
coef211 = b111
coef311 = -a111 * a111
coef111 = 1 - coef211 - coef311
ssf11 = 0.0
ssf11 := bar_index < 3 ? src11 : coef111 * src11 + coef211 * nz(ssf11[1]) + coef311 * nz(ssf11[2])
sig11 = src11 > ssf11 ? 1 : src11 < ssf11 ? -1 : 0
ssfColor = sig11 > 0 ? color.green : sig11 < 0 ? color.red : color.black
//plot(ssf11, title='SSF', color=ssfColor, linewidth=2)
/////////////////////////////////////////////////////
src12 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length12 = input.int(title='Length', defval=10, minval=1)
pi12 = 2 * math.asin(1)
a12 = math.exp(-1.414 * pi12 / length12)
b12 = 2 * a12 * math.cos(1.414 * pi12 / length12)
c212 = b12
c312 = -a12 * a12
c112 = 1 - c212 - c312
ssf12 = 0.0
ssf12 := c112 * ((src12 + nz(src12[1])) / 2) + c212 * nz(ssf12[1]) + c312 * nz(ssf12[2])
sig12 = src12 > ssf12 ? 1 : src12 < ssf12 ? -1 : 0
ssfColor12 = sig12 > 0 ? color.green : sig12 < 0 ? color.red : color.black
//plot(ssf12, title='SSF', color=ssfColor12, linewidth=2)
/////////////////////////////////////////////////////
src13 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length13 = input.int(title='Length', defval=10, minval=1)
pi13 = 2 * math.asin(1)
a130 = math.exp(-pi13 / length13)
b130 = 2 * a130 * math.cos(1.738 * pi13 / length13)
c130 = a130 * a130
d213 = b130 + c130
d313 = -(c130 + b130 * c130)
d413 = c130 * c130
d113 = 1 - d213 - d313 - d413
bf13 = 0.0
bf13 := d113 * src13 + d213 * nz(bf13[1]) + d313 * nz(bf13[2]) + d413 * nz(bf13[3])
sig13 = src13 > bf13 ? 1 : src13 < bf13 ? -1 : 0
bfColor13 = sig13 > 0 ? color.green : sig13 < 0 ? color.red : color.black
//plot(bf13, title='3PBF', color=bfColor13, linewidth=2)
//////////////////////////////////////////////////////
src14 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length14 = input.int(title='Length', defval=15, minval=1)
pi14 = 2 * math.asin(1)
a114 = math.exp(-pi14 / length14)
b114 = 2 * a114 * math.cos(1.738 * pi14 / length14)
c114 = a114 * a114
coef214 = b114 + c114
coef314 = -(c114 + b114 * c114)
coef414 = c114 * c114
coef114 = (1 - b114 + c114) * (1 - c114) / 8
bf14 = 0.0
bf14 := bar_index < 4 ? src14 : coef114 * (src14 + 3 * nz(src14[1]) + 3 * nz(src14[2]) + nz(src14[3])) + coef214 * nz(bf14[1]) + coef314 * nz(bf14[2]) + coef414 * nz(bf14[3])
sig14 = src14 > bf14 ? 1 : src14 < bf14 ? -1 : 0
bfColor14 = sig14 > 0 ? color.green : sig14 < 0 ? color.red : color.black
//plot(bf14, title='3PBF', color=bfColor14, linewidth=2)
///////////////////////////////////////
src15 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length15 = input.int(title='Length', defval=15, minval=1)
pi15 = 2 * math.asin(1)
a115 = math.exp(-pi15 / length15)
b115 = 2 * a115 * math.cos(1.738 * pi15 / length15)
c115 = a115 * a115
coef215 = b115 + c115
coef315 = -(c115 + b115 * c115)
coef415 = c115 * c115
coef115 = 1 - coef215 - coef315 - coef415
ssf15 = 0.0
ssf15 := bar_index < 4 ? src15 : coef115 * src15 + coef215 * nz(ssf15[1]) + coef315 * nz(ssf15[2]) + coef415 * nz(ssf15[3])
sig15 = src15 > ssf15 ? 1 : src15 < ssf15 ? -1 : 0
ssfColor15 = sig15 > 0 ? color.green : sig15 < 0 ? color.red : color.black
//plot(ssf15, title='SSF', color=ssfColor15, linewidth=2)
////////////////////////////////////////////
src16 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length16 = input.int(title='Length', defval=20, minval=1)
pi16 = 2 * math.asin(1)
twoPiPrd16 = 2 * pi16 / length16
alpha16 = (math.cos(twoPiPrd16) + math.sin(twoPiPrd16) - 1) / math.cos(twoPiPrd16)
dec16 = 0.0
dec16 := alpha16 / 2 * (src16 + nz(src16[1])) + (1 - alpha16) * nz(dec16[1])
sig16 = src16 > dec16 ? 1 : src16 < dec16 ? -1 : 0
decColor16 = sig16 > 0 ? color.green : sig16 < 0 ? color.red : color.black
//plot(dec16, title='DEC', color=decColor16, linewidth=2)
////////////////////////////////
length17 = input.int(title='Length', defval=15, minval=1)
src17 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
num17 = 0.0
coefSum17 = 0.0
for i = 0 to length17 - 1 by 1
distance17 = 0.0
for lb17 = 1 to length17 - 1 by 1
distance17 += math.pow(nz(src17[i]) - nz(src17[i + lb17]), 2)
distance17
num17 += distance17 * nz(src17[i])
coefSum17 += distance17
coefSum17
filt17 = coefSum17 != 0 ? num17 / coefSum17 : 0
sig17 = src17 > filt17 ? 1 : src17 < filt17 ? -1 : 0
filtColor17 = sig17 > 0 ? color.green : sig17 < 0 ? color.red : color.black
//plot(filt17, title='Filter', color=filtColor17, linewidth=2)
///////////////////////////////
src18 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length18 = input.int(title="Length", defval=14, minval=1)
pedestal18 = input.float(title="Pedestal", defval=3, minval=0.01)
filt18 = 0.0, coef18 = 0.0
for i = 0 to length18 - 1
sine18 = math.sin(pedestal18 + (((math.pi - (2 * pedestal18)) * i) / (length18 - 1)))
filt18 := filt18 + (sine18 * nz(src18[i]))
coef18 := coef18 + sine18
filt18 := coef18 != 0 ? filt18 / coef18 : 0
slo18 = src18 - filt18
sig18 = slo18 > 0 ? slo18 > nz(slo18[1]) ? 2 : 1 : slo18 < 0 ? slo18 < nz(slo18[1]) ? -2 : -1 : 0
hmaColor18 = sig18 > 1 ? color.green : sig18 > 0 ? color.lime : sig18 < -1 ? color.maroon : sig18 < 0 ? color.red : color.white
//plot(filt18, title='Hma', color=hmaColor18, linewidth=2)
//////////////////////////////
src19 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length19 = input.int(title="Length", defval=14, minval=1)
filt19 = 0.0, coef19 = 0.0
for i = 1 to length19 by 1
cosine19 = 1 - math.cos(2 * math.pi * i / (length19 + 1))
filt19 += cosine19 * nz(src19[i - 1])
coef19 += cosine19
filt19 := coef19 != 0 ? filt19 / coef19 : 0
slo19 = src19 - filt19
sig19 = slo19 > 0 ? slo19 > nz(slo19[1]) ? 2 : 1 : slo19 < 0 ? slo19 < nz(slo19[1]) ? -2 : -1 : 0
hmaColor19 = sig19 > 1 ? color.green : sig19 > 0 ? color.lime : sig19 < -1 ? color.maroon : sig19 < 0 ? color.red : color.white
//plot(filt19, title='Hma', color=hmaColor19, linewidth=2)
/////////////////////////////////////
src20 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
pi20 = 2 * math.asin(1)
period20 = 0.0
smooth20 = (4 * src20 + 3 * nz(src20[1]) + 2 * nz(src20[2]) + nz(src20[3])) / 10
detrender20 = (0.0962 * smooth20 + 0.5769 * nz(smooth20[2]) - 0.5769 * nz(smooth20[4]) - 0.0962 * nz(smooth20[6])) * (0.075 * nz(period20[1]) + 0.54)
q120 = (0.0962 * detrender20 + 0.5769 * nz(detrender20[2]) - 0.5769 * nz(detrender20[4]) - 0.0962 * nz(detrender20[6])) * (0.075 * nz(period20[1]) + 0.54)
i120 = nz(detrender20[3])
jI20 = (0.0962 * i120 + 0.5769 * nz(i120[2]) - 0.5769 * nz(i120[4]) - 0.0962 * nz(i120[6])) * (0.075 * nz(period20[1]) + 0.54)
jQ20 = (0.0962 * q120 + 0.5769 * nz(q120[2]) - 0.5769 * nz(q120[4]) - 0.0962 * nz(q120[6])) * (0.075 * nz(period20[1]) + 0.54)
i220 = i120 - jQ20
i220 := 0.2 * i220 + 0.8 * nz(i220[1])
q220 = q120 + jI20
q220 := 0.2 * q220 + 0.8 * nz(q220[1])
re20 = i220 * nz(i220[1]) + q220 * nz(q220[1])
re20 := 0.2 * re20 + 0.8 * nz(re20[1])
im20= i220 * nz(q220[1]) - q220 * nz(i220[1])
im20 := 0.2 * im20 + 0.8 * nz(im20[1])
period20 := im20 != 0 and re20 != 0 ? 2 * pi20 / math.atan(im20 / re20) : 0
period20 := math.min(math.max(period20, 0.67 * nz(period20[1])), 1.5 * nz(period20[1]))
period20 := math.min(math.max(period20, 6), 50)
period20 := 0.2 * period20 + 0.8 * nz(period20[1])
smoothPeriod20 = 0.0
smoothPeriod20 := 0.33 * period20 + 0.67 * nz(smoothPeriod20[1])
dcPeriod20 = math.ceil(smoothPeriod20 + 0.5)
iTrend20 = 0.0
for i = 0 to dcPeriod20 - 1 by 1
iTrend20 += nz(src20[i])
iTrend20
iTrend20 := dcPeriod20 > 0 ? iTrend20 / dcPeriod20 : iTrend20
trendline20 = (4 * iTrend20 + 3 * nz(iTrend20[1]) + 2 * nz(iTrend20[2]) + nz(iTrend20[3])) / 10
sig20 = smooth20 > trendline20 ? 1 : smooth20 < trendline20 ? -1 : 0
tlColor20 = sig20 > 0 ? color.green : sig20 < 0 ? color.red : color.black
//plot(trendline20, title='Trendline', color=tlColor20, linewidth=2)
///////////////////////////////////
src21 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
alpha21 = input.float(title='Alpha', defval=0.07, minval=0.01, step=0.01)
itrend21 = 0.0
itrend21 := bar_index < 7 ? (src21 + 2 * nz(src21[1]) + nz(src21[2])) / 4 : (alpha21 - math.pow(alpha21, 2) / 4) * src21 + 0.5 * math.pow(alpha21, 2) * nz(src21[1]) - (alpha21 - 0.75 * math.pow(alpha21, 2)) * nz(src21[2]) + 2 * (1 - alpha21) * nz(itrend21[1]) - math.pow(1 - alpha21, 2) * nz(itrend21[2])
trigger21 = 2 * itrend21 - nz(itrend21[2])
sig21 = trigger21 > itrend21 ? 1 : trigger21 < itrend21 ? -1 : 0
itColor21 = sig21 > 0 ? color.green : sig21 < 0 ? color.red : color.black
//plot(trigger21, title='Trigger', color=itColor21, linewidth=2)
//plot(itrend21, title='ITrend', color=color.new(color.black, 0), linewidth=1)
//////////////////////
src22 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length22 = input.int(title='Length', defval=20, minval=1)
deltaSum22 = 0.0
for int i = 0 to length22 - 1 by 1
deltaSum22 += math.abs(nz(src22[i]) - nz(src22[i + 1]))
ef22 = deltaSum22 != 0 ? math.min(math.abs(src22 - nz(src22[length22 - 1])) / deltaSum22, 1) : 0
s22 = math.pow((0.6667 * ef22) + 0.0645, 2)
kama22 = 0.0
kama22 := (s22 * src22) + ((1 - s22) * nz(kama22[1]))
slo22 = src22 - kama22
sig22 = slo22 > 0 ? slo22 > nz(slo22[1]) ? 2 : 1 : slo22 < 0 ? slo22 < nz(slo22[1]) ? -2 : -1 : 0
kamaColor22 = sig22 > 1 ? color.green : sig22 > 0 ? color.lime : sig22 < -1 ? color.maroon : sig22 < 0 ? color.red : color.black
//plot(kama22, title='Filter', color=kamaColor22, linewidth=2)
////////////////////////
src23 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
gamma23 = input.float(title='Gamma', defval=0.8, minval=0.01, step=0.01)
l023 = 0.0
l023 := (1 - gamma23) * src23 + gamma23 * nz(l023[1])
l123 = 0.0
l123 := -gamma23 * l023 + nz(l023[1]) + gamma23 * nz(l123[1])
l223 = 0.0
l223 := -gamma23 * l123 + nz(l123[1]) + gamma23 * nz(l223[1])
l323 = 0.0
l323 := -gamma23 * l223 + nz(l223[1]) + gamma23 * nz(l323[1])
filt23 = (l023 + 2 * l123 + 2 * l223 + l323) / 6
fir23 = (src23 + 2 * nz(src23[1]) + 2 * nz(src23[2]) + nz(src23[3])) / 6
sig23 = fir23 > filt23 ? 1 : fir23 < filt23 ? -1 : 0
lfColor23 = sig23 > 0 ? color.green : sig23 < 0 ? color.red : color.black
//plot(filt23, title='FILT', color=lfColor23, linewidth=2)
//plot(fir23, title='FIR', color=color.new(color.black, 0), linewidth=1)
/////////////////////////////////
src24 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
threshold24 = input.float(title='Threshold', defval=0.002, minval=0.0001, step=0.001)
length24 = input.int(title='Length', defval=39, minval=1)
smth24 = (src24 + (2 * nz(src24[1])) + (2 * nz(src24[2])) + nz(src24[3])) / 6
len24 = length24
v324 = 0.2, v224 = 0.0, alpha24 = 0.0
while (v324 > threshold24 and len24 > 0)
alpha24 := 2.0 / (len24 + 1)
v124 = ta.median(smth24, len24)
v224 := (alpha24 * smth24) + ((1 - alpha24) * nz(v224[1]))
v324 := v124 != 0 ? math.abs(v124 - v224) / v124 : v324
len24 -= 2
len24 := len24 < 3 ? 3 : len24
alpha24 := 2.0 / (len24 + 1)
filter24 = 0.0
filter24 := (alpha24 * smth24) + ((1 - alpha24) * nz(filter24[1]))
slo24 = src24 - filter24
sig24 = slo24 > 0 ? slo24 > nz(slo24[1]) ? 2 : 1 : slo24 < 0 ? slo24 < nz(slo24[1]) ? -2 : -1 : 0
maafColor24 = sig24 > 1 ? color.green : sig24 > 0 ? color.lime : sig24 < -1 ? color.maroon : sig24 < 0 ? color.red : color.black
//plot(filter24, title='MAAF', linewidth=2, color=maafColor24)
///////////////////////////////
src25 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
fastLimit25 = input.float(title='FastLimit', defval=0.5, minval=0.01, step=0.01)
slowLimit25 = input.float(title='SlowLimit', defval=0.05, minval=0.01, step=0.01)
pi25 = 2 * math.asin(1)
period25 = 0.0
smooth25 = (4 * src25 + 3 * nz(src25[1]) + 2 * nz(src25[2]) + nz(src25[3])) / 10
detrender25 = (0.0962 * smooth25 + 0.5769 * nz(smooth25[2]) - 0.5769 * nz(smooth25[4]) - 0.0962 * nz(smooth25[6])) * (0.075 * nz(period25[1]) + 0.54)
q125 = (0.0962 * detrender25 + 0.5769 * nz(detrender25[2]) - 0.5769 * nz(detrender25[4]) - 0.0962 * nz(detrender25[6])) * (0.075 * nz(period25[1]) + 0.54)
i125 = nz(detrender25[3])
jI25 = (0.0962 * i125 + 0.5769 * nz(i125[2]) - 0.5769 * nz(i125[4]) - 0.0962 * nz(i125[6])) * (0.075 * nz(period25[1]) + 0.54)
jQ25 = (0.0962 * q125 + 0.5769 * nz(q125[2]) - 0.5769 * nz(q125[4]) - 0.0962 * nz(q125[6])) * (0.075 * nz(period25[1]) + 0.54)
i225 = i125 - jQ25
i225 := 0.2 * i225 + 0.8 * nz(i225[1])
q225 = q125 + jI25
q225 := 0.2 * q225 + 0.8 * nz(q225[1])
re25 = i225 * nz(i225[1]) + q225 * nz(q225[1])
re25 := 0.2 * re25 + 0.8 * nz(re25[1])
im25 = i225 * nz(q225[1]) - q225 * nz(i225[1])
im25 := 0.2 * im25 + 0.8 * nz(im25[1])
period25 := im25 != 0 and re25 != 0 ? 2 * pi25 / math.atan(im25 / re25) : 0
period25 := math.min(math.max(period25, 0.67 * nz(period25[1])), 1.5 * nz(period25[1]))
period25 := math.min(math.max(period25, 6), 50)
period25 := 0.2 * period25 + 0.8 * nz(period25[1])
smoothPeriod25 = 0.0
smoothPeriod25 := 0.33 * period25 + 0.67 * nz(smoothPeriod25[1])
phase25 = i125 != 0 ? math.atan(q125 / i125) * 180 / pi25 : 0
deltaPhase25 = nz(phase25[1]) - phase25
deltaPhase25 := deltaPhase25 < 1 ? 1 : deltaPhase25
alpha25 = fastLimit25 / deltaPhase25
alpha25 := alpha25 < slowLimit25 ? slowLimit25 : alpha25
mama25 = 0.0
mama25 := alpha25 * src25 + (1 - alpha25) * nz(mama25[1])
fama25 = 0.0
fama25 := 0.5 * alpha25 * mama25 + (1 - 0.5 * alpha25) * nz(fama25[1])
sig25 = mama25 > fama25 ? 1 : mama25 < fama25 ? -1 : 0
mamaColor25 = sig25 > 0 ? color.green : sig25 < 0 ? color.red : color.black
//plot(mama25, title='MAMA', color=mamaColor25, linewidth=2)
//plot(fama25, title='FAMA', color=color.new(color.black, 0), linewidth=1)
//////////////////////////////////////
length26 = input.int(title='Length', defval=15, minval=1)
momLength26 = input.int(title='MomentumLength', defval=5, minval=1)
src26 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
num26 = 0.0
coefSum26 = 0.0
for i = 0 to length26 - 1 by 1
coef26 = math.abs(nz(src26[i]) - nz(src26[i + momLength26]))
num26 += coef26 * nz(src26[i])
coefSum26 += coef26
coefSum26
filt26 = coefSum26 != 0 ? num26 / coefSum26 : 0
sig26 = src26 > filt26 ? 1 : src26 < filt26 ? -1 : 0
filtColor26 = sig26 > 0 ? color.green : sig26 < 0 ? color.red : color.black
//plot(filt26, title='Filter', color=filtColor26, linewidth=2)
//////////////////////////////////
src27 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
wma127 = (7 * src27 + 6 * nz(src27[1]) + 5 * nz(src27[2]) + 4 * nz(src27[3]) + 3 * nz(src27[4]) + 2 * nz(src27[5]) + nz(src27[6])) / 28
wma227 = (7 * wma127 + 6 * nz(wma127[1]) + 5 * nz(wma127[2]) + 4 * nz(wma127[3]) + 3 * nz(wma127[4]) + 2 * nz(wma127[5]) + nz(wma127[6])) / 28
predict27 = 2 * wma127 - wma227
trigger27 = (4 * predict27 + 3 * nz(predict27[1]) + 2 * nz(predict27[2]) + nz(predict27[3])) / 10
sig27 = predict27 > trigger27 ? 1 : predict27 < trigger27 ? -1 : 0
pmaColor27 = sig27 > 0 ? color.green : sig27 < 0 ? color.red : color.black
//plot(predict27, title='Predict', color=pmaColor27, linewidth=2)
//plot(trigger27, title='Trigger', color=color.new(color.black, 0), linewidth=1)
/////////////////////////////////////
src28 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length28 = input.int(title="Length", defval=14, minval=1)
filt28 = 0.0, coef28 = 0.0, l228 = length28 / 2.0
for i = 1 to length28
c28 = i < l228 ? i : i > l228 ? length28 + 1 - i : l228
filt28 := filt28 + (c28 * nz(src28[i - 1]))
coef28 := coef28 + c28
filt28 := coef28 != 0 ? filt28 / coef28 : 0
slo28 = src28 - filt28
sig28 = slo28 > 0 ? slo28 > nz(slo28[1]) ? 2 : 1 : slo28 < 0 ? slo28 < nz(slo28[1]) ? -2 : -1 : 0
tmaColor28 = sig28 > 1 ? color.green : sig28 > 0 ? color.lime : sig28 < -1 ? color.maroon : sig28 < 0 ? color.red : color.white
//plot(filt28, title='Tma', color=tmaColor28, linewidth=2)
//////////////////////////////////
src29 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
shortLength29 = input.int(title='ShortLength', defval=9, minval=1)
longLength29 = input.int(title='LongLength', defval=30, minval=1)
shortAvg29 = ta.wma(src29, shortLength29)
shortMa29 = math.sum(math.pow(src29 - shortAvg29, 2), shortLength29) / shortLength29
shortRms29 = shortMa29 > 0 ? math.sqrt(shortMa29) : 0
longAvg29 = ta.wma(src29, longLength29)
longMa29 = math.sum(math.pow(src29 - longAvg29, 2), longLength29) / longLength29
longRms29 = longMa29 > 0 ? math.sqrt(longMa29) : 0
kk29 = longRms29 != 0 ? 0.2 * shortRms29 / longRms29 : 0
vidya29 = 0.0
vidya29 := kk29 * src29 + (1 - kk29) * nz(vidya29[1])
slo29 = src29 - vidya29
sig29 = slo29 > 0 ? slo29 > nz(slo29[1]) ? 2 : 1 : slo29 < 0 ? slo29 < nz(slo29[1]) ? -2 : -1 : 0
vidyaColor29 = sig29 > 1 ? color.green : sig29 > 0 ? color.lime : sig29 < -1 ? color.maroon : sig29 < 0 ? color.red : color.black
//plot(vidya29, title='Vidya', color=vidyaColor29, linewidth=2)
////////////////////////////////////////
src31 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length31 = input(title='Length', defval=11)
offset31 = input(title='Offset', defval=4)
sum31 = 0.0
weightSum31 = 0.0
for i = 0 to length31 - 1 by 1
weight31 = length31 - i - offset31
sum31 += src31[i] * weight31
weightSum31 += weight31
weightSum31
epma31 = 1 / weightSum31 * sum31
sig31 = src31 > epma31 ? 1 : src31 < epma31 ? -1 : 0
epmaColor31 = sig31 > 0 ? color.green : sig31 < 0 ? color.red : color.black
//plot(epma31, title='EPMA', linewidth=2, color=epmaColor31)
////////////////////////////////
src32 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length32 = input.int(title='Length', defval=14, minval=1)
jsa32 = (src32 + src32[length32]) / 2
sig32 = src32 > jsa32 ? 1 : src32 < jsa32 ? -1 : 0
jsaColor32 = sig32 > 0 ? color.green : sig32 < 0 ? color.red : color.black
//plot(jsa32, color=jsaColor32, linewidth=2)
/////////////////////////////
src33 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
fastLength33 = input.int(title = "FastLength", defval = 14, minval = 1)
slowLength33 = input.int(title = "SlowLength", defval = 30, minval = 1)
leavittProjection(src33, length33) =>
result33 = ta.linreg(src33, length33, -1)
fastLp33 = leavittProjection(src33, fastLength33)
slowLp33 = leavittProjection(src33, slowLength33)
slo33 = fastLp33 - slowLp33
sig33 = slo33 > 0 ? slo33 > nz(slo33[1]) ? 2 : 1 : slo33 < 0 ? slo33 < nz(slo33[1]) ? -2 : -1 : 0
lpColor33 = sig33 > 1 ? color.green : sig33 > 0 ? color.lime : sig33 < -1 ? color.maroon : sig33 < 0 ? color.red : color.white
//plot(fastLp33, title = 'FastLp', color = lpColor33, linewidth = 2)
//plot(slowLp33, title = 'SlowLp', color = chart.fg_color, linewidth = 1)
//////////////////////////////////
src34 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length34 = input(title='Length', defval=5)
k34 = input.float(title='K Constant', step=0.1, defval=0.6)
mdi34 = 0.0
mdi34 := na(mdi34[1]) ? src34 : nz(mdi34[1]) + (src34 - nz(mdi34[1])) / math.max(k34 * length34 * math.pow(src34 / nz(mdi34[1]), 4), 1)
sig34 = src34 > mdi34 ? 1 : src34 < mdi34 ? -1 : 0
mdiColor34 = sig34 > 0 ? color.green : sig34 < 0 ? color.red : color.black
//plot(mdi34, title='MDI', linewidth=2, color=mdiColor34)
////////////////////////////////////////////
src35 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length35 = input.int(title='Length', defval=10, minval=1)
fastLength35 = input.int(title='FastLength', defval=2, minval=1)
slowLength35 = input.int(title='SlowLength', defval=30, minval=1)
// first half uses the same formula as the kaufman adaptive moving average
diff35 = math.abs(src35 - nz(src35[1]))
signal35 = math.abs(src35 - nz(src35[length35]))
noise35 = math.sum(diff35, length35)
ratio35 = noise35 != 0 ? signal35 / noise35 : 0
// this is where it differs from the kaufman adaptive moving average
fastSc35 = 2 / (fastLength35 + 1)
slowSc35 = 2 / (slowLength35 + 1)
temp35 = ratio35 * fastSc35 + slowSc35
maaq35 = 0.0
prevMaaq35 = nz(maaq35[1], src35)
maaq35 := prevMaaq35 + math.pow(temp35, 2) * (src35 - prevMaaq35)
sig35 = src35 > maaq35 ? 1 : src35 < maaq35 ? -1 : 0
maaqColor35 = sig35 > 0 ? color.green : sig35 < 0 ? color.red : color.black
//plot(maaq35, title='MAAQ', linewidth=2, color=maaqColor35)
///////////////////////////////
src36 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
fac36 = input.float(title='Factor', defval=0.2, minval=0.01)
val236 = 2 / fac36 - 1
factor36 = 2 / (val236 + 1)
mwdx36 = 0.0
mwdx36 := factor36 * src36 + (1 - factor36) * nz(mwdx36[1], src36)
sig36 = src36 > mwdx36 ? 1 : src36 < mwdx36 ? -1 : 0
mwdxColor36 = sig36 > 0 ? color.green : sig36 < 0 ? color.red : color.black
//plot(mwdx36, title='MWDX', linewidth=2, color=mwdxColor36)
////////////////////////
src37 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
fastLength37 = input.int(title='FastLength', defval=10, minval=1)
slowLength37 = input.int(title='SlowLength', defval=50, minval=1)
mult37 = input.int(title='Multiple', defval=1, minval=1)
fastEma37 = ta.ema(src37, fastLength37)
slowEma37 = ta.ema(src37, slowLength37)
sqAvg37 = math.sum(math.pow(slowEma37 - fastEma37, 2), fastLength37) / fastLength37
dev37 = math.sqrt(sqAvg37) * mult37
upperBand37 = slowEma37 + dev37
lowerBand37 = slowEma37 - dev37
middleBand37 = fastEma37
sig37 = src37 > upperBand37 and nz(src37[1]) <= nz(upperBand37[1]) or src37 > lowerBand37 and nz(src37[1]) <= nz(lowerBand37[1]) ? 1 : src37 < lowerBand37 and nz(src37[1]) >= nz(lowerBand37[1]) or src37 < upperBand37 and nz(src37[1]) >= nz(upperBand37[1]) ? -1 : src37 > middleBand37 ? 1 : src37 < middleBand37 ? -1 : 0
mabColor37 = sig37 > 0 ? color.green : sig37 < 0 ? color.red : color.black
//plot(upperBand37, title='MabUp', color=mabColor37, linewidth=2)
//plot(middleBand37, title='MabMid', color=color.new(color.black, 0), linewidth=1)
//plot(lowerBand37, title='MabLow', color=mabColor37, linewidth=2)
//////////////////////////////////
src38 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length38 = input(title='Length', defval=14)
sum38 = 0.0
weightSum38 = 0.0
owma38 = 0.0
for i = 0 to length38 - 1 by 1
corr38 = ta.correlation(src38, owma38, length38)
weight38 = math.pow(length38 - i, corr38)
sum38 += src38[i] * weight38
weightSum38 += weight38
weightSum38
owma38 := sum38/ weightSum38
sig38 = src38 > owma38 ? 1 : src38 < owma38 ? -1 : 0
owmaColor38 = sig38 > 0 ? color.green : sig38 < 0 ? color.red : color.black
//plot(owma38, title='OWMA', linewidth=2, color=owmaColor38)
/////////////////////////////////
src39 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
minLength39 = input.int(title='MinLength', defval=5, minval=1)
maxLength39 = input.int(title='MaxLength', defval=50, minval=1)
mean39 = ta.sma(src39, maxLength39)
stdDev39 = ta.stdev(src39, maxLength39)
a39 = mean39 - 1.75 * stdDev39
b39 = mean39 - 0.25 * stdDev39
c390 = mean39 + 0.25 * stdDev39
d39 = mean39 + 1.75 * stdDev39
length39 = 0.0
length39 := src39 >= b39 and src39 <= c390 ? nz(length39[1], maxLength39) + 1 : src39 < a39 or src39 > d39 ? nz(length39[1], maxLength39) - 1 : nz(length39[1], maxLength39)
length39 := math.max(math.min(length39, maxLength39), minLength39)
sc39 = 2 / (length39 + 1)
vlma39 = 0.0
vlma39 := src39 * sc39 + (1 - sc39) * nz(vlma39[1], src39)
sig39 = src39 > vlma39 ? 1 : src39 < vlma39 ? -1 : 0
vlmaColor39 = sig39 > 0 ? color.green : sig39 < 0 ? color.red : color.black
//plot(vlma39, title='VLMA', linewidth=2, color=vlmaColor39)
//////////////////////////////
src41 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length41 = input(title='Length', defval=14)
p41 = input.float(title='Power', minval=0, defval=1.0)
sum41 = 0.0
weightSum41 = 0.0
for i = 0 to length41 - 1 by 1
weight41 = math.pow(length41 - i, p41)
sum41 += src41[i] * weight41
weightSum41 += weight41
weightSum41
vpwma41 = sum41 / weightSum41
sig41 = src41 > vpwma41 ? 1 : src41 < vpwma41 ? -1 : 0
vpwmaColor41 = sig41 > 0 ? color.green : sig41 < 0 ? color.red : color.black
//plot(vpwma41, title='VPWMA', linewidth=2, color=vpwmaColor41)
/////////////////////////////
src42 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length42 = input(title='Length', defval=14)
sum42 = 0.0
weightSum42 = 0.0
for i = 0 to length42 - 1 by 1
weight42 = math.pow(length42 - i, 2)
sum42 += src42[i] * weight42
weightSum42 += weight42
weightSum42
swma42 = sum42 / weightSum42
sig42 = src42 > swma42 ? 1 : src42 < swma42 ? -1 : 0
swmaColor42 = sig42 > 0 ? color.green : sig42 < 0 ? color.red : color.black
//plot(swma42, title='SWMA', linewidth=2, color=swmaColor42)
//////////////////////////
src43 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length43 = input(title='Length', defval=14)
sum43 = 0.0
weightSum43 = 0.0
for i = 0 to length43 - 1 by 1
weight43 = math.pow(length43 - i, 0.5)
sum43 += src43[i] * weight43
weightSum43 += weight43
weightSum43
srwma43 = sum43 / weightSum43
sig43 = src43 > srwma43 ? 1 : src43 < srwma43 ? -1 : 0
srwmaColor43 = sig43 > 0 ? color.green : sig43 < 0 ? color.red : color.black
//plot(srwma43, title='SRWMA', linewidth=2, color=srwmaColor43)
////////////////////////
src44 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length44 = input.int(title='Length', defval=20, minval=1)
middleBandLength44 = input.int(title='MiddleBandLength', defval=21, minval=1)
bandsDeviation44 = input.float(title='BandsDeviation', defval=2.4, minval=0.1)
lowBandAdjust44 = input.float(title='LowBandAdjust', defval=0.9, minval=0.1)
atrPeriod44 = length44 * 2 - 1
atrBuf44 = ta.atr(atrPeriod44) * bandsDeviation44
ma44 = ta.ema(src44, length44)
upperBand44 = ma44 + ma44 * atrBuf44 / src44
middleBand44 = ta.ema(src44, middleBandLength44)
lowerBand44 = ma44- ma44 * atrBuf44 * lowBandAdjust44 / src44
sig44 = src44 > upperBand44 and nz(src44[1]) <= nz(upperBand44[1]) or src44 > lowerBand44 and nz(src44[1]) <= nz(lowerBand44[1]) or src44 > middleBand44 ? 1 : src44 < lowerBand44 and nz(src44[1]) >= nz(lowerBand44[1]) or src44 < upperBand44 and nz(src44[1]) >= nz(upperBand44[1]) or src44 < middleBand44 ? -1 : 0
svbColor44 = sig44 > 0 ? color.green : sig44 < 0 ? color.red : color.black
//plot(upperBand44, title='SVBUp', color=svbColor44, linewidth=2)
//plot(middleBand44, title='SVBMid', color=color.new(color.black, 0), linewidth=1)
//plot(lowerBand44, title='SVBLow', color=svbColor44, linewidth=2)
//////////////////////
src45 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length45 = input.int(title='Length', defval=50, minval=2)
mult45 = input.float(title='Mult', defval=10.0, minval=0.01)
alpha45 = 2.0 / (length45 + 1)
mom45 = src45 - nz(src45[1])
up45 = mom45 > 0 ? mom45 : 0
dn45 = mom45 < 0 ? math.abs(mom45) : 0
upMa45 = ta.ema(up45, length45)
dnMa45 = ta.ema(dn45, length45)
rs45 = upMa45 + dnMa45 != 0 ? math.abs(upMa45 - dnMa45) / (upMa45 + dnMa45) : 0
rsEma45 = 0.0
rsEma45 := nz(rsEma45[1]) + (alpha45 * (1 + (rs45 * mult45)) * (src45 - nz(rsEma45[1])))
slo45 = src45 - rsEma45
sig45 = slo45 > 0 ? slo45 > nz(slo45[1]) ? 2 : 1 : slo45 < 0 ? slo45 < nz(slo45[1]) ? -2 : -1 : 0
rsemaColor45 = sig45 > 1 ? color.green : sig45 > 0 ? color.lime : sig45 < -1 ? color.maroon : sig45 < 0 ? color.red : color.black
//plot(rsEma45, title='RSEma', color=rsemaColor45, linewidth=2)
//////////////////////
volSym46 = input.symbol(title='Volatility Symbol', defval='VIX')
src46 = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
volSrc46 = request.security(volSym46, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
length46 = input.int(title='Length', defval=10, minval=1)
maLength46 = input.int(title='MaLength', defval=10, minval=1)
mult46 = input.float(title='Mult', defval=10.0, minval=.01)
alpha46 = 2.0 / (length46 + 1)
mom46 = src46 - nz(src46[1])
pv46 = mom46> 0 ? volSrc46 : 0
nv46 = mom46 < 0 ? volSrc46 : 0
pvMa46 = ta.ema(pv46, maLength46)
nvMa46 = ta.ema(nv46, maLength46)
rs46 = pvMa46 + nvMa46 != 0 ? math.abs(pvMa46 - nvMa46) / (pvMa46 + nvMa46) : 0
rsvaEma46 = 0.0
rsvaEma46 := nz(rsvaEma46[1]) + (alpha46 * (1 + (rs46 * mult46)) * (src46 - nz(rsvaEma46[1])))
slo46 = src46 - rsvaEma46
sig46 = slo46 > 0 ? slo46 > nz(slo46[1]) ? 2 : 1 : slo46 < 0 ? slo46 < nz(slo46[1]) ? -2 : -1 : 0
rsvaemaColor46 = sig46 > 1 ? color.green : sig46 > 0 ? color.lime : sig46 < -1 ? color.maroon : sig46 < 0 ? color.red : color.black
//plot(rsvaEma46, title='RSEma', color=rsvaemaColor46, linewidth=2)
/////////////////////////////////
float inp55 = input(title = 'Source', defval = close)
string res55 = input.timeframe(title = 'Resolution', defval = '')
bool rep55 = input(title = 'Allow Repainting?', defval = false)
float src47 = request.security(syminfo.tickerid, res55, inp55[rep55 ? 0 : barstate.isrealtime ? 1 : 0])[rep55 ? 0 : barstate.isrealtime ? 0 : 1]
int length47 = input.int(title = 'Length', defval = 40, minval = 2)
float mult47 = input.float(title = 'Mult', defval = 10.0, minval = 0.01)
float alpha47 = 2.0 / (length47 + 1)
float trL47 = ta.lowest(ta.tr, length47)
float trH47 = ta.highest(ta.tr, length47)
float trAdj47 = trH47 - trL47 != 0 ? (ta.tr - trL47) / (trH47 - trL47) : 0
float trAdjEma47 = 0.0
trAdjEma47 := nz(trAdjEma47[1]) + (alpha47 * (1 + (trAdj47 * mult47)) * (src47 - nz(trAdjEma47[1])))
float slo47 = src47 - trAdjEma47
int sig47 = slo47 > 0 ? slo47 > nz(slo47[1]) ? 2 : 1 : slo47 < 0 ? slo47 < nz(slo47[1]) ? -2 : -1 : 0
color tradjemaColor47 = sig47 > 1 ? color.green : sig47 > 0 ? color.lime : sig47 < -1 ? color.maroon : sig47 < 0 ? color.red : color.black
//plot(trAdjEma47, title = 'TrAdjEma', color = tradjemaColor47, linewidth = 2)
/////////////////////////////////
float src49 = request.security(syminfo.tickerid, res55, inp55[rep55 ? 0 : barstate.isrealtime ? 1 : 0])[rep55 ? 0 : barstate.isrealtime ? 0 : 1]
float tr49 = request.security(syminfo.tickerid, res55, ta.tr[rep55 ? 0 : barstate.isrealtime ? 1 : 0])[rep55 ? 0 : barstate.isrealtime ? 0 : 1]
int length49 = input.int(title = 'Length', defval = 30, minval = 2)
float hhC49 = ta.highest(src49, length49)
float llC49 = ta.lowest(src49, length49)
float result49 = hhC49 - llC49
float effort49 = math.sum(tr49, length49)
float alpha49 = effort49 != 0 ? result49 / effort49 : 0
float nama49 = 0.0
nama49 := (alpha49 * src49) + ((1 - alpha49) * nz(nama49[1]))
float slo49 = src49 - nama49
int sig49 = slo49 > 0 ? slo49 > nz(slo49[1]) ? 2 : 1 : slo49 < 0 ? slo49 < nz(slo49[1]) ? -2 : -1 : 0
color namaColor49 = sig49 > 1 ? color.green : sig49 > 0 ? color.lime : sig49 < -1 ? color.maroon : sig49 < 0 ? color.red : color.black
//plot(nama49, title = 'Nama', color = namaColor49, linewidth = 2)
//////////////////////////////////////
float src50 = request.security(syminfo.tickerid, res55, inp55[rep55 ? 0 : barstate.isrealtime ? 1 : 0])[rep55 ? 0 : barstate.isrealtime ? 0 : 1]
float tr50 = request.security(syminfo.tickerid, res55, ta.tr[rep55 ? 0 : barstate.isrealtime ? 1 : 0])[rep55 ? 0 : barstate.isrealtime ? 0 : 1]
int length50 = input.int(title = 'Length', defval = 30, minval = 2)
float result50 = math.abs(src50 - nz(src50[length50]))
float effort50 = math.sum(tr50, length50)
float alpha50 = effort50 != 0 ? result50 / effort50 : 0
float anama50 = 0.0
anama50 := (alpha50 * src50) + ((1 - alpha50) * nz(anama50[1]))
float slo50 = src50 - anama50
int sig50 = slo50 > 0 ? slo50 > nz(slo50[1]) ? 2 : 1 : slo50 < 0 ? slo50 < nz(slo50[1]) ? -2 : -1 : 0
color anamaColor50 = sig50 > 1 ? color.green : sig50 > 0 ? color.lime : sig50 < -1 ? color.maroon : sig50 < 0 ? color.red : color.black
//plot(anama50, title = 'Anama', color = anamaColor50, linewidth = 2)
/////////////////////////////////////////////////////////
float src51 = request.security(syminfo.ticker, res55, inp55[rep55 ? 0 : barstate.isrealtime ? 1 : 0])[rep55 ? 0 : barstate.isrealtime ? 0 : 1]
int fastLength51 = input.int(title = 'FastLength', defval = 6, minval = 1)
int slowLength51 = input.int(title = 'SlowLength', defval = 12, minval = 1)
int sampleLength51 = input.int(title = 'SampleLength', defval = 5, minval = 1)
hannFilter51(float sampleSrc51, int length51) =>
filt51 = 0.0, coef51 = 0.0
for i = 1 to length51
cosine51 = 1 - math.cos(2 * math.pi * i / (length51 + 1))
filt51 := filt51 + (cosine51 * nz(sampleSrc51[i - 1]))
coef51 := coef51 + cosine51
filt51 := coef51 != 0 ? filt51 / coef51 : 0
float sample51 = 0.0
sample51 := bar_index % sampleLength51 == 0 ? src51 : nz(sample51[1])
float fastAvg51 = hannFilter51(sample51, fastLength51)
float slowAvg51 = hannFilter51(sample51, slowLength51)
float slo51 = fastAvg51 - slowAvg51
int sig51 = slo51 > 0 ? slo51 > nz(slo51[1]) ? 2 : 1 : slo51 < 0 ? slo51 < nz(slo51[1]) ? -2 : -1 : 0
color udsmaColor51 = sig51 > 1 ? color.green : sig51 > 0 ? color.lime : sig51 < -1 ? color.maroon : sig51 < 0 ? color.red : color.black
//plot(fastAvg51, title = "FastAverage", color = udsmaColor51, linewidth = 2)
//plot(slowAvg51, title = "SlowAverage", color = chart.fg_color, linewidth = 1)
//////////////////////////////////
float src52 = request.security(syminfo.tickerid, res55, inp55[rep55 ? 0 : barstate.isrealtime ? 1 : 0])[rep55 ? 0 : barstate.isrealtime ? 0 : 1]
fastLength52 = input.int(title = "FastLength", defval = 14, minval = 1)
slowLength52 = input.int(title = "SlowLength", defval = 30, minval = 1)
leavittProjection52(float src52, int length52) =>
float result52 = ta.linreg(src52, length52, -1)
leavittConvolution52(float src52, int length52) =>
int sqrtLength52 = math.floor(nz(math.sqrt(length52)))
float result52 = ta.linreg(leavittProjection52(src52, length52), sqrtLength52, -1)
float fastConv52 = leavittConvolution52(src52, fastLength52)
float slowConv52 = leavittConvolution52(src52, slowLength52)
float slo52 = fastConv52 - slowConv52
int sig52 = slo52 > 0 ? slo52 > nz(slo52[1]) ? 2 : 1 : slo52 < 0 ? slo52 < nz(slo52[1]) ? -2 : -1 : 0
color lcColor52 = sig52 > 1 ? color.green : sig52 > 0 ? color.lime : sig52 < -1 ? color.maroon : sig52 < 0 ? color.red : color.white
//plot(fastConv52, title = 'FastConv', color = lcColor52, linewidth = 2)
//plot(slowConv52, title = 'SlowConv', color = chart.fg_color, linewidth = 1)
//////////////////////////////////////////////
////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
f_security(_symbol66, _res66, _src66, _repaint66) =>
request.security(_symbol66, _res66, _src66[_repaint66 ? 0 : barstate.isrealtime ? 1 : 0])[_repaint66 ? 0 : barstate.isrealtime ? 0 : 1]
res66 = input.timeframe(title='Resolution', defval='')
rep66 = input(title='Allow Repainting?', defval=false)
length53 = input.int(title='Length', defval=14, minval=1)
factor53 = input.int(title='Factor', defval=2, minval=1)
p53 = f_security(syminfo.tickerid, res66, hl2, rep66)
h53 = f_security(syminfo.tickerid, res66, high, rep66)
l53 = f_security(syminfo.tickerid, res66, low, rep66)
t53 = f_security(syminfo.tickerid, res66, ta.tr, rep66)
mpEma53 = ta.ema(p53, length53)
trEma53 = ta.ema(t53, length53)
stdDev53 = ta.stdev(trEma53, length53)
ad53 = p53 > nz(p53[1]) ? mpEma53 + trEma53 / 2 : p53 < nz(p53[1]) ? mpEma53 - trEma53 / 2 : mpEma53
adm53 = ta.ema(ad53, length53)
trndDn53 = 0.0
trndDn53 := ta.crossunder(adm53, mpEma53) ? h53[2] : p53 < nz(p53[1]) ? p53 + stdDev53 * factor53 : nz(trndDn53[1], h53[2])
trndUp53 = 0.0
trndUp53 := ta.crossover(adm53, mpEma53) ? l53[2] : p53 > nz(p53[1]) ? p53 - stdDev53 * factor53 : nz(trndUp53[1], l53[2])
trndr53 = 0.0
trndr53 := adm53 < mpEma53 ? trndDn53 : adm53 > mpEma53 ? trndUp53 : nz(trndr53[1], 0)
sig53 = p53 > trndr53 ? 1 : p53 < trndr53 ? -1 : 0
trndrColor53 = sig53 > 0 ? color.green : sig53 < 0 ? color.red : color.black
//plot(trndr53, color=trndrColor53, linewidth=2)
//plot(mpEma53, color=color.new(color.blue, 0), linewidth=2)
//plot(adm53, color=color.new(color.black, 0), linewidth=1)
/////////////////////////////////////////
c54 = f_security(syminfo.tickerid, res66, close, rep66)
v54 = f_security(syminfo.tickerid, res66, volume, rep66)
length54 = input.int(title='Length', defval=50, minval=2)
mult54 = input.float(title='Mult', defval=10.0, minval=0.01)
alpha54 = 2.0 / (length54 + 1)
mom54 = c54 - nz(c54[1])
pv54 = mom54 > 0 ? v54 : 0
nv54 = mom54 < 0 ? v54 : 0
pvMa54 = ta.ema(pv54, length54)
nvMa54 = ta.ema(nv54, length54)
vs54 = pvMa54 + nvMa54 != 0 ? math.abs(pvMa54 - nvMa54) / (pvMa54 + nvMa54) : 0
rsvaEma54 = 0.0
rsvaEma54 := nz(rsvaEma54[1]) + (alpha54 * (1 + (vs54 * mult54)) * (c54 - nz(rsvaEma54[1])))
slo54 = c54 - rsvaEma54
sig54 = slo54 > 0 ? slo54 > nz(slo54[1]) ? 2 : 1 : slo54 < 0 ? slo54 < nz(slo54[1]) ? -2 : -1 : 0
rsvaemaColor54 = sig54 > 1 ? color.green : sig54 > 0 ? color.lime : sig54 < -1 ? color.maroon : sig54 < 0 ? color.red : color.black
//plot(rsvaEma54, title='RSEma', color=rsvaemaColor54, linewidth=2)
////////////////////////////////////
length56 = input.int(title='Length', defval=25, minval=1)
h56 = f_security(syminfo.tickerid, res66, high, rep66)
l56 = f_security(syminfo.tickerid, res66, low, rep66)
c56 = f_security(syminfo.tickerid, res66, close, rep66)
hh56 = ta.highest(h56, length56)
ll56 = ta.lowest(l56, length56)
atr56 = ta.atr(length56)
mult56 = math.sqrt(length56)
dSup56 = hh56 - atr56 * mult56
dRes56 = ll56 + atr56 * mult56
dMid56 = (dSup56 + dRes56) / 2
sig56 = c56 > dMid56 ? 1 : c56 < dMid56 ? -1 : 0
dsrColor56 = sig56 > 0 ? color.green : sig56 < 0 ? color.red : color.black
//plot(dSup56, title='Support', color=color.new(color.red, 0), linewidth=2)
//plot(dMid56, title='Middle', color=dsrColor56, linewidth=1)
//plot(dRes56, title='Resistance', color=color.new(color.green, 0), linewidth=2)
///////////////////////////////
length57 = input.int(title='Length', defval=3, minval=1)
h57 = f_security(syminfo.tickerid, res66, high, rep66)
l57 = f_security(syminfo.tickerid, res66, low, rep66)
c57 = f_security(syminfo.tickerid, res66, close, rep66)
highMa57 = ta.sma(h57, length57)
lowMa57 = ta.sma(l57, length57)
ghla57 = 0.0
ghla57 := c57 > nz(highMa57[1]) ? lowMa57 : c57 < nz(lowMa57[1]) ? highMa57 : nz(ghla57[1])
sig57 = c57 > ghla57 ? 1 : c57 < ghla57 ? -1 : 0
ghlaColor57 = sig57 > 0 ? color.green : sig57 < 0 ? color.red : color.black
//plot(ghla57, title='GHLA', color=ghlaColor57, linewidth=2)
//////////////////////////////////
lbLength58 = input.int(title='LookBackLength', defval=21, minval=1)
p58 = f_security(syminfo.tickerid, res66, close, rep66)
h58 = f_security(syminfo.tickerid, res66, high, rep66)
l58 = f_security(syminfo.tickerid, res66, low, rep66)
ll58 = ta.lowest(lbLength58)
hh58 = ta.highest(lbLength58)
hCount58 = 0
lCount58 = 0
cbl58 = p58
for i = 0 to lbLength58 by 1
if l58[i] == ll58
for j58 = i + 1 to i + lbLength58 by 1
lCount58 += (h58[j58] > h58[i] ? 1 : 0)
if lCount58 == 2
cbl58 := h58[j58]
break
if h58[i] == hh58
for j58 = i + 1 to i + lbLength58 by 1
hCount58 += (l58[j58] < l58[i] ? 1 : 0)
if hCount58 == 2
cbl58 := l58[j58]
break
sig58 = p58 > cbl58 ? 1 : p58 < cbl58 ? -1 : 0
cblColor58 = sig58 > 0 ? color.green : sig58 < 0 ? color.red : color.black
//plot(cbl58, color=cblColor58, linewidth=2)
//////////////////////////////
inp59 = input(title='Source', defval=close)
h59 = f_security(syminfo.tickerid, res66, high, rep66)
l59 = f_security(syminfo.tickerid, res66, low, rep66)
c59 = f_security(syminfo.tickerid, res66, inp59, rep66)
length59 = input.int(title='Length', defval=14, minval=1)
mHigh59 = ta.linreg(h59, length59, 0) - ta.linreg(h59, length59, 1)
mLow59 = ta.linreg(l59, length59, 0) - ta.linreg(l59, length59, 1)
upperBand59 = h59, lowerBand59 = l59
for i = 0 to length59 - 1
currH59 = nz(h59[i])
prevH59 = nz(h59[i - 1])
currL59 = nz(l59[i])
prevL59 = nz(l59[i - 1])
vHigh59 = currH59 + (nz(mHigh59[i]) * i)
vLow59 = currL59 + (nz(mLow59[i]) * i)
upperBand59 := math.max(vHigh59, upperBand59)
lowerBand59 := math.min(vLow59, lowerBand59)
middleBand59 = (upperBand59 + 59) / 2
slo59 = c59 - middleBand59
sig59 = (c59 > upperBand59 and nz(c59[1]) <= nz(upperBand59[1])) or (c59 > lowerBand59 and nz(c59[1]) <= nz(lowerBand59[1]))
? 1 : (c59 < lowerBand59 and nz(c59[1]) >= nz(lowerBand59[1])) or (c59 < upperBand59 and nz(c59[1]) >= nz(upperBand59[1]))
? -1 : slo59 > 0 ? slo59 > nz(slo59[1]) ? 2 : 1 : slo59 < 0 ? slo59 < nz(slo59[1]) ? -2 : -1 : 0
pbColor59 = sig59 > 1 ? color.green : sig59 > 0 ? color.lime : sig59 < -1 ? color.maroon : sig59 < 0 ? color.red : color.black
//plot(upperBand59, title="UpperBand", linewidth=2, color=pbColor59)
//plot(middleBand59, title="MiddleBand", linewidth=1, color=color.white)
//plot(lowerBand59, title="LowerBand", linewidth=2, color=pbColor59)
///////////////////////////////////
length61 = input.int(title='Length', defval=25, minval=1)
h61 = f_security(syminfo.tickerid, res66, high, rep66)
l61 = f_security(syminfo.tickerid, res66, low, rep66)
c61 = f_security(syminfo.tickerid, res66, close, rep66)
hh61 = ta.highest(h61, length61)
ll61 = ta.lowest(l61, length61)
range_161 = hh61 - ll61
sup161 = ll61 - 0.25 * range_161
sup261 = ll61 - 0.5 * range_161
res161 = hh61 + 0.25 * range_161
res261 = hh61 + 0.5 * range_161
mid61 = (sup161 + sup261 + res161 + res261) / 4
sig61 = c61 > mid61 ? 1 : c61 < mid61 ? -1 : 0
psrColor61 = sig61 > 0 ? color.green : sig61 < 0 ? color.red : color.black
//plot(sup161, title='Support1', color=color.new(color.red, 0), linewidth=2)
//plot(sup261, title='Support2', color=color.new(color.red, 0), linewidth=2)
//plot(mid61, title='Middle', color=psrColor61, linewidth=1)
//plot(res161, title='Resistance1', color=color.new(color.green, 0), linewidth=2)
//plot(res261, title='Resistance2', color=color.new(color.green, 0), linewidth=2)
///////////////////////////////////////////////////////////