Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © jonico
- //@version=5
- indicator('Wave Trend', shorttitle='WT')
- // Input
- src = input(title='Source', defval=hlc3)
- chanlen = input.int(10, title='Channel Length', minval=1)
- avglen = input.int(21, title='Average Length', minval=1)
- smoothing = input.int(4, title='Signal Smoothing', minval=0)
- obupper = input(60, title='Over Bought Upper')
- oblower = input(53, title='Over Bought Lower')
- osupper = input(-53, title='Over Sold Upper')
- oslower = input(-60, title='Over Sold Lower')
- bullColor = #2e8b57
- bearColor = #cd5c5c
- normalColor = #BBBBBB
- // Calculation
- srcEMA = ta.ema(src, chanlen)
- diff = math.abs(src - srcEMA)
- diffEMA = ta.ema(diff, chanlen)
- CI = (src - srcEMA) / (0.015 * diffEMA)
- Fast = ta.ema(CI, avglen)
- Slow = ta.sma(Fast, smoothing)
- // Plot
- cc = Fast > Slow ? bullColor : Fast < Slow ? bearColor : normalColor
- plot(Fast, title='Wave Trend', color=cc, linewidth=2)
- plot(Slow, title='Signal Line', color=color.new(color.silver, 40))
- plot(0, title='zero line', color=color.new(color.white, 80), style=plot.style_cross)
- obLine1 = plot(obupper, display=display.none, editable=false)
- obLine2 = plot(oblower, display=display.none, editable=false)
- fill(obLine1, obLine2, title='Over Bought band', color=color.new(color.red, 90))
- osLine1 = plot(osupper, display=display.none, editable=false)
- osLine2 = plot(oslower, display=display.none, editable=false)
- fill(osLine1, osLine2, title='Over Sold band', color=color.new(color.blue, 90))
Advertisement
Add Comment
Please, Sign In to add comment