๐Ÿงฐ UtlKit

How to Calculate a Moving Average: SMA 101.2 and EMA 104.13 from Six Closes, and the 200 Day Line That Triggers the Golden Cross

SMA and EMA side by side: six closes at period five give 101.2 then 104.13, the table keeps two decimals and the last twenty rows, and the golden cross banner needs a full 200 prices.

A moving average replaces a window of prices with one number, and the Moving Average Calculator keeps two kinds on one table: paste closing prices one per line or separated by commas, set the period, and press Calculate MA. The table answers with a day number, the close, the simple line, the exponential line, and an up or down arrow for every row where both lines exist, and it keeps the last twenty rows of the series you pasted.

Two formulas, one shared seed

The simple line adds the last n prices and divides by n, so every price in the window weighs the same. The exponential line leans on the newest price with k equal to 2 over n plus 1: each new value is the close times k plus the previous exponential value times 1 minus k, and the first exponential value is the simple average of the first n prices, which is why the two columns agree on day n. Rows 1 through n minus 1 print a dash in both columns. The same exponential recursion runs inside MACD, where a 12-period line minus a 26-period line forms the indicator and a 9-period average of that line forms the signal, in the MACD calculator.

Six closes, period five, walked day by day

Paste 100, 102, 99, 101, 104, 110 and set the period to 5. Days 1 through 4 print dashes. On day 5 the simple line is 100 plus 102 plus 99 plus 101 plus 104 over 5, which is 506 over 5, or 101.2, and the exponential column carries the same 101.2 seed. On day 6 the simple window drops the oldest price and reads 102 plus 99 plus 101 plus 104 plus 110 over 5, or 516 over 5, which is 103.2, while the exponential line takes 110 times 1 over 3 plus 101.2 times 2 over 3 and lands at 104.13. With k at 1 over 3 the fresh price owns a third of the weight, the exponential line sits 0.93 above the simple one, and the day 6 arrow points up.

What the result table shows

Every number prints to two decimals and the not-yet-computed rows show a dash, so the 101.2 seed prints as 101.20 and the exponential value prints as 104.13. The signal column compares the two lines row by row: the arrow points up when the exponential line is above the simple line and down otherwise, and it stays blank while either column is a dash. Only the last twenty rows render, so a very long series shows its final twenty days and nothing earlier, and the same twenty-day simple average is the middle band in the Bollinger bands calculator, where a standard deviation channel is drawn around it.

The golden cross and death cross banner

Above the table the tool can flash a colored banner, but only when you paste at least 200 prices. It builds a 50-period simple line and a 200-period simple line over the whole series and compares the last two values of each: the 50-period line crossing from below the 200-period line to above reads golden cross, and crossing from above to below reads death cross. A cross on any earlier day is not reported, since only the final two rows are compared, and a series under 200 rows never shows the banner. The other chart-level tool is the Fibonacci retracement calculator, which marks the 38.2, 50, and 61.8 percent pullback levels between a swing high and a swing low.

Which period matches the horizon

The built-in guide lists four common periods: 5 for short-term day trading signals, 20 for medium-term swing support and resistance, 50 for long-term trend direction, and 200 as the bull and bear divide. A bigger period smooths more and lags more: the 200-period line barely moves through a bad week while the 5-period line chases every close, and the period field opens at 20, the middle of that table, which is the number most swing traders start from.

Where the average sits in a trading workflow

On the buying side, the DCA calculator schedules fixed-interval purchases, and the average line is how you check whether those buys tracked a trend or rode one down. How to calculate Fibonacci retracement walks the pullback levels that pair with the average on a chart, how to calculate DCA covers the return side of the same fixed-interval investing, and how to calculate CAGR converts the trend the line traces into one average annual rate you can compare across holdings.

Related Tools

Frequently Asked Questions

When do the first moving average values appear in the table?

Rows 1 through n minus 1 print a dash in both columns, where n is the period. The first simple value appears on row n, and the exponential column carries the very same seed on that row, which is why the two lines agree on day n.

What is the difference between the simple line and the exponential line?

The simple line weighs every price in the window the same, so it smooths more and lags more. The exponential line weights recent prices harder with k equal to 2 over n plus 1, so it reacts faster to a fresh close, and both start from the same seed on row n.

Why does the golden cross banner not show?

The banner needs at least 200 prices, and the cross must fall in the final two rows: the tool builds the 50-period and 200-period simple lines over the whole series and compares only their last two values, so a cross on an earlier day is never reported.

Which rows of the series are shown in the result table?

Only the last twenty rows render, every number prints to two decimals with a dash for the not-yet-computed rows, and the signal arrow points up when the exponential line is above the simple line and down otherwise.

How does the tool handle the pasted input?

The input splits on newlines and commas, any token that is not a number is dropped silently, and if fewer numbers remain than the period, the tool prints no results at all, keeping the period default at 20.

Related Articles