Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- indicator("Circle Plot", overlay=true)
- // Define constants
- pi = 3.14159
- // Calculate number of points on the unit circle
- numPoints = 360
- // Initialize arrays to store x and y coordinates
- var float[] circle_x = array.new_float(numPoints, na)
- var float[] circle_y = array.new_float(numPoints, na)
- // Calculate x and y coordinates of the unit circle
- for i = 0 to numPoints - 1
- angle = 2 * pi * i / numPoints
- array.set(circle_x, i, close + math.cos(angle))
- array.set(circle_y, i, close + math.sin(angle))
- // Plotting the circle
- plot(array.get(circle_x, bar_index % numPoints), "Circle X", color=color.blue, linewidth=2)
- plot(array.get(circle_y, bar_index % numPoints), "Circle Y", color=color.red, linewidth=2)
Advertisement
Add Comment
Please, Sign In to add comment