Using DB with BB to predict price trend

Using DB with BB to predict price trend reversal or continuation developing new strategy based on old one indicators.

//version=3
strategy(shorttitle="CTO", title="Chaos to Order", overlay=true)

//Thing to improve : DB is with bad formula, Put fractal dimensional index as condition?
//31.10.2018
//DB Fixed but problem with the parameters when its ploted on true overlay. plot(d) problem not matching the original overlay false parameters.
//20.01.2019
//Still have the problem with the DB overlay parameters, after rescale they appear with no change. Must do manual test
//27.01.2019
//DB formula rescaled and algo created. When yellow lone negatively correlated with price trend, reversal is possible(of the current price trend).
//Indicator easy spot end of retracers trend.
//24.02.2019


//
//////BBands
src = input(ohlc4, title = "source"), len = input(224, title = "timeframe/# of periods"), Multiplier = input(1, minval = 0.01, title = "Multiplier")
e = ema(src,len)
evar = (src - e)*(src - e)
evar2 = (sum(evar,len))/len
std = sqrt(evar2)
upper = e + (Multiplier * std)
lower = e - (Multiplier * std)
//
plot(e, color = aqua, linewidth = 1, title = "AQUA")
p1 = plot(upper, color=green)
p2 = plot(lower, color=red)
fill(p1, p2 ,purple)
//
//////Detrended Breakout
lengthdb = input(100),afterLen = input(34),upHline = input(0.01),lowHline = input(-0.025), xx = input(25), multy= input(2) //best set for eu240
//DEMA
e1 = ema (close, lengthdb)
e2 = ema (e1, lengthdb)
dema = 2 * e1 - e2
//BASE
x = dema
d = x - rma(x,35)
//plot(d,color = red)
//Rescale
z = (d - sma(d,100))/stdev(d,100)
rescale = sma(close,100) + z*stdev(close,100)
plot(rescale, color = yellow)
Volatility

Disclaimer