Tabellab

You are not signed in — the lab works, but your progress is not saved. Sign up

Lesson 1 of 20 is free. Unlock all 20 hands-on labs, the final exam and your certificate.

Buy course — $9.90
Loading the spreadsheet…

Before any indicator, there is the candle

RSI, MACD, Bollinger Bands, moving averages: technical analysis has a long list of indicators with impressive names. Every one of them is calculated from the same four prices per day, the open, high, low and close. If you can turn those four numbers into a daily return, a candle body and two wicks in Excel, you already understand the raw material of the whole field, and you can check any indicator yourself instead of trusting a charting app.

This free first lesson is for spreadsheet users who want to understand price charts, finance students meeting technical analysis for the first time, data analysts who need to prepare OHLC data, and anyone who has looked at a candlestick chart and wondered what exactly is being drawn. You will work with twelve trading days of a fictional share, Corvane Robotics (CRVN), from 31 August to 15 September 2026.

This course is educational only and not investment or trading advice. Technical indicators describe what prices did in the past. They do not predict what prices will do. Corvane Robotics and all prices are fictional, and nothing here suggests buying, selling or holding any security.

OHLC data and the candlestick, explained simply

For each trading day, an exchange records four prices. The open is the first traded price of the session, the close the last one. The high and low are the extremes reached in between. Together they are called OHLC data, and they are what you get when you download daily prices from almost any data provider.

A candlestick draws one day as a single shape. The thick body spans the open and the close. Thin lines, the wicks or shadows, extend from the body up to the high and down to the low. If the close is above the open, the price rose during the session and the candle is bullish, usually drawn green or hollow. If the close is below the open, it is bearish, usually red or filled. The colours only describe the direction within that one day.

In numbers: body = ABS(close − open). The upper wick runs from the top of the body to the high. The top of the body is the open on a bearish day and the close on a bullish day, so in Excel it is MAX(open, close) and the upper wick is high − MAX(open, close). The lower wick mirrors it: MIN(open, close) − low. Using MAX and MIN means one formula works for both candle types.

Anatomy of a candle (two days from the lab)Bullish: 3 SepHigh 48.92Close 48.12Open 47.39Low 47.13upper wick 0.80body 0.73lower wick 0.26Bearish: 1 SepHigh 48.75Open 47.88Close 46.96Low 46.93upper wick 0.87body 0.92lower wick 0.03
Two real rows from the lab. On a bullish day the close is the top of the body, on a bearish day the open is. MAX and MIN pick the right one automatically.

The daily return links each day to the one before: close / previous close − 1. It measures the change from one session's close to the next, including any gap overnight. That is different from the move inside one day (close versus open), which the candle body shows. Returns, not prices, are what most indicators and every backtest work with, because a 1 % move means the same thing whether a share costs $5 or $500.

Worked example: twelve days of Corvane Robotics

Here is the full lab with every derived column calculated. Columns B to E are the given prices, column H (upper wick) is pre-filled as a worked example, and you calculate the return, body, lower wick and label. The first day has no return because there is no previous close in the sheet.

The finished lab: Corvane Robotics, fictional daily prices in USD, rows 4 to 15
DateOpenHighLowCloseReturnBodyUpper wickLower wickCandle
31 Aug47.5548.1747.4447.80–0.250.370.11Bullish
1 Sep47.8848.7546.9346.96-1.76 %0.920.870.03Bearish
2 Sep47.0447.6746.4047.30+0.72 %0.260.370.64Bullish
3 Sep47.3948.9247.1348.12+1.73 %0.730.800.26Bullish
4 Sep48.4448.6647.1947.92-0.42 %0.520.220.73Bearish
7 Sep48.0548.2047.5547.76-0.33 %0.290.150.21Bearish
8 Sep47.7447.8046.1546.69-2.24 %1.050.060.54Bearish
9 Sep47.0047.1646.1446.17-1.11 %0.830.160.03Bearish
10 Sep46.1246.2045.9446.03-0.30 %0.090.080.09Bearish
11 Sep46.0746.3045.3446.00-0.07 %0.070.230.66Bearish
14 Sep46.0046.3045.7846.15+0.33 %0.150.150.22Bullish
15 Sep46.3947.2545.9646.91+1.65 %0.520.340.43Bullish

The formulas in row 5 are F5: =E5/E4-1, G5: =ABS(E5-B5), H5: =C5-MAX(B5,E5), I5: =MIN(B5,E5)-D5 and J5: =IF(E5>B5,"Bullish","Bearish"). All use relative references, so you enter them once and fill down. The return column starts in row 5. The other columns start in row 4.

Corvane Robotics (fictional): 12 daily candlesBullishBearish45.0046.0047.0048.0049.0031 Aug1 Sep2 Sep3 Sep4 Sep7 Sep8 Sep9 Sep10 Sep11 Sep14 Sep15 SepPrice in USD. Body = open to close, wicks = high and low.
The same twelve days drawn as candles. The tall wicks on 1 and 3 September show wide ranges inside the day, the tiny candle on 10 September a very quiet session.

Reading the numbers rather than the picture gives you precision. On 1 September the share opened at 47.88, briefly reached 48.75, then sold off to close at 46.96: a bearish body of 0.92 with a long upper wick of 0.87 and almost no lower wick (0.03), because the close sat just above the low. On 3 September the opposite happened: a bullish body of 0.73 and the highest return of the period, +1.73 %. On 10 September the whole range from low to high was only 0.26, the calmest day of the sample.

Over the twelve days, five candles are bullish and seven bearish, and the close moved from 47.80 to 46.91. Those are descriptions of what happened in this fictional data. Technical analysts give names to certain shapes, such as long upper wicks or very small bodies, but in this course you treat them as measurable features, not as forecasts.

Daily return = close / previous close − 1-3 %-2 %-1 %0 %+1 %+2 %-1.761 Sep+0.722 Sep+1.733 Sep-0.424 Sep-0.337 Sep-2.248 Sep-1.119 Sep-0.3010 Sep-0.0711 Sep+0.3314 Sep+1.6515 Sep
Daily returns from the lab. Bars below zero are the down days you highlight with conditional formatting in the last task.

Summarising twelve days in a few cells

Once the derived columns exist, a handful of summary formulas describe the whole period. They are worth adding below the data because they turn twelve rows into a few facts you can quote, and because several of them reappear in later lessons. All values below are from the fictional lab data.

Summary statistics for the twelve fictional Corvane days
SummaryExcel formulaResult
Bullish days=COUNTIF(J4:J15,"Bullish")5 of 12
Average body=AVERAGE(G4:G15)0.47
Average daily range (high − low)=SUMPRODUCT(C4:C15-D4:D15)/121.12
Highest high / lowest low=MAX(C4:C15) / =MIN(D4:D15)48.92 / 45.34
Change over the period=E15/E4-1−1.86 %
Same, by compounding the returns=PRODUCT(1+F5:F15)-1−1.86 %
Simple sum of the returns=SUM(F5:F15)−1.80 %
Standard deviation of returns=STDEV.S(F5:F15)1.26 %

Two lines in that table deserve a closer look. Compounding the daily returns with PRODUCT(1+F5:F15)-1 gives exactly the same answer as comparing the last close with the first, −1.86 %. Simply adding the returns gives −1.80 %, which is close but not the same, because each day's percentage applies to a different starting price. Over twelve quiet days the gap is small. Over longer periods or bigger moves it grows, and it is one of the most common errors in homemade performance sheets. In older Excel versions the PRODUCT formula must be confirmed with Ctrl+Shift+Enter because it works on an array.

The standard deviation of the daily returns, about 1.26 % here, is the usual starting point for measuring volatility. Later in the course Bollinger Bands use a standard deviation of prices in the same spirit: a wider spread means the price has been moving around more.

Gaps: what happens between two candles

The candle covers one session, the daily return covers close to close. The difference between the two is the gap, the move from yesterday's close to today's open, =B5-E4 in dollars or =B5/E4-1 in percent. On 4 September Corvane closed the day before at 48.12 and opened at 48.44, a gap of +0.32. It then fell during the session to close at 47.92, so the day shows a bearish candle even though the close-to-close return was only −0.42 %. On 9 September the open of 47.00 was 0.31 above the previous close of 46.69, yet the day closed lower again.

This is why the candle colour and the sign of the return can disagree. A bearish candle only says the close was below the open. It does not say the price fell compared with yesterday. Keeping the return and the candle in separate columns, as the lab does, avoids mixing up the two ideas, and a gap column is a natural extra you can add yourself in column K.

How to do it in Excel, step by step

  1. Put the headers in row 3: Date, Open, High, Low, Close, Return, Body, Upper wick, Lower wick, Candle. Enter the dates in A4:A15 and format them with Ctrl+1 › Number › Date (Excel stores 15 Sep 2026 as the serial number 46280).
  2. Enter the OHLC prices in B4:E15. Check the order of your data source: some exports put the close before the high and low.
  3. In F5 type =E5/E4-1 and press Enter. Format F5:F15 as a percentage with two decimals (Ctrl+Shift+5, then Home › Number › Increase Decimal twice).
  4. In G4 type =ABS(E4-B4), in H4 =C4-MAX(B4,E4), in I4 =MIN(B4,E4)-D4, and in J4 =IF(E4>B4,"Bullish","Bearish").
  5. Select G4:J4 and double-click the fill handle to copy down to row 15. For the return, select F5:F15 and press Ctrl+D.
  6. Highlight the down days: select F5:F15, then Home › Conditional Formatting › Highlight Cells Rules › Less Than, type 0, choose Light Red Fill and click OK.
  7. Optional: draw the chart. Select A3:E15 and use Insert › Charts › Waterfall, Stock or Surface › Open-High-Low-Close. Excel expects the columns in exactly that order: date, open, high, low, close.
  8. Optional: count candle types with =COUNTIF(J4:J15,"Bullish") and find the largest single-day fall with =MIN(F5:F15).
Build a quick sanity check into every OHLC sheet: =AND(C4>=MAX(B4,E4),D4<=MIN(B4,E4)) must be TRUE on every row. A FALSE means a high below the close or a low above the open, which is a data error, often a swapped column.

Technical analysis indicators in Excel course: candlesticks, moving averages, RSI and MACD
From candles to a full backtest, every indicator in the course is built cell by cell on a live sheet.

Common mistakes and how to spot them

  • Comparing the close with the same day's open for the return. =E5/B5-1 is the intraday move, not the daily return. The daily return uses yesterday's close. Spot it by checking that the first return row references the row above.
  • Forgetting ABS for the body. Without it, bearish days get a negative body. If you see negative numbers in a "length" column, a wrapper is missing.
  • Using the close for the bottom of the body. =E14-D14 is only right on bearish days. On 14 September (bullish) it gives 0.37 instead of 0.22. MIN(open, close) avoids this.
  • Swapped labels. If 3 September, the biggest up day, is labelled Bearish, the IF arguments are in the wrong order.
  • Starting the return in the first row. The first day has no previous close in the sheet. A formula in F4 would reference the header row and return an error.
  • Highlighting "below average" instead of "below zero". Below-average rules flag returns under the period mean, which can include small up days. A down day is a return below 0.
  • Unsorted dates. If the data comes newest-first, every return is calculated backwards. Sort with Data › Sort Oldest to Newest before filling formulas.

Quick reference: formulas and shortcuts used

The complete toolkit of this lesson. Every later indicator in the course is built on these columns.

MeasureExcel formula (row 4 or 5)Function
Daily return=E5/E4-1arithmetic
Body=ABS(E4-B4)ABS
Upper wick=C4-MAX(B4,E4)MAX
Lower wick=MIN(B4,E4)-D4MIN
Candle label=IF(E4>B4,"Bullish","Bearish")IF
Count bullish days=COUNTIF(J4:J15,"Bullish")COUNTIF
Largest fall=MIN(F5:F15)MIN
OHLC sanity check=AND(C4>=MAX(B4,E4),D4<=MIN(B4,E4))AND
Highlight down daysHome › Conditional Formatting › Less Than 0menu
Percent format / fill downCtrl+Shift+5 / Ctrl+Dshortcut

Real-world uses

  • Cleaning downloaded price data. Before any analysis, the sanity check and the return column reveal missing days, swapped columns and stock-split jumps that a chart would hide.
  • Describing volatility in a report. The average body or the average high-low range per day is a simple, explainable measure of how much a price moved, useful for a finance assignment or a market commentary.
  • Checking a charting tool. When a platform shows a candle or a return you do not trust, rebuild the day in four cells and compare.
  • Preparing data for other models. Daily returns are the input for volatility, correlation and risk measures used in portfolio courses, not only in technical analysis.
  • Teaching and learning. Building candles from numbers makes a chart readable in a way that memorising pattern names does not.

