Intersection of 3 rays - NinjaTrader Programming | futures io social day trading
futures io futures trading


Intersection of 3 rays
Updated: Views / Replies:806 / 5
Created: by stockgoblin Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Intersection of 3 rays

  #1 (permalink)
Trading Apprentice
Canaduh
 
Futures Experience: Intermediate
Platform: ninja
Broker/Data: TD Waterhouse / kinetick
Favorite Futures: spx.xo
 
Posts: 23 since Aug 2011
Thanks: 3 given, 3 received

Intersection of 3 rays

Hi,

I have a custom indicator that draws rays from highs and lows and I would like to have another indicator that shows me when three rays intersect perfectly. Sometimes it looks like they do visually but they don't so an indicator would be helpful. I wrote an excel program to do this and used the slopes and y-intercepts to calculate the intersections and then checked all the three line combinations for a match. I assume I'll have to approach this problem differently as a ninjatrader custom indicator?

First: Do you think this is possible to achieve?

Second: Any ideas on how to approach this?

I was thinking of an "if the y values of rays are equal at certain bars" but the intersections hardly ever occur at exact bar x values. Hmmmm....


Thanks for any suggestions.

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
The fun is in the numbers
Point Roberts, WA, USA
 
Futures Experience: Advanced
Platform: IB and free NT
Broker/Data: IB
Favorite Futures: ES
 
aquarian1's Avatar
 
Posts: 3,235 since Dec 2010
Thanks: 1,163 given, 1,748 received
Forum Reputation: Legendary


An interesting question.

If you have two lines that intersect (i'll get to 3 in a minute) then you would compute the intersection as the simultaneous solution of two linear equations: So y=mx+B and z=nx+C .

An example with a downward sloping line from Peak A and an upward sloping line from trough B:

Peak A= 1342 at 17:11 June 10, 2012 and the ray from peak A is downward sloping at -0.02 per minute.
So m=-0.02 and B=1342
Setting midnight of 10 June 2012 = minute zero, then the start time of your ray is 17*60+11 or minute 1031.

So Ray1 draws downward from 1342 at a slope of -0.02, starting from a peak at minute 1031 then it would be:
y=-0.02 * (x-1031) +1342. ; where x is in minutes and y in points.

So at 8:30am on June 11, 2012 minute is 1440+8*60+30 or 1950:
y=-0.02 * (1950-1031) +1342
y= -0.02 * 919 +1342
y= -18.38 + 1342
y=1323.62


Trough B = 1299.75 at 6:43 June 11, 2012 (or minute 1440+6*60+43 or 1843) and the ray is ascending at +0.01 points per minute. so n=+0.01 and C=1299.75. It's equation is :
z=+0.01 * (x-1843) + 1299.75

We are solving for x such the y=x ie the point level (price is the same)
y=-0.02 * (x-1031) + 1342.00 (eq1)
z=+0.01 * (x-1843) + 1299.75 (eq2)

y=z so;
0=y-z (eq3)

0=-0.02 * (x-1031) + 1342 +0.01 * (x-1843) + 1299.75
0.03x=81.30
x=81.30 / 0.03 (eq4)
x=2710

The lines cross at minute 2710 (=June 11, 2012 at 21:10)


Checking minute 2710
y=-0.02 * (x-1031) +1342
y=-0.02 * (2710-1031) +1342 = 1308.42

z=+0.01 * (x-1843) + 1299.75
z=+0.01 * (2710-1843) + 1299.75 = 1308.42

------ so at this point you would go back to (eq4) and write the generalized form of the solution and that would give you the time a value where your two rays crossed = intersection1
So you would plot a marker at 1308.42 at 21:10 on June 11 ( and perhaps text as well? "lines cross at 1308.42 at 21:10 June 11, 2012"

------------------re 3 points---------
A straight line can only cross another at one point and one point only.

Now you can see that odds are unlikely that Ray3 actually crosses Ray1 and Ray 2 at exactly intersection1, it might look like it but it is probably only close. This would be a perfect triangulation. The slope of Ray3 HAS TO BE an exact slope and only one slope for the starting point of Ray3 for Ray3 to cross at intersection 1. Ray3 is redundant - that is Ray3, (or Ray4 Ray5 Ray6 for that matter) do not change the intersection point of Ray1 and Ray2.

Using the same approach as above you can compute where Ray3 meets Ray1 = Intersection2. Then you can repeat and find out where Ray3 meets Ray2 = Intersection3.

Probably you will get three intersection points - perhaps close forming a tiny triangle.

So if you are using this for trading then you could probably average the three points or since all the points have to be very close for you to see them as crossing at the same point - OR just ignore Ray3 and Intersection2 and interection3. It isn't changing Intersection Point1.

I hope this helps

Keep your mind in the future, in the now.

Last edited by aquarian1; June 17th, 2012 at 01:35 AM.
Reply With Quote
 
  #4 (permalink)
The fun is in the numbers
Point Roberts, WA, USA
 
Futures Experience: Advanced
Platform: IB and free NT
Broker/Data: IB
Favorite Futures: ES
 
aquarian1's Avatar
 
Posts: 3,235 since Dec 2010
Thanks: 1,163 given, 1,748 received
Forum Reputation: Legendary

On the generalized form of the equation you go back and put in the letters (the variables).

I'm a bit brain dead at the moment so if someone else reads this perhaps they can do that for this gentleman.

Keep your mind in the future, in the now.
Reply With Quote
 
  #5 (permalink)
The fun is in the numbers
Point Roberts, WA, USA
 
Futures Experience: Advanced
Platform: IB and free NT
Broker/Data: IB
Favorite Futures: ES
 
aquarian1's Avatar
 
Posts: 3,235 since Dec 2010
Thanks: 1,163 given, 1,748 received
Forum Reputation: Legendary

You also have to decide what to do for times it doesn't trade so for ES
15:15 to 15:50 Mon-tues
and
15:15 to 17:00 Sunday for Friday.

Keep your mind in the future, in the now.
Reply With Quote
 
  #6 (permalink)
The fun is in the numbers
Point Roberts, WA, USA
 
Futures Experience: Advanced
Platform: IB and free NT
Broker/Data: IB
Favorite Futures: ES
 
aquarian1's Avatar
 
Posts: 3,235 since Dec 2010
Thanks: 1,163 given, 1,748 received
Forum Reputation: Legendary

IF you only want to know the intersection after it happens you can just test for a reversal. So in the example above the decending ray is greater than the ascending ray until they cross and then it is less.

Keep your mind in the future, in the now.
Reply With Quote

Reply



futures io > > > > > Intersection of 3 rays

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Swing Rays for ThinkOrSwim?? Vikings1 ThinkOrSwim 1 November 19th, 2011 02:49 PM


All times are GMT -4. The time now is 02:37 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-12 in 0.09 seconds with 19 queries on phoenix via your IP 54.90.207.75