zhaopinxinle.com

Unlocking the Aroon Oscillator: Coding and Trading Insights

Written on

Chapter 1: Introduction to the Aroon Oscillator

The Aroon Oscillator is a significant tool in trend-following strategies, which are essential for traders looking to capitalize on market movements. While many popular indicators are effective in tracking trends, they often exhibit delays due to the necessary confirmation of new trends. Thus, these strategies focus more on being present in the market rather than timing it perfectly. This article delves into the widely used Aroon Oscillator, including coding practices and trading applications.

I recently published a new book following the success of my previous work. This new edition offers advanced trend-following indicators and strategies, complete with a dedicated GitHub page for ongoing updates to the code. Additionally, the book is designed with optimized colors for printing costs. If this piques your interest, feel free to check the link below for Amazon, or reach out to me on LinkedIn if you prefer a PDF version.

Chapter 2: Creating the Aroon Oscillator

The Aroon Oscillator consists of two components: Aroon Up and Aroon Down. These components evaluate the strength of trends by analyzing recent highs and lows in a unique manner, distinguishing them from traditional indicators.

To begin, the calculations for Aroon Up and Aroon Down can be expressed mathematically. For example, consider an asset that reached a new low in the last period. For a 25-period Aroon Down, the calculation yields a value of 96. This is derived by subtracting 1 from 25, dividing by 25, and then multiplying by 100. In contrast, for a 13-period Aroon Up, if the asset hit a new high one period ago, the Aroon Up value would be 92.30. A higher Aroon value indicates a stronger trend.

Now, let's implement the Aroon calculations in Python:

def aroon(Data, period, close, where):

# Adding Columns

Data = adder(Data, 10)

# Max Highs

for i in range(len(Data)):

try:

Data[i, where] = max(Data[i - period + 1:i + 1, 1])

except ValueError:

pass

# Max Lows

for i in range(len(Data)):

try:

Data[i, where + 1] = min(Data[i - period + 1:i + 1, 2])

except ValueError:

pass

# Highs and Lows Comparison

for i in range(len(Data)):

if Data[i, 1] == Data[i, where]:

Data[i, where + 2] = 1

for i in range(len(Data)):

if Data[i, 2] == Data[i, where + 1]:

Data[i, where + 3] = 1

# Jumping Rows

Data = jump(Data, period)

# Aroon Up Calculation

for i in range(len(Data)):

try:

x = max(Data[i - period:i, 1])

y = np.where(Data[i - period:i, 1] == x)

distance = period - y

Data[i - 1, where + 4] = 100 * ((period - distance) / period)

except (ValueError, IndexError):

pass

# Aroon Down Calculation

for i in range(len(Data)):

try:

x = min(Data[i - period:i, 2])

y = np.where(Data[i - period:i, 2] == x)

distance = period - y

Data[i - 1, where + 5] = 100 * ((period - distance) / period)

except (ValueError, IndexError):

pass

# Cleaning

Data = deleter(Data, 5, 4)

return Data

Here, we examine the EURUSD chart showcasing the Aroon Up in blue and Aroon Down in orange. The final step is to compute the Aroon Oscillator, which is the difference between Aroon Up and Aroon Down:

my_data[:, where_aroon_osc] = my_data[:, where_aroon_up] - my_data[:, where_aroon_down]

The Aroon Oscillator, developed by Tushar Chande, is a renowned trend-following indicator, and it's interesting to note that "Aroon" translates to "dawn's early light" in Sanskrit.

The first video titled "Aroon Oscillator Calculation, Programming in Python, and Graphing in Matplotlib" provides a visual guide on implementing this indicator in Python.

Chapter 3: Trading with the Aroon Oscillator

To effectively trade using the Aroon Oscillator, the flip technique is applied, whereby the oscillator's value transitions from positive to negative or vice versa. Specifically, the trading conditions are as follows:

  • Buy (Long position): When the Aroon Oscillator exceeds the zero line.
  • Sell (Short position): When the Aroon Oscillator dips below the zero line.

Here's the code for generating trading signals:

def signal(Data, aroon_osc_col, buy, sell):

Data = adder(Data, 10)

for i in range(len(Data)):

if Data[i, aroon_osc_col] > 0 and Data[i - 1, aroon_osc_col] < 0:

Data[i, buy] = 1

elif Data[i, aroon_osc_col] < 0 and Data[i - 1, aroon_osc_col] > 0:

Data[i, sell] = -1

return Data

The signal chart illustrates that lag can often be a significant drawback for trend-following strategies. Adjusting the lookback period, refining conditions, adding filters, or altering the strategy can help mitigate this issue.

The second video titled "Python: Programming The Aroon Indicator - Mathematics and stock indicators 17" offers further insights into utilizing the Aroon Indicator effectively.

Chapter 4: Advanced Trading Strategies

The V strategy is a unique contrarian confirmation technique characterized by a V-shaped pattern. For a bullish (Buy) signal, the Aroon Oscillator must form a V shape, indicating the current reading is above -75, the previous reading is below -75, and the one before that exceeds -75. Conversely, for a bearish (Sell) signal, an inverted V formation is required, where the current reading is below 75, the previous reading is above 75, and the one prior is below 75.

Here's the implementation for the V strategy signals:

def signal(Data, aroon_osc_colr, buy, sell):

Data = adder(Data, 10)

for i in range(len(Data)):

if Data[i, aroon_osc_colr] > -75 and Data[i - 1, aroon_osc_colr] < -75 and Data[i - 2, aroon_osc_colr] > -75:

Data[i, buy] = 1

elif Data[i, aroon_osc_colr] < 75 and Data[i - 1, aroon_osc_colr] > 75 and Data[i - 2, aroon_osc_colr] < 75:

Data[i, sell] = -1

return Data

If you're interested in exploring more technical indicators and strategies, my book may be of value to you. Always remember to conduct back-tests and maintain a critical mindset. My approach may work for me but may not suit everyone.

Final Thoughts

I have recently launched an NFT collection aimed at supporting various humanitarian and medical causes. The Society of Light comprises limited collectibles, with a portion of each sale directed to charity. Here are some benefits of purchasing these NFTs:

  • High potential returns: Focused sales efforts aim to enhance their secondary market value, with a percentage of royalties going to charity.
  • Art collection and portfolio diversification: Owning avatars that symbolize good deeds can be fulfilling.
  • Flexible donations: Allocate funds to your preferred causes.
  • Free book copy: Buyers receive a complimentary PDF of my latest book.

To support my efforts against brain cancer, click here to purchase Christoff's NFT.

Share the page:

Twitter Facebook Reddit LinkIn

-----------------------

Recent Post:

Houston, We've Got a Pooch Problem: The Rise of Canine Illness

A mysterious respiratory illness is affecting dogs across America, leaving pet owners anxious and experts puzzled about its origins.

What Happens When Your Development Bonus Is Revoked?

Examining the implications of canceled bonuses for developers and the need for a cultural shift in the tech industry.

Leadership Insights from “The Lion King”: A Timeless Guide

Explore valuable leadership lessons from “The Lion King” and learn how they can inspire growth and development in your own leadership journey.