Advertisement
xmd79

Bull/Bear Levels

Aug 9th, 2023
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. //@version=5
  2. indicator("Bull/Bear Levels", shorttitle="LVLS", overlay=true)
  3.  
  4. // Input for each horizontal line value
  5. var line1_value = input.float(0.00, title="Inflection Point")
  6. var line2_value = input.float(0.00, title="Bull 1")
  7. var line3_value = input.float(0.00, title="Bull 2")
  8. var line4_value = input.float(0.00, title="Bull 3")
  9. var line5_value = input.float(0.00, title="Bear 1")
  10. var line6_value = input.float(0.00, title="Bear 2")
  11. var line7_value = input.float(0.00, title="Bear 3")
  12.  
  13. // Line properties
  14. var line_width = input.int(4, title="Line Width")
  15. var yellow_color = color.yellow // Yellow color
  16. var bright_red_color = color.rgb(255, 0, 0) // Bright red color
  17. var bright_green_color = color.rgb(0, 255, 0) // Bright green color
  18.  
  19. // Plotting the horizontal lines using the plot function
  20. plot(line1_value, title="Line 1", color=yellow_color, linewidth=line_width)
  21. plot(line2_value, title="Line 2", color=bright_red_color, linewidth=line_width)
  22. plot(line3_value, title="Line 3", color=bright_red_color, linewidth=line_width)
  23. plot(line4_value, title="Line 4", color=bright_red_color, linewidth=line_width)
  24. plot(line5_value, title="Line 5", color=bright_green_color, linewidth=line_width)
  25. plot(line6_value, title="Line 6", color=bright_green_color, linewidth=line_width)
  26. plot(line7_value, title="Line 7", color=bright_green_color, linewidth=line_width)
  27.  
  28. // Extending the lines into the future by 500 bars using line.new
  29. var extendedBars = 500 // Number of bars to extend the lines
  30. line.new(x1=bar_index, y1=line1_value, x2=bar_index + extendedBars, y2=line1_value, color=yellow_color, width=line_width)
  31. line.new(x1=bar_index, y1=line2_value, x2=bar_index + extendedBars, y2=line2_value, color=bright_red_color, width=line_width)
  32. line.new(x1=bar_index, y1=line3_value, x2=bar_index + extendedBars, y2=line3_value, color=bright_red_color, width=line_width)
  33. line.new(x1=bar_index, y1=line4_value, x2=bar_index + extendedBars, y2=line4_value, color=bright_red_color, width=line_width)
  34. line.new(x1=bar_index, y1=line5_value, x2=bar_index + extendedBars, y2=line5_value, color=bright_green_color, width=line_width)
  35. line.new(x1=bar_index, y1=line6_value, x2=bar_index + extendedBars, y2=line6_value, color=bright_green_color, width=line_width)
  36. line.new(x1=bar_index, y1=line7_value, x2=bar_index + extendedBars, y2=line7_value, color=bright_green_color, width=line_width)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement