stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

TMS Osc Cross
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=220
Page 2 of 2
Author:  gaheitman [ Wed Jan 11, 2012 12:56 pm ]
Post subject:  Re: TMS Osc Cross

gaheitman wrote:
mobthehop wrote:Guys.... :oops: embarrased mmmhhhhh....

Well, the way I use this indicator and cross signal, which might NOT be as it was intended:

1. As per image posted by George, the cross happens at a value <32
Yep, the intersection of the two lines occurs below 32, but we can't read that value since it is between candles. We see the two values before and the two values after. We can tell they cross since on the last bar the red line was above the green line and that is now reversed on the new bar.

That's why I wanted to know which of the readable values you wanted below 32.
OK, since we are a full service forum ( :lol: ) I added code to calculate the y-intercept of the two line segments so that we can get the actual level of the cross. The code now looks for this and should work as expected.

For the curious:

Code: Select all

//Calculate the point of intersection between two line segments on adjacent candles - gah
//Line Segment 1: (x1,y1), (x2,y2)
//Line Segment 2: (x3,y3), (x4,y4)
//from http://paulbourke.net/geometry/lineline2d/
//Used general case formula for illustrative purposes, despite assumption that
//   x1 and x3 are at the origin, and x2 and x4 are at 1
double CalcYIntersection(double y1,double y2,double y3,double y4) {

   double ua = ((1 - 0)*(y1 - y3) - (y4 - y3)*(0 - 0)) /
                ((y4 - y3)*(1 - 0) - (1 - 0)*(y2 - y1));
   
   return(y1 + ua*(y2-y1));
}
To get the level of the cross, you call the function passing the Y coordinates only.

Enjoy.

George
Author:  mobthehop [ Wed Jan 11, 2012 2:33 pm ]
Post subject:  Re: TMS Osc Cross

Ahhh... :idea: now I understand - I would consider the green line the "fast" one and the "red" the slow one, so on cross up of green below 32, the red value should be below 32 and above 68 when green crosses down from above....

Will stick it on tomorrow - too late for me now

As usual, your method is much, much more elegant - really appreciated....

I have one more crazy request in another matter - could I bother you one more time around Friday?
Author:  mobthehop [ Thu Jan 12, 2012 12:49 am ]
Post subject:  Re: TMS Osc Cross

Hi George..... sorry - no dice.... Seems it doesn't filter on thresholds, just indicates all crosses - see screenshot. Eyeballing TDi at bottom, there should only be two relevant crosses as indicated by red vertical lines

Cheers
Author:  gaheitman [ Thu Jan 12, 2012 1:44 am ]
Post subject:  Re: TMS Osc Cross

mobthehop wrote:Hi George..... sorry - no dice.... Seems it doesn't filter on thresholds, just indicates all crosses - see screenshot. Eyeballing TDi at bottom, there should only be two relevant crosses as indicated by red vertical lines

Cheers
Yep, those are the ones I have on mine.
pic_01 2012-01-11 20.40.gif
Did you get the correct one on the chart, I didn't change the name (probably should have).

George
Author:  mobthehop [ Thu Jan 12, 2012 2:21 am ]
Post subject:  Re: TMS Osc Cross

George,

Downloaded again & put it on another demo account - it works - apologies

I have added the proper version # & updated the blurb in the header - please read & approve

Do you mind if I post this back over at FF - I believe other people find it helpful

Thanks a million to you and rbetancor

Mob
Author:  gaheitman [ Thu Jan 12, 2012 8:05 am ]
Post subject:  Re: TMS Osc Cross

mobthehop wrote:George,

Downloaded again & put it on another demo account - it works - apologies

I have added the proper version # & updated the blurb in the header - please read & approve

Do you mind if I post this back over at FF - I believe other people find it helpful

Thanks a million to you and rbetancor

Mob
Sure, that's fine with me.

I hope it helps in your trading.

George
All times are UTC Page 2 of 2