spirosgyros.net

A Comprehensive Approach to Double Confirmation Trading Strategies

Written on

Chapter 1: Introduction to the Strategy

In the realm of trading, moving averages serve as effective tools for following trends. When paired with the Parabolic SAR, they can provide valuable insights into potential new trends. The goal of this approach is to leverage moving averages as dynamic support and resistance levels, while using the Parabolic SAR to validate market reactions.

The following sections will delve into the workings of moving averages and the Parabolic SAR, culminating in a detailed discussion of the combined trading strategy.

The first video provides an overview of the market structure and the concept of double confirmation in trade entry setups.

Section 1.1: Understanding Moving Averages

Moving averages come in various forms, with the simplest being the simple moving average (SMA). This is calculated by summing a series of values and dividing by the number of those values. Here’s a basic formula for calculating a simple mean based on a dataset:

The SMA is primarily employed in technical analysis to discern underlying trends and generate trading signals. The following figure illustrates a 60-period SMA applied to hourly Ethereum vs. USD data.

Assuming you have imported an OHLC data array in Python, as previously demonstrated, you can utilize the following functions for data manipulation:

def add_column(data, times):

for i in range(1, times + 1):

new = np.zeros((len(data), 1), dtype=float)

data = np.append(data, new, axis=1)

return data

def delete_column(data, index, times):

for i in range(1, times + 1):

data = np.delete(data, index, axis=1)

return data

def delete_row(data, number):

data = data[number:, ]

return data

Next, to compute a simple moving average, you can implement this function:

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

data = add_column(data, 1)

for i in range(len(data)):

try:

data[i, position] = (data[i - lookback + 1:i + 1, close].mean())

except IndexError:

pass

data = delete_row(data, lookback)

return data

For those interested in trend-following strategies and indicators, my previous book may be of interest.

Section 1.2: The Parabolic SAR Indicator

The Parabolic Stop and Reverse (SAR) is an intriguing indicator designed by Welles Wilder Jr., who is also known for the RSI. This tool is predominantly utilized as a trailing stop that adapts to the market trend, but it can also function as a signal generator.

While the Parabolic SAR performs well during stable trends, it may struggle in ranging markets. Below is an example using EURUSD with the standard Parabolic SAR.

To compute the Parabolic SAR, you can utilize the following Python code snippet, adapted from the talib library:

def sar(s, af=0.02, amax=0.2):

s = pd.DataFrame(s)

s.columns = ['open','high','low','close']

high, low = s.high, s.low

sig0, xpt0, af0 = True, high[0], af

sar = [low[0] - (high - low).std()]

for i in range(1, len(s)):

sig1, xpt1, af1 = sig0, xpt0, af0

lmin = min(low[i - 1], low[i])

lmax = max(high[i - 1], high[i])

if sig1:

sig0 = low[i] > sar[-1]

xpt0 = max(lmax, xpt1)

else:

sig0 = high[i] >= sar[-1]

xpt0 = min(lmin, xpt1)

if sig0 == sig1:

sari = sar[-1] + (xpt1 - sar[-1]) * af1

af0 = min(amax, af1 + af)

if sig0:

af0 = af0 if xpt0 > xpt1 else af1

sari = min(sari, lmin)

else:

af0 = af0 if xpt0 < xpt1 else af1

sari = max(sari, lmax)

else:

af0 = af

sari = xpt0

sar.append(sari)

s = np.array(s)

s = np.reshape(s, (-1, 1))

return sar

The fundamental concept is that when the Parabolic SAR (represented by dots) lies below the current price, the market outlook is bullish, and when it is above, the outlook is bearish.

Chapter 2: Implementing the Combined Strategy

Combining various indicators is crucial for developing a reliable trading system, as it reinforces the conviction of trade signals when multiple conditions align. In this strategy, we will focus on simultaneous conditions to trigger trades.

Trading Conditions:

  • Long (Buy): When the Parabolic SAR shifts below the market price while the price is above and near the 300-period moving average.
  • Short (Sell): When the Parabolic SAR moves above the market price while the price is below and near the 300-period moving average.

Before implementing the signal function, ensure that your data array includes both indicators:

my_data = adder(my_data, 3)

my_data = ma(my_data, 300, 3, 5)

Next, define the signal function as follows:

def signal(Data, close, psar, ma_column, threshold, buy, sell):

for i in range(len(Data)):

if Data[i, close] > Data[i, psar] and Data[i - 1, close] < Data[i - 1, psar] and Data[i, close] > Data[i, ma_column] and (Data[i, close] - Data[i, ma_column]) < threshold:

Data[i, buy] = 1

if Data[i, close] < Data[i, psar] and Data[i - 1, close] > Data[i - 1, psar] and Data[i, close] < Data[i, ma_column] and (Data[i, ma_column] - Data[i, close]) < threshold:

Data[i, sell] = -1

Threshold Variable:

This variable defines the minimum distance from the market price to its moving average to generate a trade signal. For instance, a bullish Parabolic SAR flip, combined with a close proximity to the moving average, will trigger a bullish signal.

The second video discusses trading confirmation entries using multiple time frame analysis, focusing on supply and demand dynamics.

Chapter 3: Conclusion and Recommendations

In summary, my aim is to contribute to the realm of objective technical analysis by promoting transparent techniques and strategies that undergo rigorous back-testing before implementation. This approach seeks to enhance the credibility of technical analysis, often criticized for its subjective nature.

As you explore various trading strategies, I recommend adhering to the following steps:

  1. Maintain a critical mindset devoid of emotions.
  2. Back-test strategies using real market conditions.
  3. If promising results emerge, optimize and conduct forward tests.
  4. Always consider transaction costs and potential slippage.
  5. Include risk management and position sizing in your evaluations.

Finally, even with thorough preparation, it's vital to monitor your strategy as market dynamics evolve, which may affect its profitability.

For those interested in a PDF version of my book, it is available for 9.99 EUR. Please provide your email in the notes section during payment to ensure it reaches the correct address. Remember to download it via Google Drive upon receipt.

Share the page:

Twitter Facebook Reddit LinkIn

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

Recent Post:

Exploring the Best Python Frameworks for Game Development

Discover top Python frameworks for game development, including Pygame, PyKyra, Pyglet, and more.

Unlock the Hidden Potential of Your Content with AI Techniques

Learn how to effectively repurpose your existing content using AI, maximizing reach and engagement with minimal effort.

Insights on Leadership and Cybersecurity Trends – October 2023

Explore the top leadership and cybersecurity articles curated for October 2023, highlighting key industry challenges and innovations.