Is there some way to use ChartControl or DrawObjects to see the Y positions where the upper and lower portion of one of the Fib circles is for the current bar ?
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Get Y Values of Fibonacci Circle at Current Bar
Collapse
X
-
Get Y Values of Fibonacci Circle at Current Bar
I have a Fibonacci Circle that I've created inside an Indicator, and I would like to get Y values of one of the circles (upper and lower) at the current bar.
Is there some way to use ChartControl or DrawObjects to see the Y positions where the upper and lower portion of one of the Fib circles is for the current bar ?Tags: None
-
Hello ,
Thanks for your note.
While this method is unsupported, it is possible to get position values of drawing objects.
Please take a look at how the LineAlert indicator is able to accomplish this.
http://www.ninjatrader.com/support/f...atid=4&lpage=1Chelsea B.NinjaTrader Customer Service
-
Thanks for this info. This code uses the slope of a (straight) line to do the calculation.
The Fibonacci circle(s) are not straight lines, so I don't think this technique will work for them.
Is there some other way ? Maybe somehow looking into the screen graphics to see where there are points/lines painted above/below the current bar ?
Comment
-
Hello,
The indicator calculates the slope using the end points. I was making the assumption you were trying to get the end points.
This indicator calculates the slope so that it can tell if the price has crossed a line. The only way to tell is to have the slope to calculate values on the line and see if the price is higher or lower.
Below is a link to the IFibonacciCircle object in the help guide. This lists all of the information you can gather from the object, such as StartY and EndY (the end points).
http://www.ninjatrader.com/support/h...accicircle.htm
Please let me know if you are not looking for the end points of the fibonacci object.Chelsea B.NinjaTrader Customer Service
Comment
-
Hi ChelseaB,
Unfortunately I am not looking for the end points of the Fibonacci Circle. What I am trying to do is to see if a bar has crossed through one (or more) of the Fibonacci circles for each bar going forward after I have created the circle.
So say for example, I've created a (set of) Fibonacci Circle(s) at the low of bar 100. When bar 101 (or 102, 103, etc...) completes, I would like to be able to check if the bar has crossed through one of the Fibonacci circles (at 38.20%, or 61.80%, etc...). In order to do that, I (think I) need to be able to get the Y coordinate of where a given Fibonacci circle (like the 38.20% circle) passes above and/or below the bar that just completed. If I have the Y coordinate I can convert this to a price to compare to the OHLC of the bar that just completed.
I'm not aware of any way to do this with a mathematical calculation (if anyone knows of one, please reply :-), so I was thinking that maybe there is a way to "see" where the circle has been rendered on the screen (by looking into the graphics array ?).
Comment
-
Hello,
What you are trying to accomplish sounds pretty advanced.
Below is a link to a website that has information about graphing circles that may be helpful.
http://www.mathwarehouse.com/geometr...f-a-circle.php
Using this and the end point values (start bars ago, end bars ago, start y, end y) you should be able to calculate if a point is within the circle.Chelsea B.NinjaTrader Customer Service
Comment
-
Hey BAltman,
Here are the steps:
1) Find the current price coordinate by converting the current time and price to drawing coordinates (x and y).
2) Find the radius and the x,y center of the fibonacci circle in drawing coordinates
3) Use the distance formula to figure out if the price coordinate is inside or outside the fibonacci circle (i.e. calculate the radius from the center of the fibonacci circle and see if it is <, >, or = to the fibonacci circle radius.
Here ive provided the functions to get the drawing coordinates of the start point (center of the fib circle) and the end point. The radius is simply sqrt((y2-y1)^2+(x2-x1)^2).
Remember, drawing coordinates are (0,0) at the top left, and the x increases positively to the right, and the y increases positively to the bottom. The x axis is on the top of the chart, and the y axis is at the left.
EDIIT: ok, i think drawing coordinates are actually normal coordinates, nvm. im not sure, it probably doesnt matter anyways
To convert price and time to drawing coordinates, use the functions GetXByTime and GetYByValue (these are used in the code i provide).
Step 3 is using the distancen formula from the start point to the point in step 2.
Let me know if you have any questions, just copy the code into your project
.Attached FilesLast edited by Starry; 08-16-2013, 09:32 AM.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Change colour of Stop market and limit orders to red and green via indicator script
by Rapine Heihei
Started by Rapine Heihei, 04-23-2024, 07:51 PM
|
2 responses
30 views
0 likes
|
Last Post
by Max238
Today, 02:25 AM
|
||
Started by Shansen, 08-30-2019, 10:18 PM
|
24 responses
943 views
0 likes
|
Last Post
by spwizard
Today, 01:29 AM
|
||
Started by Max238, Today, 01:28 AM
|
0 responses
9 views
0 likes
|
Last Post
by Max238
Today, 01:28 AM
|
||
Started by rocketman7, Today, 01:00 AM
|
0 responses
5 views
0 likes
|
Last Post
by rocketman7
Today, 01:00 AM
|
||
Started by wzgy0920, 04-20-2024, 06:09 PM
|
2 responses
28 views
0 likes
|
Last Post
by wzgy0920
Yesterday, 10:43 PM
|
Comment