# Questions tagged [moving-average]

The tag has no usage guidance.

40 questions
Filter by
Sorted by
Tagged with
235 views

### What is the fastest common moving average?

I am trying to find what standard moving average would give me the fastest adjustment or strongest weight to most recent data, but without changing the number of periods. Here is some sample data and ...
50 views

### How to get formulas for EWMA model with M-day records

Given following formula in exponential weighted moving average (EWMA) model i: stock i t: time t rit: actual return for stock i at time t If we only know latest M-day situation, how can we derive ...
41 views

### What is the difference between Rolling Returns and Moving Average and how to calculate them?

So I understand what a moving average is and how to calculate it. I'm using this numpy function for it. I am somehow confused about how to calculate rolling returns. Different sites explain it ...
70 views

### Can MACD be calculated for values other than 12 and 26?

I am working on time-series classification problem using Convolutional Neural Networks in Python. The data-set used is financial stock market data (like yahoo finance). I am using some technical ...
648 views

### Half life of Exponetial Weighted Moving Average

I am trying to apply a volatility strategy. I am reading a paper where the authors defined the volatility as: "Exponential Weighted Volatility of returns with a 1-year window and 3-month half-life" ...
100 views

### Exponential Smoothing - Alpha greater than 1

Simple stats question. I'm having trouble finding anything in the literature as to why the smoothing coefficient can never be greater than 1. This question was started by me doing time series ARIMA ...
277 views

### Detect trend of an index

My question is about determining the trend and it can break down to 3 parts. To clarify, a trend in my point of view, and in simple form, is the last close at time t relative to its time reference, i....
74 views

### Can I make the simple moving average less lagging by this method?

I have (T+3) predicted prices for a stock. Let us assume that the predicted prices are going to be very close to the actual prices. can I alter the formula of simple moving average for 20 days like ...
356 views

### Where to get historical equity data?

I have a decade of experience as a software engineer, but little quantitative finance knowledge. I have an idea for a simple trading strategy based around moving averages. In order to test it, I'd ...
725 views

### What should the half-life be in EWMA when calculating VaR from EWMA?

If we want to calculate an $x$-day VaR ($x$ is some time period in days) from an Exponentially Weighted Moving Average (EWMA) of vector of returns, what should the half-life in the decay factor in ...
110 views

### Pricing an Asian style forward contract with early exercise feature

Is there an analytic way to price or approximate a contract with payout $A_t - K$, where $A_t$ is the running average price of the underlying asset from $[0, t]$ and $K$ is (fixed) strike. If this ...
1k views

### Is there a non-recursive way of calculating the exponential moving average?

I want to calculate the exponential moving average for many stocks in a large investable universe. To do this, I've seen the following formula: Because it references the previous day's exponential ...
115 views

In Python: ...
2k views

### What is the difference between squared returns and variance?

I am trying to calculate 1-day ahead volatility forecasts using the exponentially weighted moving average, however I am unsure on how to read the formula provided within Risk-Metrics Technical ...
3k views

### When people say calculate moving average for 30 days include weekends or not? [closed]

When someone wants to calculate a 30-day moving average of a commodity, do they mean 30 business days, or 30 calendar days? I'm looking for the general consensus, not "you could do it this way or ...
1k views

### R RSI Calculation (TTR package)

I'm using the default RSI calculation in the TTR package as follows: result = RSI(data,14). The function also allows the user to specify the averaging method: result = RSI(data,14,"SMA"), result =...
933 views

I apologize if this is way too basic a question, but I'm an absolute beginner to trading and am in the process of learning the fundamentals. Currently I'm trying to model a (10-day) SMA backtest in ...
20k views

### Calculating Bollinger Band Correctly

My bollinger band comes out like the below, which doesn't seem right. Any idea what is wrong with my code for calculating upper and lower bollinber bands? I obtained my data from here ...
248 views

### Volatility vs. Moving Average Distance

Currently I am designing a little market making bot for forex trading, that puts offers around the mid price. In the market I am trading it happens the order book becomes so thin that the mid price ...
165 views

### What is an Efficient way to calculate Simple moving average without saving previous N period values?

