RicardoSantos

[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)
tradearcher PRO
2 years ago
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.
Reply
RicardoSantos PRO tradearcher
2 years ago
thx, thats nice to know :p i never attended college, and not a particular focused math person either, so just playing around with it.
Reply
tradearcher PRO RicardoSantos
2 years ago
No worries. Hope that helps. I like the visual perspectives that your indicators create. Keep on keeping on. =)
Reply
snapshot

snapshot

interesting usage :)
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
France
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out