What you will build in the rest of this course

This first lesson is free. The lessons below are part of the paid course ($9.90 one-time), each with its own live lab that checks your formulas cell by cell, using 30 days of fictional Corvane prices.

Simple & Exponential Moving Averages. You smooth 30 daily closes with a 5-day and a 10-day simple moving average and build a 10-day exponential moving average row by row, so you see exactly how the weighting differs.

Moving-Average Crossover Signals. You label each day by whether the short average is above the long one, detect the days where they cross and count those events with formulas.

RSI (14) with Wilder's Smoothing. You calculate the 14-day average gain and loss with Wilder's smoothing and turn them into the Relative Strength Index, the step most tutorials skip.

MACD: Line, Signal & Histogram. You build the MACD line from two EMAs, smooth it into a signal line and read the histogram, with periods scaled down to fit 30 days.

Bollinger Bands & %B. You draw 20-day bands around the SMA20 and measure where the close sits inside them with %B.

Support, Resistance & Breakout Flags. You turn the last 10 days' highs and lows into rolling levels and flag the days the close moved outside them.

Backtest a Simple Rule vs Buy-and-Hold. You test the crossover rule on the fictional data without look-ahead bias and compare total return, win rate and maximum drawdown with simply holding, learning how backtests are built and why their results describe the past only.

Summary

Every technical indicator starts from four prices a day. The body is the distance between open and close, the wicks reach to the high and low, and MAX and MIN let one formula handle bullish and bearish days alike. The daily return compares each close with the previous one and is the building block for everything that follows. Scroll up to the lab, fill in columns F, G, I and J for Corvane Robotics, highlight the down days, and let the sheet check each formula.

Frequently asked questions

How do you calculate the body of a candlestick in Excel?

Use the absolute difference between close and open, for example =ABS(E4-B4). ABS keeps the body positive on bearish days, when the close is below the open.

What is the formula for the upper and lower wick?

Upper wick = high − MAX(open, close) and lower wick = MIN(open, close) − low. MAX and MIN pick the top and bottom of the body for both bullish and bearish candles.

How do I calculate daily returns in Excel?

Divide today's close by yesterday's close and subtract 1, for example =E5/E4-1, then fill down. The first day has no return because there is no previous close.

What is the difference between a bullish and a bearish candle?

A bullish candle closes above its open and a bearish candle closes below its open. The label only describes the price direction within that one day.

Can Excel draw a candlestick chart?

Yes. Arrange the columns as date, open, high, low, close, select them and use Insert, Charts, Stock, Open-High-Low-Close.

Do technical indicators predict future prices?

No. They summarise what prices did in the past. This course teaches how they are calculated in Excel for educational purposes, not how to make trading decisions.

Keep going: Technical Analysis Indicators in Excel

This free lab is lesson 1 of 20. Unlock the other 19 hands-on labs, the final exam and your certificate for a one-time $9.90.

  1. Simple & Exponential Moving Averages
  2. Moving-Average Crossover Signals
  3. RSI (14) with Wilder's Smoothing
  4. MACD: Line, Signal & Histogram
  5. Bollinger Bands & %B
  6. Support, Resistance & Breakout Flags
  7. Backtest a Simple Rule vs Buy-and-Hold
  8. Momentum & Rate of Change (ROC) with a Signal Line
  9. Heikin-Ashi Candles: Smoothed Bars & Trend Runs
  10. Commodity Channel Index (CCI): Typical Price & Mean Deviation
  11. Bollinger Bandwidth & the Squeeze
  12. Opening Gaps: Size, Direction & Same-Day Fills
  13. Weekly Bars from Daily Data: a Multi-Timeframe View
  14. Relative Strength vs a Sector Index: Rebasing & the RS Line
  15. Market Breadth: Net Advances, the A/D Line & Divergences
  16. A Percent Trailing Stop: Stop Level, Exit Day & Trade Result
  17. Do Signals Work? Forward Returns After a Buy Signal
  18. Overfitting Check: In-Sample vs Out-of-Sample Results
  19. Final Project: A Technical Dashboard for Ten Stocks

Buy course — $9.90 See the full course