[RS]Log Channel V0

EXPERIMENTAL: logarithm based channel.
Remove from Favorite Scripts Add to Favorite Scripts
study("[RS]Log Channel V0", overlay=true)
smooth = input(title='ma smooth', type=integer, defval=4)
length = input(title='l', type=integer, defval=6)
src = input(title='src', type=source, defval=hl2)

logc = log(sqrt(src))
lower = sma(close - logc*0.5, smooth)
upper = sma(lower + logc, smooth)
midline = avg(lower,upper)

smooth_upper = upper*0.25 + highest(upper, length)*0.75
smooth_lower = lower*0.25 + lowest(lower, length)*0.75
smooth_midline = avg(smooth_upper, smooth_lower)

plot(midline, color=lime)
plot(lower, style=circles, color=lower == smooth_lower ? na : falling(lower, 1) ? na : lime, linewidth=2)
plot(upper, style=circles, color=upper == smooth_upper ? na : rising(upper, 1)  ? na : red, linewidth=2)

plot(smooth_midline, color=red)
plot(smooth_lower, color=black)
plot(smooth_upper, color=black)


interesting usage :)
Nice work as always.

I know this is perhaps moot but you can use a logarithm property to evaluate logc = log(sqrt(src)) = log((src)^(0.5)) = 0.5 * log(src), since: log(a^b) = b * log(a) rule. That way you do not have to apply sqrt(src) before applying log().

** This is not to be patronizing. Just a flashback to my Numerical Analysis classes from college back in the day of optimizing algorithm calculations, reducing calculation complexity and time.
thx, thats nice to know :p i never attended college, and not a particular focused math person either, so just playing around with it.
tradearcher PRO RicardoSantos
No worries. Hope that helps. I like the visual perspectives that your indicators create. Keep on keeping on. =)
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out