I want to calculate the Simple Moving Average (SMA) for Stock Prices with for period 'N'. Normal Formula for 4 Period Moving Average is MA = (a + b + c + d) / 4 for new entry e we do as ...
122 views

### Derivation (or proof) of commonly used formula showing relationship between time and smoothing factor in exponential smoothing

I am using simple exponential smoothing on historical market prices. There is a commonly held view (among market practitioners), that there is a simple relation between the period over which the data ...
2k views

### How to optimize return in a moving average crossover algorithm

Moving average crossover strategy is a widely used strategy in algo trading. Is there a way to optimize return in a moving average crossover stratergy. I have used this site to backtest MA crossover ...
142 views

### How do I automatically graph S&P PE ratio moving average VS DOW

Obviously this is a rookie question, I'm simply looking to plot the S&P PE ratio moving averages over different periods of time and plot them vs the DOW. Ideally I would love like something that ...
1k views

### How to get the the final % return in backtesting?

I'm learning how to do backtesting in Python using Pandas. I'm learning how to use Moving Average Crossover. I've generated signals to buy or to sell already. But I'm not sure where to go from there? ...
174 views

### Why the diff of signal is called positions and what does it mean in backtesting?

I'm trying to learn Backtesting 101. I found this example which is very simple but I do not quite understand some of the terms. I understand Moving Average algorithm which is to measure trends or to ...
1k views

### Aren't Technical Indicators calculated on Adjusted Close Price?

I would assume that day to day movement in stock can be accurately compared with the Adjusted Close Price and not simply the Close Price, taking into account Stock Splits Dividends etc. http://www....
93 views

### Moving Averages Crossover question

I'm reading on Investopedia that one should buy a stock if short term moving average is ABOVE the long term moving average, since this "indicates an upward trend". However, this is not intuitive to ...
105 views

### compute technical indicators from candle data

i have a rookie question but can't find the answer anywhere so..what is the right way to compute a simple moving average when you have an array of (open,close,low,high) tuples ? From what i saw so ...
629 views

### How to adapt a Moving Average period to market conditions?

I would like to know if there is some way to adapt the period of a moving average to market conditions like for instance the stop loss can be adapted to market conditions using the average true range. ...
153 views

### How to weigh many factors using a SMA/EMA

I'm learning about the SMA/EMA technical analysis, as well as, indicators such as Bollinger Bands, Stochastic Oscillators, MACD, etc. How do you know which one to use and which to weigh more over ...
3k views

### Unsmoothing of returns

The following problem arises in the context of private equity, which typically report "smoothed" returns (think of it as a moving average). As you can imagine, "smoothed" returns would have a much ...
2k views

### How to fully replicate ADX + DI Indicators in Excel? [closed]

For black box testing, I was hoping that I could replicate the ADX + DI+ and DI- indicators that are provided in trading platforms such as ThinkOrSwim, ScottradeElite etc. However, I noticed that ...
391 views

### Can you tell me what this RBloomberg formula means?

I've been asked to re-create a spreadsheet that used RBloomberg using a different data source. But I'm having trouble figuring out exactly what one of the spreadsheet's formulas does. Can anyone tell ...
243 views

### Technical Indicators reference

I have been looking for a good reference where I can find how technical indicators of stock market analysis are calculated. I have a dataset (time series) which I want to extract these indicators to ...
390 views

### Online algorithm for selecting smoothing parameter?

In Online Algorithms in High-frequency Trading the authors demonstrate online, exponentially-weighted algorithms for mean, variance, and linear regression. The authors estimate their smoothing ...
483 views

### How to test the efficiency of Exponential Moving Averages as a trading startegy? [closed]

I would like to know how I can test the efficiency of Exponential Moving Averages when it comes to forex trading. Can i have any papers that point to the efficiency of this strategy? Thank you. :)
1k views

### Trading a stock (or other asset) based on Bollinger Bands.

One way investors analyze stocks is on a technical basis. Looking at Bollinger Banks (20 day moving average +- 2 standard deviations) is one of the most popular technical tools. Some stocks trade ...
319 views

### How to use volatility to assess the accuracy of a stock market model?

Background: For a dissertation I have a multi-agent stock market model that I am using to assess different mechanisms for producing particular dynamic regimes. A key point is assessing how closely it ...