xmd79

sinusoidal_hpf

Dec 24th, 2022
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © peacefulLizard50262
  3.  
  4. //@version=5
  5. indicator("sinusoidal_hpf")
  6. sinusoidal_hpf(_series, _period, _phase_shift) =>
  7. ma = 0.0
  8. for i = 0 to _period - 1
  9. weight = math.sin(i * 2 * math.pi / _period + _phase_shift * math.pi / 180)
  10. ma := ma + weight * _series[i]
  11. ma / _period
  12.  
  13. source = input.source(close, "Source")
  14. length = input.int(10, "Length", 1)
  15. shift = input.float(0, "Phase Shift", 0, 360, 0.5)
  16.  
  17. plot(sinusoidal_hpf(source, length, shift), "Sinusoidal High Pass Filter", color.new(color.purple, 10))
  18. plot(0, "0", color.silver)
Advertisement
Add Comment
Please, Sign In to add comment