RicardoSantos

[RS]Donchian Fibonacci Trend Channel V0

EXPERIMENTAL:
Trend Channel Based on Donchian's
Remove from Favorite Scripts Add to Favorite Scripts
study(title='[RS]Donchian Fibonacci Trend Channel V0', overlay=true)
smooth = input(1)
src = ema(input(hl2), smooth)
length = input(10)

f_dcama(_src, _length, _range_multiplier)=>
    _h = na(_h[1]) ? highest(_src, _length) : valuewhen(_src >= highest(_src, _length), _src, 0)
    _l = na(_l[1]) ? lowest(_src, _length) : valuewhen(_src <= lowest(_src, _length), _src, 0)
    _avg = na(_avg[1]) ? _src : avg(_h, _l) + ((_h-_l)*_range_multiplier)

midline = f_dcama(src, length, 0)

u0236 = f_dcama(src, length, 0.118)
u0382 = f_dcama(src, length, 0.264)
u0500 = f_dcama(src, length, 0.500)
l0236 = f_dcama(src, length, -0.118)
l0382 = f_dcama(src, length, -0.264)
l0500 = f_dcama(src, length, -0.500)

plot(midline, color=change(midline)!=0 ? na : black, linewidth=2)
plot(midline, style=circles, color=change(midline)!=0 ? change(midline)<0 ? red : lime : na, linewidth=2, join=true)
plot(u0236, color=change(u0236)!=0?na:navy, linewidth=2)
plot(u0382, color=change(u0382)!=0?na:blue, linewidth=1)
plot(u0500, color=change(u0500)!=0?na:silver, linewidth=2)
plot(l0236, color=change(l0236)!=0?na:navy, linewidth=2)
plot(l0382, color=change(l0382)!=0?na:blue, linewidth=1)
plot(l0500, color=change(l0500)!=0?na:silver, linewidth=2)
Ideas Scripts Chart
United States
United Kingdom
India
España
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 Billing Sign Out