Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- indicator("Circle", overlay=true)
- // Circle radius
- radius = input(50, title="Radius")
- // Circle color
- color_circle = input(color.white, title="Circle Color")
- // Dot color
- color_dot = input(color.yellow, title="Dot Color")
- // Line color
- color_line = input(color.blue , title="Line Color")
- // Calculate circle points
- num_points = 100
- circle_x = array.new_float(num_points)
- circle_y = array.new_float(num_points)
- for i = 0 to num_points-1 do
- angle = i * 2 * math.pi / num_points
- if i % 2 == 0
- circle_x[i] = close[0] + radius * math.cos(angle)
- circle_y[i] = close[0] + radius * math.sin(angle)
- else
- circle_x[i] = open[0] + radius * math.cos(angle)
- circle_y[i] = open[0] + radius * math.sin(angle)
- // Draw the circle
- for i = 0 to num_points-1
- x1 = array.get(circle_x, i)
- y1 = array.get(circle_y, i)
- x2 = array.get(circle_x, (i+1)%num_points)
- y2 = array.get(circle_y, (i+1)%num_points)
- if i % 2 == 0
- color = color_line
- else
- color = color_circle
- line.new(x1 = x1,
- y1 = y1,
- x2 = x2,
- y2 = y2,
- color = color)
Advertisement
Add Comment
Please, Sign In to add comment