Relative: Bid price relative to the TRIANGLE object. Whether is it inside a TRIANGLE or not?
|
|
Relative: Bid price relative to the TRIANGLE object. Whether is it inside a TRIANGLE or not? |
|
I can't interpret your 1-3 points. The triangle is not a simple line. For example it can be located in the so far past too. I have to work with the price and with the time too (x, y coordinates).
Solution:
Given three corner points of a triangle, and one more point P. Write a function to check whether P lies within the triangle or not. For example, consider the following program, the function should return true for P(10, 15) and false for P'(30, 15)
Let the coordinates of three corners be (x1, y1), (x2, y2) and (x3, y3). And coordinates of the given point P be (x, y)
1) Calculate area of the given triangle, i.e., area of the triangle ABC in the above diagram. Area A = [ x1(y2 – y3) + x2(y3 – y1) + x3(y1-y2)]/2
2) Calculate area of the triangle PAB. We can use the same formula for this. Let this area be A1.
3) Calculate area of the triangle PBC. Let this area be A2.
4) Calculate area of the triangle PAC. Let this area be A3.
5) If P lies inside the triangle, then A1 + A2 + A3 must be equal to A.
WHRoeder gave the only solution possible.
Bid price only has 1 coordinate, so cannot be used as the coordinates for the corner of a triangle
Bid price only has 1 coordinate, so cannot be used as the coordinates for the corner of a triangle
The time (or number of bars) is the X coordinate.
Oh, I see.
Normally when you refer to Bid price it is the current price which is shown as an horizontal line across the chart.
On historical bars you would usually refer to Open, High, Low and/or Close.
Normally when you refer to Bid price it is the current price which is shown as an horizontal line across the chart.
On historical bars you would usually refer to Open, High, Low and/or Close.
X coordinate: Bars-shift (0 is the last bar, then 1, 2, 3...)
Y coordinate: Price (any price)
Acutla bid price coordinates can be for example: X:0, Y:1.12345

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi Coders,
I would like to know the position of the Bid price relative to the TRIANGLE object. Whether is it inside a TRIANGLE or not?
Do you have a simple idea for it?
Thank you in advance.
Relative