How to get the angle of a moving average?
Greetingz,
Koen.
MT can supply Angle function based on screen pixels (trans from two values and two times coodinates).
Since Angle is more good for people to watch.
Like:
MathArctan(MathTan(
((price1-price2)/(WindowPriceMax()- WindowPriceMin()))
/
((shift2-shift1)/WindowBarsPerChart())
))
*180/3.14
I completely agree with you. Angles matter and they are used all the time.
I'm interested in the formula you posted. I've been getting the angle with the following formula:
(((MathArctan(line_slope/100))*(180/3.14159))*angle_factor);
Slope is calculated in another function. Angle_factor controls for the format of the yen. Anyway, it gets close but it's still not right.
When I put your formula instead, I get a divide by zero error in the strategy tester. Is this because the window functions don't work within the tester or did I do something wrong?
Peace.
Special Features of Optimization Process
|
MathArctan(MathTan(
((price1-price2)/(WindowPriceMax()- WindowPriceMin()))
/
((shift2-shift1)/WindowBarsPerChart())
))
*180/3.14
divide by zero error ? check (shift2-shift1) should not equal ZERO before calculating.
I test them on newest version 203.
I do not test them when testing EA.
I want to give you my deepest appreciation for the formula you shared. I didn't respond earlier because I had to finish getting my EA together. Works like a charm.
Peace and goodwill.--The Wheel of Fire
How can I get the angle of a moving average which is plotted on a chart?
For example: I have 2 to 3 moving averages plotted on my charts. Based on the angle (f.e. 60 degrees) I have an indicator on how strong the current uptrend is.
Should I calculate the angle myself, based on the MA-values of the f.e. last 10 candles, or should I use the ObjectGet()-function? I tried the latter, but you have to specify a name, and since all my MA's have the same name (and I don't see how I can change them), there's nothing coming out ... (they're actually the same MA's, but based on close, high and low prices).
Any help would be very much appreciated! Thanks in advance.
Greetingz,
Koen.