The Elder Ray Index for Trading

Coding the Elder Ray Index in Python

Sofien Kaabar, CFA
5 min readJan 13, 2023


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.

I have released a new book after the success of my previous one “Trend Following Strategies in Python”. It features advanced contrarian indicators and strategies with a GitHub page dedicated to the continuously updated code. If you feel that this interests you, feel free to visit the below Amazon link (which contains a sample), or if you prefer to buy the PDF version, you could check the link at the end of the 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…