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)
snapshot

snapshot

interesting usage :)
Reply
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
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
No worries. Hope that helps. I like the visual perspectives that your indicators create. Keep on keeping on. =)
Reply
United States
United Kingdom
India
Deutschland
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
Malaysia
日本
한국
简体
繁體
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 Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing Priority Support Ideas Published Followers Following Private Messages Chat Sign Out