Elder Ray Bull & Bear Power
Elder Ray Index measures the amount of buying and selling pressure in the market. This indicator consists of two separate indicators known as "bull power" and "bear power". These figures allow a trader to determine the position of the price relative to a specified Exponential Moving Average.
Bull Power = Daily High - x period EMA
The higher the value of Bull Power, the stronger the bulls are. Falling Bull Power shows the bulls getting weaker and it can even go negative when the bulls are very weak.
Bear Power = Daily Low - x period EMA
Bear Power values are typically negative and the lower the value the stronger the bears are. If the Bear Power goes positive, that indicates that the bears are completely in control.
On the AMGN chart below, you can see how strong Bull Power was during the runup from late February to early March which also pulled the Bear Power above the zero line. You can see a reversal of the two indicators in mid-March when AMGN dropped below the moving average.
x is the period which must be an integer.
z is the offset. If the offset is 1, the value is from 1 bar ago.
The 13 period Elder Ray Bull Power for the current bar can be written as follows.
H0 - XAVGC13.0
But you can leave off the offset since it is zero.
H - XAVGC13
You can write the 13 period Elder Ray Bear Power for the current bar as follows.
L - XAVGC13
If you wanted to write this for the previous bar instead of the current bar, you would need to add back the offset parameter.
L1 - XAVGC13.1
Read more about Elder's Bull and Bear Power indicators on Investopedia.