Hi all
How would one code the following?
– Angle of moving average > angle of moving average[1]
I wonder if this approach would be interesting to look at combined with relative volume as an entry condition.
Take a look at the topic “vectorial dax”. That could be something for you.
Hi,
If your moving average name is “ma”, its angle being higher than it was at previous candle is equivalent to a bigger vertical step for same horizontal step, which you can store in a boolean variable true=1 or false=0 to use within your code:
risingma = (ma-ma[1]>ma[1]-ma[2])
There are many ways to (try to) define angles:
https://www.prorealcode.com/reply/158329/
Let’s say we want to use (SMA (new) – SMA (old)) / SMA (old)
Sma = average[20,0](close)
Angle = (Sma - Sma[1]) / Sma[1]
If Angle > Angle[1] Then
.
.
Endif
thanked this post
I was writing while JC_Bywan was posting 🙂
this is the code I use, adapted from Balmora’s Vectorial. Similar to above with added trig function
//ANGLE
ONCE Period1 = p1
ONCE Period2 = p2
EMA1 = ExponentialAverage[Period1](close)
slope = (EMA1-EMA1[Period2]) / Period2
ANGLE = (ATAN(slope))
CB1 = ANGLE >= a1
CS1 = ANGLE <= -a2
Do u use this as entrysignal?
in conjunction with other indicators, yes. often it’s more of a filter on a higher TF
ju set P1 and P2 ur self?
Also a1 and -a2?
yes, all variables to be optimized for whatever TF you want to use.
the angle of a 5min MA will obviously be completely different from a 1 hour MA