TradingView
aamonkey
10 de Oct. de 2019 14:07

Moving Average Slope [aamonkey] 

Bitcoin / EuroCoinbase

Descripción

This indicator tries to identify ranging and trending markets.

It measures the angle of a Moving Average in order to filter out ranging markets.

The idea is to only enter a trend following trade if the slope is steep enough.


In order to create this indicator, I used a strategy script from bennef called "Trend Angle BF" and slightly modified it to transform it from an entry/exit indicator to a filter.

The calculations are based on Evergrets "Jurik MA" and angle calculation by KyJ.

Notas de prensa

Thx to @ahancock I removed redundant code

Notas de prensa

Updated picture
Comentarios
dinceremre
Hello there ,
can you please elaborate why do you divide by atr[14] in line 14?
thank you
ang=rad2degree*atan((_src[0] - _src[1])/atr(14))
avirub
@dinceremre, It is really strange, since dividing by ATR does not have any relation to angle calculation..
pgoo
@dinceremre, it allows you to compare apples with apples when looking at different products with different prices. A 0.5° angle on a curve where price is 50000 is a very different RR from a 0.5° angle when price is 1.
pgoo
@dinceremre Ignore previous comment. The division is part of the gradient calculation, rise over run. Rise = ma - ma (1 bar ago) then he's dividing by the 14 bar atr as the 'run'. Moderator please delete previous comment.
bennef
Looks good - I like the idea of being able to adjust the filter lines so you can determine at what steepness you enter.
fck29
Thank you so much my friend for this great indicator. Jut let me ask you a favor, could please add some code to send any alert when the indicator change the color to short or long, i think that would great my friend.
self2point0
hey.great script. thank you. I'm wondering if you can help me with this: trying to create a script to plot teh slope of this McGinley Dynamic... would like it to display green if slope is up, and red if slope is down... I can' seem to get it to work. Here's the script. Thanks in advance for any guidance. cheers:

length = input(100, minval=1)
source = close
mg = 0.0
mg := na(mg[1]) ? ema(source, length) : mg[1] + (source - mg[1]) / (length * pow(source/mg[1], 4))
plot(mg, linewidth=2, color=#2196f3)
mycotoxin
very helpful ..cheers !
aamonkey
@mycotoxin, Glad I can help :D
aamonkey
Más