I’d like to be able to calculate the angle (linear regression?) of any line i.e. a moving average, a standard deviation
For example.. if the angle of the Average[500] reaches X degrees positive/negative then buy/sell (means: don’t trade when it’s flat)
What is the best way to calculate/code that?
Regards
Steve
IMO it’s useless since angle degree depends of the height/width of your chart/computer screen. You’d better look at price percentage change over x periods, I think it’s more accurate 🙂
Just browsing the forum as i noticed this post… as i’m using ema-trend as a trade filter, i’m happy to share a guite simple code:
if tradeema[1]>tradeema and tradeema[2]>tradeema[1]then
ematrend = -1
endif
if tradeema[1]<tradeema and tradeema[2]< tradeema[1]then
ematrend = 1
endif
this simply compares if the tradeema rises or falls within the last 2 bars.
you could also check if the difference of tradeema[2] & tradeema[1] if positive but smaller than the diff of tradeema[1] and tradeema -> which would mean it’s getting steeper.
getting a angle value is useless imho as there’s the need for a absolute x & y scale. but based on the difference you could use a treshold value to check if the slope is steep enough…
Brgds, Martin.