Weighted Moving Average Strategy: Backtest and Best Settings
The Weighted Moving Average (WMA) is a valuable technical indicator employed by traders to assess the direction of trade and assist in making informed decisions on when to buy or sell.
This article looks at the math, theory, and basics of the WMA. However, we provide backtests of trading strategies complete with trading rules to give you numbers, data, facts, and statistics. No anecdotal evidence and random charts!
Noteworthy characteristics of the WMA include:
- It places increased emphasis on more recent data points compared to older ones.
- As a result, it yields an enhanced reflection of current trend directions.
- Traders often combine WMA with additional technical indicators for strengthened confirmation of trading cues.
Leveraging the insights provided by the WMA allows traders to refine their approaches and elevate their effectiveness within their trading strategies.
Emphasizing the most up-to-date data point renders this tool highly sensitive and effective for market participants. The capability it provides them in detecting price trends contributes significantly as they plot courses through peaks and troughs across financial markets while maintaining focus on overarching price movements.
If youâ€™re wondering why a Weighted Moving Average (WMA) might be the tool to enhance your trading strategy, itâ€™s because it prioritizes recent prices, potentially offering faster signals in response to market shifts. This article explains the â€˜weightingâ€™ behind WMA, contrasts it with other types of averages, and provides practical use cases, all without sales fluff or unnecessary complexity.
Key Takeaways
- The Weighted Moving Average (WMA) is a technical indicator that assigns greater weight to recent data points, enhancing its responsiveness to new market information and assisting traders in identifying trend directions and generating buy/sell signals.
- WMAs are used with other technical analysis tools for more comprehensive trading strategies. They can reflect trend changes more promptly than Simple Moving Averages (SMAs) due to their focus on recent prices, and they are commonly backtested for effectiveness prior to being applied.
- Despite their advantages, WMAs have limitations such as being lagging indicators and potentially providing distorted signals during volatile price movements. They should be part of a diversified toolkit and are best used in conjunction with other indicators.
- We provide historical evidence, statistics, numbers, facts, and performance via backtesting.
What is a Weighted Moving Average in Technical Analysis? (WMA)
A weighted moving average (WMA) in technical analysis is one that sets different weights for the price data of different trading periods. The idea behind its calculation is to give more weight to recent data and less weight to older data. This way, it shows the prevailing trend at the moment, not the previous one.
Below is a chart with a 50-day simple moving average and a 50-day weighted moving average:
The WMA responds a lot quicker than the simple moving average and moves up and down frequently.
So, while it smooths out sharp price deviations, it also determines more accurately the direction of the trend at that moment since recent data is given greater specific weight. Due to giving more weight to the recent price data, the indicator reacts faster to price changes.
In technical analysis, the Weighted Moving Average (WMA) plays a crucial role. It helps in discerning the direction of market trends, thus enabling traders to form trading signals or use it as a trend filter. A potential buy signal is indicated when prices hover near or drop below the WMA while hovering near or climbing above it may signal time to sell. The capacity of WMA to deliver timely signals regarding trend reversals endears it to many within the trading community.
Reliance on WMA alone isnâ€™t entirely prudent for comprehensive trade strategy. Traders commonly employ it as part of a technique known as multiple time frame analysis. This involves using WMA both as a filter to ascertain overall trend direction over an extended period and then seeking shorter-term confirmationâ€”effectively corroborating their findings with additional indicatorsâ€”to establish robust groundwork conducive to successful trading endeavors.
Are Weighted Moving Average different from other types of moving averages?
The weighted moving average is different from many other types of moving averages because it responds quickly to changes in the price. Various types of moving averages are utilized, each with their unique attributes.
The Simple Moving Average (SMA) is determined by taking the average price across a given time frame. It does not differentiate between the significance or timing of any particular data point in that span. Conversely, Weighted Moving Averages place additional emphasis on more recent data points and hence react quicker to fresh information and latest trends in price.
Different still is the Exponential Moving Average (EMA), which prioritizes newer prices substantially over older onesâ€”though it distinguishes itself by reducing weights exponentially rather than uniformly from one price to its immediate predecessor.
Despite all moving averages relying on historical figures, they differ markedly in how they apportion importance to these numbersâ€”a distinction that renders each type uniquely apt for varying contexts within trading strategies.
Weighted moving average strategy (Backtest)
We go straight to the essence of this website: quantified backtests with trading rules.
Our hypothesis is simple:
We look at the most traded instrument in the world: the S&P 500. We test on SPDR S&P 500 Trust ETF which has the ticker code SPY.
All in all, we do four different backtests:
- Strategy 1: When the close of SPY crosses BELOW the N-day moving average, we buy SPY at the close. We sell when SPYâ€™s closes ABOVE the same average. We use CAGR as the performance metric.
- Strategy 2: Opposite, when the close of SPY crosses ABOVE the N-day moving average, we buy SPY at the close. We sell when SPYâ€™s closes BELOW the same average. We use CAGR as the performance metric.
- Strategy 3: When the close of SPY crosses BELOW the N-day moving average, we sell after N-days. We use average gain per trade in percent to evaluate performance, not CAGR.
- Strategy 4: When the close of SPY crosses ABOVE the N-day moving average, we sell after N-days. We use average gain per trade in percent to evaluate performance, not CAGR.
The results of the first two backtests look like this:
Strategy 1
Period |
5 |
10 |
25 |
50 |
100 |
200 |
CAR |
8.53 |
8.05 |
5.99 |
5.17 |
5 |
3.28 |
MDD |
-23.82 |
-33.9 |
-42.66 |
-40.24 |
-49.38 |
-49.2 |
Strategy 2
Period |
5 |
10 |
25 |
50 |
100 |
200 |
CAR |
1.09 |
1.54 |
3.5 |
4.31 |
4.48 |
6.21 |
MDD |
-75.45 |
-65.93 |
-39.08 |
-41.21 |
-44.53 |
-42.69 |
The results from the backtests are pretty revealing: in the short run, the stock market shows tendencies to mean-reversion. In the long run, it is better to use trend-following strategies. This is pretty typical in the stock market because any oversold or overbought conditions don’t stay like that for long periods of time.
Why do we reach that conclusion?
If we use a short moving average, the best strategy is to buy when stocks drop below the average and sell when they turn around and close above the moving average (buy on weakness and sell on strength). This can be seen in the first test above for the 5-day moving average. The 5-day moving average returns a CAGR of 8.53%, almost as good as buy and hold even though the time spent in the market is substantially lower.
When we buy on strength and sell on weakness, in the second test in the table above, the best strategy is to use many days in the average. The longer the average is, the better. The 200-day moving average returns 6.21%, which is pretty decent. However, even though the above data is without reinvested dividends, it’s below any buy and hold strategy.
The results from backtests 3 and 4 look like this (the results are not CAGR, but average gains per trade):
Strategy 3
Period |
5 |
10 |
25 |
50 |
100 |
200 |
5 |
0.22 |
0.33 |
1.2 |
1.85 |
4.07 |
9.2 |
10 |
0.22 |
0.51 |
1.15 |
2.41 |
3.85 |
9.85 |
25 |
0.16 |
0.52 |
1.14 |
2.09 |
4.54 |
8.78 |
50 |
0.22 |
0.61 |
1.24 |
2.47 |
4.34 |
8.94 |
100 |
0.67 |
0.76 |
1.32 |
1.96 |
4.31 |
8.79 |
200 |
0.53 |
0.66 |
1.87 |
3.19 |
4.71 |
7.72 |
Strategy 4
Period |
5 |
10 |
25 |
50 |
100 |
200 |
5 |
0.22 |
0.26 |
0.93 |
2.16 |
4.3 |
8.58 |
10 |
0.2 |
0.27 |
0.93 |
2.52 |
4.24 |
8.82 |
25 |
0.23 |
0.31 |
0.78 |
2.16 |
3.63 |
7.47 |
50 |
0.17 |
0.19 |
0.76 |
1.2 |
3.78 |
8.63 |
100 |
0.1 |
0.26 |
1 |
1.25 |
4.1 |
8.11 |
200 |
0.27 |
0.01 |
0.78 |
2.42 |
3.87 |
6.75 |
As expected, the longer you are in the stock market, the better returns you get. This is because of the tailwind in the form of inflation and productivity gains.
However, be aware that this is just one method of testing a moving average. There are unlimited ways you can use a moving average, and your imagination is probably the most restricting factor!
What are the best settings for the weighted moving average?
The best settings for the weighted moving average based on data-driven backtests and statistics are these:
- Short-Term Mean-Reversion Strategy:
- A 5-day WMA showed promising results with a CAGR of 8.53%.
- This strategy involves buying when the asset’s price drops below the WMA and selling when it turns around and closes above the WMA.
- Long-Term Trend-Following Strategy:
- A 200-day WMA returned decent results with a CAGR of 6.21%.
- This strategy involves buying when the asset’s price crosses above the WMA and selling when it crosses below the WMA.
- Optimization:
- Experiment with various WMA periods to find the optimal balance between responsiveness and smoothness.
- Consider using different performance metrics like average gain per trade for evaluation.
- Implementation:
- Attach the WMA indicator to the chart on your trading platform.
- Continuously monitor and adapt the strategy based on market conditions.
In summary, the best WMA settings are determined by the strategy’s timeframe and optimized based on historical performance metrics provided by backtesting. No anecdotal evidence!
Does a weighted moving average strategy work?
Yes, weighted moving average (WMA) strategies do work. Backtests reveal that they can be profitable for both mean-reversion and trend-following approaches on stocks.
The weighted moving average places more emphasis on recent data, allowing it to closely track prices and react faster to changes. Different strategies based on WMA, such as buying on weakness and selling on strength, show promising results, with varying performance metrics depending on the length of the moving average period.
Can you make money by using weighted moving average strategies?
Yes, weighted moving average (WMA) strategies can make money for both mean-reversion and trend-following approaches in stock trading, as shown by our backtests.
These strategies involve buying when the stock price crosses below the moving average and selling when it crosses above for mean-reversion, or vice versa for trend-following. The effectiveness depends on the length of the moving average, with shorter periods suitable for mean-reversion and longer periods for trend-following.
WMA calculates the prevailing trend by giving more weight to recent data, reacting faster to price changes. The calculation involves assigning weights to each period’s price data based on the chosen indicator period.
Is Weighted Moving Average important?
The Weighted Moving Average (WMA) plays an important role in trading due to its focus on the latest data, which helps traders swiftly react to price fluctuations. It aids in discerning the direction of market trends, spotting possible trend reversals, and provides timely indications for buying or selling.
As an esteemed indicator within the trading community, WMA proves indispensable as it offers reliable insights for trade execution strategies.
WMAs may not always capture exact tops or bottoms of markets – far from it. They verify prevailing trend directions more promptly than other indicators might. This promptness is because WMAs give greater emphasis on recent pricing movementsâ€”making them especially beneficial for those looking to take advantage of brief swings within financial markets.
How to find Weighted Moving Average?
You find a weighted moving average in any trading platform or application. Just insert it on the price chart from the trading indicators.
Modern charting software and trading platforms simplify the process of determining the Weighted Moving Average (WMA). These platforms are outfitted with integrated tools designed for computing WMAs, allowing traders to incorporate them into cryptocurrency charts across various timeframes effortlessly. Traders can select their desired timeframe for the moving average and modify the weighting to fit their strategy, prompting the software to undertake calculations and display the WMA on the chart automatically.
How to calculate weighted moving average?
Calculating the weighted moving average (WMA) is a process that involves several steps.
- Each data point must be multiplied by an assigned weight, which represents its level of significanceâ€”commonly giving higher weights to more current data.
- Following the allocation of these weights, multiply each price figure by its designated weight.
- Finally, compile all these individual weighted figures together to arrive at the final WMA.
To illustrate this with a three-period WMA as an example, one might attribute a weight of 0.5 for the most recent period, 0.3 for the preceding period and then allocate 0.2 for two periods prior. Expressing the formula as summing up every price after its respective weighting factor has modified it. This serves as a demonstration of how we perform a weighted average calculation.
Undertaking this computation manually offers tangible insight into how WMAs function and underscores their significant role in technical analysis practices within financial markets.
What is the difference between a Weighted Moving Average and a Simple Moving Average?
The difference between a weighted moving average and a simple moving average is that a simple moving average puts equal weight on all data while a weighted moving average puts more weight on the most recent observations.
The SMA computes the average price for a determined period by giving equal importance to each data point without considering its timeliness or significance. On the other hand, WMA places additional emphasis on more recent data points which better captures current market movements compared to SMA.
Due to this variation in their weighting methods, WMA tends to be quicker at adjusting to recent changes in prices, thereby offering traders an opportunity for prompt reaction based on prevailing market conditions. Whether one should utilize SMA or WMA depends largely upon what suits an individual traderâ€™s strategy â€“ longer-term investors may lean towards using SMA since it assimilates a broader scope of relevant information even when entering investments currently.
Are Weighted Moving Averages common?
Weighted moving averages are not particularly common in trading. Few traders use them. We are not sure why because they are particularly valued for their ability to assign greater emphasis to recent data points. This attribute makes them a preferred tool for traders across various strategies, whether one is engaged in long-term trend following or the swift pace of intraday trading.
The preference for WMAs is reinforced by their ability to indicate shifts in a stockâ€™s momentum more quickly than moving averages that consider longer periods do. This rapid responsiveness results from the heavier weighting given to recent prices within the calculation of weighted moving averages.
How do you trade Weighted Moving Average?
You trade weighted moving average by finding the best trading rules by backtesting and statistics to find a trading edge that has yielded a positive expectancy in the past.
Traders rely on the WMA to produce buy and sell signals by keeping tabs on when the price movement approaches or surpasses the average as a cue for trade exits, or when prices seem to fall toward or beneath the WMAâ€”often seen as an inviting moment to initiate a position.
Nevertheless, traders are advised against relying solely on WMA for their strategies. It is imperative that this indicator be integrated with additional tools to shape more astute trading decisions. For example, leveraging WMA within multi-timeframe analysisâ€”as a means of gauging trendsâ€”enables traders to ensure their moves resonate with the broader market currents, which can enhance prospects for successful trades.
What are the drawbacks with a Weighted Moving Average?
The drawback with a weighted moving average is that it can is that they can skew analysis as a result of abrupt changes in the curve prompted by volatility or significant price swings in recent data. Moreover, like all moving averages, WMAs serve as lagging indicators because they derive from past information. Hence they demonstrate a delay when responding to trend shifts.
The inherent delay attributed to WMAs might cause tardiness in exhibiting a shift in trend direction. This poses a potential constraint for traders who depend exclusively on this tool for discerning the course of trends.
What is the psychology behind Weighted Moving Average?
WMA operates on the principle that newer market information is more indicative of future price trends than older information, reflecting the tendency of traders to respond with heightened sensitivity to fresh data. This approach enhances its usefulness as an analytical instrument by giving recent data greater weight and thus aligning closely with actual trading psychology.
Are there trading strategies that can be associated with Weighted Moving Average?
Numerous trading strategies employ the Weighted Moving Average (WMA), for example, by using two WMAs with different time lengths to detect possible shifts in trends through crossover signals. When a short-term WMA crosses over a long-term one, this could indicate an emerging change in the trend direction.
Traders can interpret the WMA as dynamic support or resistance â€“ buying on an uptrend when the WMA is ascending or issuing sell signals near a descending WMA during downtrends.
While these tactics may prove useful, they shouldnâ€™t stand alone as sole guides for trades. Itâ€™s crucial to apply the WMA alongside additional technical indicators when forming trading decisions. By synthesizing information from the WMA and other indicators within their arsenal of tools, traders are better positioned to refine their strategies and increase chances for fruitful outcomes in their trade executions.
What time is the best to trade the Weighted Moving Average?
The best time to trade a weighted moving average is determined by the trading rules and, ultimately, backtest. This, the best time might vasy – a lot – depending on many factors.
There is no universally optimal period for trading with the Weighted Moving Average (WMA) since it is contingent upon a range of elements, including an investorâ€™s chosen time frame, current market dynamics, and their specific investment goals.
For example, those engaged in day trading may opt for brief durations such as 5-day, 10-day or 20-day WMAs whereas investors with a long-term perspective are more likely to lean towards using extended periods like the 50-day, 100-day or even 200-day WMAs.
Executing trades that involve WMAs during times when liquidity and volume are high can be advantageous. This often leads to diminished effects of random fluctuations or â€˜market noise,â€™ thereby bolstering the dependability of signals emanating from moving averages.
Are Weighted Moving Average reliable Indicators?
WMAs, when applied appropriately, have proven in backtests to be reliable indicators. They place greater significance on the most recent data points and are particularly useful for traders focusing on current price movements.
This attribute of WMAs offers a clearer representation of the trend direction which can greatly aid in making trading decisions. Itâ€™s important to remember that WMAs are lagging by nature. They inherently possess a delay which could postpone the indication of a shift in trend.
Although they offer significant insights and form an essential component of a traderâ€™s arsenal, reliance should not be placed solely on them.
How do you decide the right time period for Weighted Moving Average?
The right time period for a weighted moving average (WMA) hinges on multiple aspects, including the traderâ€™s backtests and market characteristics. The preference of emphasising recent data points over historical ones should guide the choice of time period since WMA places more importance on newer information.
A WMA with a shorter duration will be more responsive to price changes, making it apt for traders who are focusing on short-term trends. Conversely, extending the length of the WMA helps in filtering out brief fluctuations, thereby aiding those who aim to discern long-term patterns in market movements.
How to calculate weighted moving average in excel?
The computation of WMA is easily executed in Excel, and the steps are as follows:
- Input your data points into a spreadsheet and create an adjacent column for weights corresponding to each point.
- Utilize the SUMPRODUCT along with the SUM functions to ascertain the value of WMA.
- Apply this equation: =SUMPRODUCT(A2:A6,B2:B6)/SUM(B2:B6)
By using this equation, you achieve WMA by multiplying every datum by its respective weight via the SUMPRODUCT function before proceeding to divide that total by summing all associated weights with help from the SUM function.
If we consider a scenario where you need three periods for calculating weighted moving average, it might be reasonable to apportion higher significance like 0.5 on current periodâ€™s data, moderate significance such as 0.3 on previous periodâ€™s one and lesser importance around 0.2 for two periods prior information accordingly adjust your formula which would encapsulate individual price-weight product summation.
Following these instructions simplifies determining WMA within Excel ensuring efficiency without complication.
What is the Exponentially Weighted Moving Average?
An Exponentially Weighted Moving Average (EWMA) is a type of weighted moving average. Similar to WMA, EWMA prioritizes recent data points by assigning them greater importance. Unlike WMAâ€™s linear method, it exponentially decreases the significance of past data.
Due to its focus on an exponential decline in weight for older information, EWMA quickly adapts to changes in price. This responsiveness makes it an indispensable instrument for traders aiming to adjust their strategies according to fluctuations in market patterns promptly.
What is the difference between Weighted Moving Average and an Exponentially Weighted Moving Average?
The difference between the Weighted Moving Average (WMA) and Exponential Weighted Moving Average (EWMA) is that they diverge in their method of diminishing the importance of earlier data.
The WMA assigns weights that diminish incrementally in a linear manner for preceding data points. Conversely, the EWMA applies an exponential reduction to its weighting system, causing older data pointsâ€™ significance to decline more sharply.
The varying approaches these moving averages take with weight assignment greatly influence their sensitivity to changes in price. Given its exponentially decreasing weight allocation towards older prices, the EWMA is quicker to adapt to recent shifts in prices than the WMA is. This characteristic renders it particularly advantageous for traders who prioritize swift reactions to evolving market conditions.
What is the Volume-Weighted Moving Average?
The Volume Weighted Moving Average (VWMA), a modification of the WMA, takes into account not just recent prices, which it prioritizes like its counterpart, but also includes trading volume within its formula. This means that VWMA places greater emphasis on time periods during which trade volumes were more substantial.
By factoring in the volume of trades along with price information, the VWMA provides an enhanced reflection of an assetâ€™s average price over a given period. It is considered to deliver a truer gauge due to this incorporation of both price and trading quantity data.
What is the difference between Weighted Moving Average and Volume Weighted Moving Average?
The difference between the Weighted Moving Average (WMA) and the Volume Weighted Moving Average (VWMA) is that VWMA takes into account trading volume in its computation. Unlike WMA, which overlooks the trade volumes for each period, VWMA combines both price and volume when calculating average prices.
By factoring in trade volume, VWMA is more attuned to price movements that coincide with significant levels of trading activity. Consequently, it can offer a truer reflection of average price movement as experienced by most market participants compared to just computing an ordinary average over a given timeframe based on prices alone.
How to calculate WMA?
When calculating the WMA, the most recent data is more heavily weighted so it contributes more to the final WMA value. You use the number of periods chosen for the indicator to determine the weighting factor to use in the calculation.
For instance, if you want to calculate a 5-period WMA, you may do it as follows:
WMA = [(P1 * 5) + (P2 * 4) + (P3 * 3) + (P4 * 2) + (P5 * 1)] / (5 + 4+ 3 + 2 + 1)
Where:
P1 = current price
P2 = price one bar ago
P3 = price two bars ago, and so on.
Note that you donâ€™t have to do the calculation manually, as your trading platform does the calculation and plots the indicator line once you attach the indicator to the chart.
How is a Weighted Moving Average calculated?
A Weighted Moving Average is calculated so that each data point is multiplied by an assigned weight that typically places greater emphasis on newer data. The sum of these weighted values is then computed.
This approach prioritizes more recent information when determining the average, ensuring it has a stronger influence on the outcome.
What are the drawbacks of WMA?
The shortcomings of the Weighted Moving Average (WMA) are its vulnerability to abrupt fluctuations in data and its nature as a delayed indicator, which tends to respond after some delay following shifts in trends.
Bear these constraints in mind while employing WMA for analytical purposes.
What is the difference between WMA and an Exponentially Weighted Moving Average (EWMA)?
The primary distinction between WMA (Weighted Moving Average) and EWMA (Exponential Weighted Moving Average) lies in their weighting mechanisms. Although both methods give greater importance to the most recent data points, EWMA distinguishes itself by decreasing weights at an exponential rate, which enhances its sensitivity to changes in the latest prices.
Consequently, due to this adjustment in weight allocation, EWMA has the ability to respond more quickly to variations within the dataset.
What are the results of the backtests for different strategies using Weighted Moving Averages?
The backtests earlier in this article demonstrate that weighted moving average strategies can be profitable for both mean-reversion and trend-following approaches.
Strategy 1, focusing on buying when the close of SPY crosses below the N-day moving average and selling when it crosses above, yields Compound Annual Growth Rates (CAGR) ranging from 3.28% to 8.53%.
Conversely, Strategy 2, which reverses the buy and sell conditions, shows CAGR figures from 1.09% to 6.21%. Additionally, Strategy 3 and Strategy 4, evaluated by average gain per trade in percent, further indicate the effectiveness of weighted moving averages in generating returns.
Why is the Weighted Moving Average strategy effective in both mean-reversion and trend-following scenarios?
The effectiveness of the weighted moving average strategy lies in its unique calculation, which assigns more weight to recent data and less to past data. This characteristic enables the weighted moving average to closely track price movements, making it suitable for identifying both short-term reversals and long-term trends in the market.
What are the key differences between using short moving averages and long moving averages in Weighted Moving Averages?
Short moving averages, such as the 5-day moving average, are optimal for mean-reversion strategies, indicating buying when prices dip below the average and selling when they rise above.
In contrast, long moving averages, like the 200-day moving average, perform better in trend-following strategies, advising buying when prices surpass the average and selling when they fall below.
What are the implications of using different periods in the Weighted Moving Average strategy?
The chosen period directly influences trading outcomes. Shorter periods result in faster reactions to price changes, ideal for capturing short-term movements and mean-reversion opportunities.
Longer periods provide smoother trends, suiting trend-following strategies and offering more stable signals but potentially sacrificing responsiveness to rapid market shifts.
What is the general trend observed in the backtest results in relation to the duration of time spent in the market?
Across the backtest results, a consistent trend emerges: longer durations spent in the market tend to yield better returns. This observation aligns with the notion that prolonged exposure benefits from factors like inflation and productivity gains, providing a tailwind for investment performance.
Summary
Fundamentally, the Weighted Moving Average (WMA) serves as a robust instrument for technical analysis, enabling traders to detect market patterns and arrive at well-grounded trading decisions if using trading rules that can be backtested.
Despite some constraints, including its inherent nature as a lagging indicator, WMAâ€™s focus on recent data renders it particularly beneficial for those engaged in short-term trading. With the availability of several adaptations like the Exponential Weighted Moving Average (EWMA) and Volume Weighted Moving Average (VWMA), there is an array of moving average options that cater to each traderâ€™s distinct preferences and strategies.