[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can anyone help me fix my circle math?



PureBytes Links

Trading Reference Links

I am stuck on a problem with circle drawing code. The following is pretty
close, but is slightly off, slightly smaller at 45* points than it should
be. There are probably better ways to draw circles, but this application
involves concentic circles at non-exact bar increments drawn in arrears at
lastbaronchart, and so this index concept gets the point right and the
centers in the right place which is crucial. I came up with this by dabbling
until it looked about right, but not quite I guess.

Anyone see something that might be wrong?
Thanks,

Chris
---------------------------------------------------------------------------
//idx is index that ranges 0-1 for bars in circle
//centerprice is the price midpoint
//radius = radius vertical at highest point

value3=sine(idx*180);
if value3>0 then begin
  plot1(centerprice+radius*squareroot(value3));  //top half
  plot2(centerprice-radius*squareroot(value3));  //bottom half
end;