Questions tagged [moving-average]

A calculation of the average value of the most recent (within some window) values in a time series, rather than the average of the entire series.

Moving average is a calculation of the average value of the most recent (within some window) values in a time series, rather than the average of the entire series.

1034 questions
0
votes
1 answer

Simple Moving Average summation/offset issue

I wrote a simple moving average with a moving window of Temperatures read as a voltage between 0 and 10V. The algorithm appears to work correctly, however, it has a problem where depending upon which Temperatures filled the window first, the moving…
Ryan R
  • 8,342
  • 15
  • 84
  • 111
0
votes
1 answer

Moving window implementation

So, I have to implement an algorithm of Constant False Alarm Rate(CFAR). It kind of works like this: I am using the notion that, in case that the target window contains more than one pixels, this operator (CFAR) uses the following detection…
0
votes
1 answer

sql server 2012 Before the move

CODE : SELECT YEAR_ID, Count, ThreeYEARAverage, AVG(Count) OVER (ORDER BY YEAR_ID ROWS 4 PRECEDING) AS FiveYEARAverage FROM (SELECT YEAR_ID, ISNULL(Count, 0) AS Count, AVG(ISNULL(Count, 0)) OVER (ORDER BY YEAR_ID ROWS 2…
0
votes
2 answers

How to calculate moving average from text file?

I have one text file. I want to do some calculations (moving average) as shown below and write the results. The text file contains 15 columns and 601 rows. columns <- paste0("X", 1:13) ref <- read.table("D:\\DAS_asc.txt",…
Jonsson Sali
  • 73
  • 1
  • 10
0
votes
1 answer

How to apply simple code for a vector to several rasters?

I have 12 binary (raster) files . I would like to calculate the moving average for the 12 values for each pixel in the 12 files. For a simple vector we can get a moving average by using this : x <- c(1,2,3,NA,NA,4,6,5,6,4,2,5) …
Barry
  • 739
  • 1
  • 8
  • 29
0
votes
2 answers

How to calculate the mean for a moving window (back and forth) and stander deviation for the window in R?

I have 365 values from x[1] to x[365]. For each value I have to consider a windoe(x-17,x+17),so will start from x[18]. I want to perform the calculations like this: x=1:365 first period = (x[18]-17 vaues,x[18]+17 values) example of my…
Barry
  • 739
  • 1
  • 8
  • 29
0
votes
0 answers

Create column to calculate moving average

I created table using VS2012, C#. I want to add column that calculates moving averages for Cclose column. Below is my code to create the table string cmdText = "CREATE TABLE [" + TblName + "]" + "(Tticker char(6)," …
Adnan Al-Husain
  • 110
  • 1
  • 3
  • 17
0
votes
2 answers

Create lags and moving average

I have a data frame that contains daily measurements of many meteorological and environmental variables. I need to create lags of 14 days and compute moving averages of 3 different consecutive lag periods (lag 0 and 1, lag 2 to 6 and 8 to 14. I…
Meso
  • 1,375
  • 5
  • 17
  • 36
0
votes
1 answer

SQL Server and moving average of stocks Intraday intervals

I'm very very new to sql server. I want to have a table with intra-day stock information and analytical calculation (ex. Simple Moving Average - SMA). I've designed a table that will contain market data and imported the data to it. now I want to add…
Adnan Al-Husain
  • 110
  • 1
  • 3
  • 17
0
votes
2 answers

geometric mean in Matlab for a specific time interval

say that I have a matrix (NX2) where the first column's elements are the number of seconds (since midnight) and the second column is stock returns associated to associated to the seconds. How can I use the function geomean and compute the geometric…
Plug4
  • 3,838
  • 9
  • 51
  • 79
0
votes
1 answer

calculate exponential moving average in matrix with nan values

suppose I have the following matrix a = 76 NaN 122 NaN 78 NaN 123 NaN 84 NaN 124 54 77 NaN 126 58 82 45 129 62 90 50 135 45 76 63 133 66 79 52 122 49 88 56 140 24 Is there any way to…
mario
  • 75
  • 8
-1
votes
1 answer

Start of Moving Average

Is there a pine script v5 that highlights a look back candle or vertical line of "x" moving average. For example, using a 50MA, the chart will highlight the 50th candle to signify the beginning of the 50MA. //@version=5 indicator("Highlight 50th…
-1
votes
1 answer

Find highest consecutive salary from given collection

e.g. We have a collection [ {1,' A,' 100}, {2, 'X', 200}, {3, 'D', 300}, {5, 'B', 300}, {6, 'Z', 300}, {7, 'G', 300}, ] likewise. I start with the last object first then If my limit is 3 then I'll pick the last three to find the…
Murtuza
  • 73
  • 1
  • 8
-1
votes
2 answers

Excel/Google Sheets - 10-day rolling average in a single cell based on whatever the last ten cell values are in a column are before the first blank?

I work with teachers who have to fill out information in a Google Sheet every day. There is a column for date and a column for incident counts. They log in and add a row with a new date and incident count every day. Here is a link to a version of…
ACK
  • 39
  • 1
  • 1
  • 8
-1
votes
1 answer

Moving everage - how to calculate?

Please explain how to calculate the EMA indicator on trading candles? I found the formula here:https://www.investopedia.com/ask/answers/122314/what-exponential-moving-average-ema-formula-and-how-ema-calculated.asp But there is some strange,…
Serg_
  • 67
  • 5