How to read angle of trend line ?

 

When drew trend line by --> ObjectCreate("Trendline",OBJ_TREND,0,Time1,Price1,Time2,Price2) .

What function use to get degree ?


thank you
 
sorasit46:

When drew trend line by --> ObjectCreate("Trendline",OBJ_TREND,0,Time1,Price1,Time2,Price2) .

What function use to get degree ?

Angles make no logical sense when the 2 sides of the triangle are different units . . .
 

Oh! really

Some problem about scale of X & Y Axial.

Thank you

 
sorasit46:

Oh! really

Some problem about scale of X & Y Axial.

You can work with a gradient, that might be logical but not angles . . .
 
sorasit46:

When drew trend line by --> ObjectCreate("Trendline",OBJ_TREND,0,Time1,Price1,Time2,Price2) .

What function use to get degree ?



elevation of the line (in points) may be useful: (price1-price2)/(time1-time2)

(or shift1-shift2 instead of time1-time2)

 
szgy74:

elevation of the line (in points) may be useful: (price1-price2)/(time1-time2)

(or shift1-shift2 instead of time1-time2)

let me join..:J

why shift1 -shift2 instead of time1 -time2 ? the formula of slope is one given by you earlier (price1-price2)/(time1-time2).any good reason?

 
MirTD:

why shift1 -shift2 instead of time1 -time2 ? the formula of slope is one given by you earlier (price1-price2)/(time1-time2).any good reason?


shift1-shift2 would give the difference in points per BAR, which is probably easier to check by the user by looking,

time1-time2 gives the diff in points per SECOND, which is much smaller value, one has to keep in mind that several decimal places are significant.

(I mean one probably has a better idea of the line which elevates 10.4552 points per bar than about the line which elevates 0.00032569308 points per second.)

but in the end the result is the same, you can use any of the formulas.


I found that usually it is good to use more than Digits decimal places (I use 2*Digits) when calculating distant points of the trendline.

With less the decimal places the difference from the real position of the line may be higher when you look far away.

For example 0.00021 points/bar elevation 100 bars later gives 0.02100 points, but 0.0002185123 gives 0.02185 points

 
szgy74:

shift1-shift2 would give the difference in points per BAR, which is probably easier to check by the user by looking,

time1-time2 gives the diff in points per SECOND, which is much smaller value, one has to keep in mind that several decimal places are significant.

(I mean one probably has a better idea of the line which elevates 10.4552 points per bar than about the line which elevates 0.00032569308 points per second.)

but in the end the result is the same, you can use any of the formulas.

I found that usually it is good to use more than Digits decimal places (I use 2*Digits) when calculating distant points of the trendline.

With less the decimal places the difference from the real position of the line may be higher when you look far away.

For example 0.00021 points/bar elevation 100 bars later gives 0.02100 points, but 0.0002185123 gives 0.02185 points


good explaination... :D .One related thought.do you think use of gradient or slope makes any difference as a solution to the problem of finding angles between two line/or trendlines because slope or gradient is basically tangent of an angle?Say we calculate slope or gradient as pips per bar and then zoom in or out: here the value of the

slope or gradient does not changes but to the observer's eye,the angle of lines/or trendline has changes...:D.Visually we can see the trendlines is steep or less steep as we zoom in /out but values of slope as pips per bar does not changes!...seems a paradox!

 

it is not a paradox, you set the x axis and the y axis relative to your point of view. You want the line at 45 degrees to be 45 degrees, so if ten pips up = 1 bar over, increment x axis at 1 pip = 10

example right click on the chart set scale fix 1:1

now x and y axis are equal. 1 pip increment on the y axis = 1 bar incriments on the x axis.

choose 2 points on the line A and B

x,y co-ordinates are price in pips (not point), bar distance.

A = 13450,0

B = 13490, 5

now do

slope = Ay - By / Ax - Bx

angle = arctan(slope)

 
MirTD:

good explaination... :D .One related thought.do you think use of gradient or slope makes any difference as a solution to the problem of finding angles between two line/or trendlines because slope or gradient is basically tangent of an angle?Say we calculate slope or gradient as pips per bar and then zoom in or out: here the value of the

slope or gradient does not changes but to the observer's eye,the angle of lines/or trendline has changes...:D.Visually we can see the trendlines is steep or less steep as we zoom in /out but values of slope as pips per bar does not changes!...seems a paradox!

A gradient, or velocity if you like, can have units related to the 2 dimensions used to calculate it, an angle relies on the 2 dimensions having the same units . . . price and time/bars are not the same unit . . . trying to work out an angle is not logical and is nonsensical. Simple Maths is all that is required to see this . . .
 

It's not nonsense Raptor. It doesnt matter what the x and y axis represent as long as they are numerical. How many pips is equal to 1 bar is arbitrary. Just once you decide on that, set your chart scale to suit and keep it that way. If you decide 1 pip = 1 bar, set your chart scale 1:1 for visual purposes. If you change the scale it will warp the apparent angle of the line, but that does not matter, as long as you are aware that is a visual distortion from reality as you defined it.

Gann realized that when he said "1 unit of price = 1 unit of time". That unit of time is arbitrary. Moving averages work on the concept that time and price can be given an arbitrary corrolation as do trendlines and pretty much every other type of charting tool.

To put it another way if you had been born with a visual distortion that stretched everything vertically in terms of scale you would accept that as reality because that is all you know, and that visual perception would be your defined reality. In other words, in terms of visual perception there is no defined reality until you define what reality is. So if you decide, 1pip = 1 bar, for your own purposes 1 pip does equal 1 bar. Likewise if you decide 10 pips = 1 bar, 10 pips does equal 1 bar. Just set the chart scale accordingly so it matches that visually if you need to see it "how it is". Once you define reality in terms of price:time, you can calculate both the slope and the angle of a line on the chart and it will work logically and programmaticaly and also visually when you set your chart to the same scale as the defined reality, you then define other scales as a distortion.

Reason: