The Elder Ray Index for Trading

Coding the Elder Ray Index in Python

Sofien Kaabar, CFA
4 min readMay 27

--

Trend following requires understanding the current market state in order to be on the right side. This article discusses the Elder Ray index, a popular trend following technical indicator.

The Fibonacci Trading Book is finally out! Filled with Fibonacci-based trading methods (tools, indicators, patterns, and strategies), this book will guide you through improving your trading and analysis by incorporating an important technical analysis approach that is Fibonacci [PDF Version available, see end of article).

Intuition and Calculation of the Elder Ray Index

Developed by Dr. Alexander Elder, the Elder Ray index is a trend following system that seeks to determine buy signals in an uptrend and sell signals in a downtrend.

The intuition of the index is quite simple and its formula is even simpler. Whenever the market is in a bullish trend, its highs are more likely greater than its short-term moving average (in a strong bullish market, even the lows are greater than the short-term moving average). Whenever the market is in a bearish trend, its lows are more likely lower than its short-term moving average (in a strong bearish market, even the highs are lower than the short-term moving average).

The Elder Ray index is composed of two indicators, the Bull Power and the Bear Power. These are calculated on a separate panel from the market price. The original lookback period used for the exponential moving average is 13. The formula is therefore as follows:

Next up, we’re going to see how to code this simple indicator in Python.

Coding the Elder Ray Index in Python

The required functions for this job are the function to add and remove columns, the moving average function, and the exponential moving average function.

import numpy as np

def ma(data, lookback, close, position)…

--

--

Sofien Kaabar, CFA

Top writer in Finance, Investing, Business | Trader & Author

Recommended from Medium

Lists

See more recommendations