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

Re[2]: Can anyone help me fix my circle math?



PureBytes Links

Trading Reference Links

Well Chris in Texas we have round up every spring.  What your round up
is about eludes me.  Hope it works out.

Jimmy



Thanks everyone. You guys never cease to amaze me. Between what has been
posted and what I have received privately, I believe I see a way to do this
correctly now. Requires quite a rewrite  to draw every bar vs. at the end of
the circle, but that is the best way to do it. Quite a pesky problem,
concentric circles at sqrt 2 increments within a fixed square, so not neat
even bar radii.

Thanks again,
Chris
----- Original Message ----- 
From: "Bob Fulks" <bfulks@xxxxxxxxxxxx>
To: "Chris Cheatham" <chris@xxxxxxxxxxxxxxxxxx>; "Omega List"
<omega-list@xxxxxxxxxx>
Cc: "Gary Fritz" <fritz@xxxxxxxx>
Sent: Sunday, February 13, 2005 4:45 PM
Subject: Re: Can anyone help me fix my circle math?


> You guys are making this harder than it should be. :-)
>
>
> In the attached figure (Omega.08) - for a circle we know:
>
>    R^2 = a^2 + y^2
>
> so: y = SQRT(R^2 -a^2)
>
> Since: a + b = R
>
> then:  a = b - R
>
> so: y = SQRT(R^2 - a^2)
>       = SQRT(R^2 - (b - R)^2)
>       = SQRT(R^2 - b^2 + 2*b*R - R^2)
>       = SQRT(    - b^2 + 2*b*R      )
>       = SQRT( 2*b*R - b^2)
>
>       = SQRT( b * (2*R - b))
>
>
> This gives us the height as a function of the horizontal distance "b"
>
> To translate this into TradeStation code:
>
> Let: b = CurrentBar - cpBar - R
>
> where: cpBar is the bar number of the center point.
>
> Add a scale factor to adjust the price scale and you get the code below.
>
> The second picture Omega.09 shows the circle. Inside it is a circle drawn
with the TradeStation drawing tools. They look pretty similar to me...
>
> Bob Fulks
>
> -----------------------------------------------------
>
> Input: R(50), cpBar(250), cpPrice(1200), ScaleFac(1.0);
>
> Var: b(0), y(0);
>
> b = CurrentBar - cpBar + R;
>
> if b >= 0 and b <= 2 * R then begin
>    y = ScaleFac * SquareRoot(b * (2 * R - b));
>    Plot1(cpPrice + y, "Upper");
>    Plot2(cpPrice - y, "Lower");
> end;
>
> ------------------------------------------------------
>