Advertisement
xmd79

Sine Wave with Fear and Greed Indicators and Solfeggio Frequencies

Oct 31st, 2024
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.57 KB | None | 0 0
  1. //@version=5
  2. indicator(title='Sine Wave with Fear and Greed Indicators and Solfeggio Frequencies', overlay=false)
  3.  
  4. // Input parameters for sine waves and MA
  5. base_wave_height = input(100, title='Base Wave Height')
  6. base_wave_frequency = input(1, title='Base Wave Frequency (Cycles)')
  7. harmonic_height = input(30, title='Harmonic Wave Height')
  8. harmonic_frequency = input(2, title='Harmonic Frequency (Cycles)')
  9. ma_length = input(10, title='MA Length for Ribbon')
  10.  
  11. // Solfeggio frequencies and their corresponding wave heights
  12. solfeggio_heights = array.new_float(7, 20) // You can adjust these heights as needed
  13. solfeggio_frequencies = array.new_float(7)
  14. array.set(solfeggio_frequencies, 0, 396)
  15. array.set(solfeggio_frequencies, 1, 417)
  16. array.set(solfeggio_frequencies, 2, 528)
  17. array.set(solfeggio_frequencies, 3, 639)
  18. array.set(solfeggio_frequencies, 4, 741)
  19. array.set(solfeggio_frequencies, 5, 852)
  20. array.set(solfeggio_frequencies, 6, 963)
  21.  
  22. // Function to generate sine wave
  23. f_sine_wave(height, frequency) =>
  24. freq = 2 * math.pi * frequency
  25. height * math.sin(freq * (bar_index / 100)) // Control frequency scaling over time
  26.  
  27. // Main sine wave
  28. main_wave = f_sine_wave(base_wave_height, base_wave_frequency)
  29.  
  30. // Inner harmonic sine waves (representing fear and greed)
  31. inner_harmonic1 = f_sine_wave(harmonic_height, harmonic_frequency)
  32. inner_harmonic2 = f_sine_wave(harmonic_height * 0.5, harmonic_frequency * 1.5) // More subtle harmonic
  33.  
  34. // Calculate Solfeggio frequencies
  35. solfeggio_waves = array.new_float(7)
  36. for i = 0 to 6
  37. freq = array.get(solfeggio_frequencies, i) / 100 // Scale down frequency for visualization
  38. wave = f_sine_wave(array.get(solfeggio_heights, i), freq)
  39. array.set(solfeggio_waves, i, wave)
  40.  
  41. // Create an MA ribbon based on the main wave and harmonics
  42. ma_ribbon = ta.sma(main_wave + inner_harmonic1 + inner_harmonic2, ma_length)
  43.  
  44. // Plotting the main waves and harmonics
  45. plot(main_wave, title='Main Sine Wave', color=color.blue)
  46. plot(inner_harmonic1, title='First Harmonic Wave (Greed)', color=color.green)
  47. plot(inner_harmonic2, title='Second Harmonic Wave (Fear)', color=color.red)
  48.  
  49. // Plotting each Solfeggio frequency wave with fixed titles
  50. plot(array.get(solfeggio_waves, 0), title='Solfeggio Wave 396 Hz', color=color.new(color.purple, 0))
  51. plot(array.get(solfeggio_waves, 1), title='Solfeggio Wave 417 Hz', color=color.new(color.purple, 10))
  52. plot(array.get(solfeggio_waves, 2), title='Solfeggio Wave 528 Hz', color=color.new(color.purple, 20))
  53. plot(array.get(solfeggio_waves, 3), title='Solfeggio Wave 639 Hz', color=color.new(color.purple, 30))
  54. plot(array.get(solfeggio_waves, 4), title='Solfeggio Wave 741 Hz', color=color.new(color.purple, 40))
  55. plot(array.get(solfeggio_waves, 5), title='Solfeggio Wave 852 Hz', color=color.new(color.purple, 50))
  56. plot(array.get(solfeggio_waves, 6), title='Solfeggio Wave 963 Hz', color=color.new(color.purple, 60))
  57.  
  58. plot(ma_ribbon, title='MA Ribbon', color=color.orange, linewidth=2)
  59.  
  60. // Highlight areas of fear and greed
  61. bgcolor(inner_harmonic1 > main_wave ? color.new(color.green, 90) : na, title='Greed Area')
  62. bgcolor(inner_harmonic2 < main_wave ? color.new(color.red, 90) : na, title='Fear Area')
  63.  
  64. // Alerts for significant wave conditions
  65. greed_condition = ta.crossover(inner_harmonic1, main_wave) // Corrected usage for crossover
  66. fear_condition = ta.crossunder(inner_harmonic2, main_wave) // Corrected usage for crossunder
  67. alertcondition(greed_condition, title='Greed Alert', message='Degree of Greed Detected!')
  68. alertcondition(fear_condition, title='Fear Alert', message='Degree of Fear Detected!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement