Enhancing Trading Strategies with SuperTrend and VAMA Insights
Written on
Chapter 1: Introduction to Indicator Combination
Utilizing multiple indicators can significantly bolster trading performance by refining signal accuracy. This article explores a discretionary strategy that integrates the SuperTrend and the Volatility Adjusted Moving Average (VAMA) to produce trend-following signals.
Recently, I've published a new book following the success of my earlier work, "Trend Following Strategies in Python." This new edition introduces sophisticated contrarian indicators and strategies, complete with a GitHub page for ongoing code updates. Interested readers can find a sample via the Amazon link below or opt for the PDF version available at the article's conclusion.
Chapter 1.1: Understanding the Volatility-Adjusted Moving Average
Moving averages are essential tools for confirming trends and determining entry and exit points. Their simplicity and reliability make them one of the most utilized technical indicators. They aid in identifying support and resistance levels, setting stop-loss orders, and discerning the market's underlying trend. This adaptability renders them indispensable in trading.
# Function to add columns to an array
def adder(Data, times):
for i in range(1, times + 1):
new_col = np.zeros((len(Data), 1), dtype=float)
Data = np.append(Data, new_col, axis=1)
return Data
# Function to remove columns from an index
def deleter(Data, index, times):
for i in range(1, times + 1):
Data = np.delete(Data, index, axis=1)return Data
# Function to skip a number of rows from the beginning
def jump(Data, jump):
Data = Data[jump:, ]
return Data
The Volatility-Adjusted Moving Average (VAMA) was developed by Tushar S. Chande and is also referred to as the Variable Index Moving Average. It accounts for recent volatility by utilizing two standard deviation periods, distinguishing it from other indicators.
To compute VAMA, the initial step involves determining alpha, which is calculated using the ratio of short-term to long-term volatility, then multiplied by 0.20. The first VAMA value corresponds to the closing price, and subsequent values are computed using the following formula.
Chapter 1.2: The SuperTrend Indicator
Before delving into the SuperTrend indicator, it’s crucial to grasp the concept of volatility, often measured with the Average True Range (ATR). Although ATR is a lagging indicator, it provides insights into current and historical volatility.
The true range is determined as the maximum of the following three price differences:
- High - Low
- High - Previous Close
- Previous Close - Low
Once the true ranges are calculated, averaging them over a specified period yields the ATR. During volatile periods, the ATR tends to rise, whereas it generally decreases during stable trends.
# Function to calculate ATR
def atr(data, lookback, high, low, close, where):
data = adder(data, 2)
for i in range(len(data)):
try:
data[i, where] = max(data[i, high] - data[i, low],
abs(data[i, high] - data[i - 1, close]),
abs(data[i, low] - data[i - 1, close]))
except ValueError:
passdata[0, where] = 0
data = ema(data, 2, (lookback * 2) - 1, where, where + 1)
data = deleter(data, where, 1)
data = jump(data, lookback)
return data
The SuperTrend indicator serves as a guide for entry and exit points for trend traders. It operates similarly to a moving average or MACD but offers unique advantages due to its intuitive nature. Key parameters include the ATR lookback period and a multiplier, typically set to 2 or 3.
To calculate the SuperTrend, we first compute the average price, then derive the basic upper and lower bands by adding or subtracting the product of the multiplier and ATR from this average.
Chapter 2: Crafting the Trading Strategy
The strategy hinges on dual confirmation from both indicators. The SuperTrend is employed as the trigger, while the VAMA serves as confirmation. The conditions for generating signals are as follows:
- A long (Buy) signal is activated when the market surpasses SuperTrend(10, 3) while remaining above VAMA(3, 55).
- A short (Sell) signal occurs when the market dips below SuperTrend(10, 3) while also being below VAMA(3, 55).
# Function to generate trading signals
def signal(data, close, vama_column, super_trend_column, buy_column, sell_column):
data = adder(data, 10)
for i in range(len(data)):
if data[i, close] > data[i, super_trend_column] and data[i, close] > data[i, vama_column] and data[i - 1, close] < data[i - 1, super_trend_column]:
data[i, buy_column] = 1if data[i, close] < data[i, super_trend_column] and data[i, close] < data[i, vama_column] and data[i - 1, close] > data[i - 1, super_trend_column]:
data[i, sell_column] = -1return data
This video, titled "Supertrend Indicator + EMA Strategy: Keeping it Simple," provides a straightforward overview of using these indicators effectively.
The second video titled "The Trading Indicator That Is 10x Better Than The Supertrend" offers insights into alternative strategies that may enhance your trading performance.
Summary
In conclusion, my goal is to contribute to the world of objective technical analysis, advocating for transparent techniques and strategies that undergo rigorous back-testing before implementation. This approach aims to dispel the notion of technical analysis being purely subjective.
When approaching any trading technique or strategy, consider these steps:
- Maintain a critical mindset, free from emotional influences.
- Conduct back-testing using real-life conditions.
- If potential is identified, optimize and run forward tests.
- Always account for transaction costs and slippage in your simulations.
- Implement risk management and position sizing in your evaluations.
Even after thorough testing, it’s essential to remain vigilant as market dynamics can shift, potentially impacting the strategy's profitability.