قوس های فیبوناچی را بکشید

ساخت وبلاگ

من در حال تلاش برای ایجاد برنامه ای هستم که قوس های فیبوناچی مشابه اینها را ترسیم می کند.Stock Chart Fibonacci Arcs However, I'd like full circles instead of arcs, and I'd like to draw more than the three Fibonacci lines shown in the picture. I've created an application using JFreeChart to attempt to accomplish this. However, here is the result when trying to draw the same arcs (but as circles) shown in the previous picture. My app zoomed in Initially, it just looks wrong, but when I zoom out, it is indeed a circle, but it's way too big. enter image description here To calculate the arcs, you draw a line, then take a Fibonacci ratio - let's use .381 for example - the percentage of that line. If you look at the first picture, you'll see the innermost arc intersects the line at .381% the distance of the line from the centre of the circle. First I calculate this point. Then I construct a line from the .381% point to the centre. Then I take the distance of this line, which should be the radius. Then I use this radius to draw the circle. Here's the code to calculate the radius. Where stop and start are the stop and start points of the line drawn.

multiplier = نسبت 38Value + i ؛diffx = (stop. getx () - start. getx ()) * ضرب ؛diffy = (stop. gety () - start. gety ()) * ضرب ؛xValue = start. getx () + diffx ؛yvalue = start. gety () + diffy ؛نقطه = نقطه جدید (XValue ، Yvalue) ؛linesegment = خط جدید (نقطه ، توقف) ؛radius = linesegment. getDistance () ؛دایره = دایره جدید (stop. getx () ، stop. gety () ، شعاع) ؛circles. add (دایره) ؛ 

در اینجا کد برای محاسبه فاصله یک خط آورده شده است

عمومی Double GetDistance ()

من لیستی از اشیاء دایره ای را برمی گردانم (این شیئی است که من ایجاد کردم که شعاع و مرکز را در خود جای داده است) برای هر دایره ای که باید ترسیم شود و سپس آنها را ترسیم کنید.

لیست حلقه ها = fibonaccicalculations. getFibonAcciarcs (startpoint ، نقطه پایانی) ؛if (دایره! = تهی)> 

من فکر می کنم این مسئله ارتباطی با چگونگی محور x زمان و محور y قیمت دارد که دقیقاً ارتباط ندارد. منظور من این است که اگر شعاع 20 باشد ، در هر نقطه 20 واحد از مرکز دور خواهید شد. بنابراین بگویید که قیمت سهام فقط 5 دلار است ، در پایین ترین نقطه شما د ر-15 خواهید بود. اگر اینگونه باشد ، من نمی دانم چگونه آن را برطرف کنم. اما همچنین می تواند در منطق من خطایی باشد. از هر ایده ای استقبال می شود. ویرایش: در حالی که میله ها به نظر می رسد که ممکن است در اولین تصویر میله های هفتگی باشند ، در واقع میله های روزانه هستند. همچنین ، من قبلاً مختصات را از فضای داده به مختصات x y تبدیل کرده ام. من برای انجام این کار از این کد زیر استفاده می کنم.

Override Public void ChartMousemoved (رویداد ChartMouseeEvent) 
فارکس را از کجا شروع کنیم...
ما را در سایت فارکس را از کجا شروع کنیم دنبال می کنید

برچسب : نویسنده : لیما اصغرپورسازونی بازدید : 33 تاريخ : دوشنبه 2 مرداد 1402 ساعت: 21:42