Close Navigation
Learn more about IBKR accounts
Candlestick Trading – A Momentum Strategy with Example

Candlestick Trading – A Momentum Strategy with Example

Posted June 29, 2022
Chainika Thakar and Akshay Choudhary
QuantInsti

Candlestick trading is a strategy in which the price on the previous ‘n’ candlesticks is observed and then you decide your next trade on the basis of that observation. Hence, if the price is increasing continuously for say, 3 candlesticks, then it is highly probable that it will rise further.

Candlestick charts basically show the high, low, open and close movements of a tradeable item, which can be a security, a derivative or currency.

Let us find out all about candlestick trading as a momentum strategy with this blog that covers:

  • What is momentum strategy?
  • Why does the momentum strategy exist?
  • Example of candlestick trading – momentum strategy in Excel

What is momentum strategy?

Momentum strategy implies the tendency of financial security to continue the price movement in a particular direction. The price momentum for an asset’s price can be either in an upward or in a downward direction.

For example, when Tesla began delivering cars in China on 14th February 2020, the closing price of Tesla kept rising till 19th February 2020.

On the contrary, the momentum can be in the downward direction as well. An example of a downward momentum is the oil price during the Covid-19 pandemic which kept plummeting with the Russia and OPEC oil war.


Why does the momentum strategy exist?

Momentum strategy seeks to profit from those securities which are trending and are backed by high volume. In simple words, buying high and selling higher is the main aim of this strategy. This can be achieved by taking positions in a stock that is going up or down, and then holding this position until the security shows signs of reversal.

Momentum traders may hold their positions for a few seconds, minutes, hours, months or even a couple of years, depending on how quickly the financial asset changes its direction.

Momentum trading carries a high degree of volatility compared to most other strategies. It is important to time the buys and sells correctly to avoid significant losses. Momentum traders usually make use of stop losses, portfolio diversifications, and other risk management techniques to minimize the losses.


Example of candlestick trading – momentum strategy in Excel

Now, let us see the example of candlestick trading with excel. This excel model will help you in:

  • Learning how momentum strategy is implemented
  • Understanding the trading logic of strategy implementation
  • Optimizing the trading parameters
  • Understanding intraday returns of momentum trading

​​In this example, we have taken the BTCUSDT data on the Binance exchange. The momentum strategy will be implemented on this asset. The data used for the BTCUSDT is 5 minutes candle data. The time interval of the data is from 12th December 2021 to 22nd December 2021.

Now, we would like to benefit from the market wave and optimize our bet by specifying stop loss and taking profit limits. This model is flexible and can be varied to achieve different limits to exit the trade depending upon the trader’s risk appetite.

Let us take a look at our assumptions now.

Assumptions

  1. For simplification purposes, we ignore bid-ask spreads.
  2. Prices are available at 5 minutes intervals and we trade at the 5 minute closing price only.
  3. Since this is discrete data, squaring off of the position happens at the end of the candle i.e. at the price available at the end of 5 minutes.
  4. Transaction costs would vary depending on the exchange. For the sake of simplicity, we have assumed it to be 0.

Also, we have some input parameters in place. Let us see those as well.

Input parameters

Please note that all the values for the input parameters mentioned below are configurable.

  • High/Low of 3 candles (one candle=every 5 minute price) is considered.
  • A stop loss of 50 and profit limit of 200 is set.

The market data and trading model are included in the spread sheet from the 12th row onwards. So when the reference is made to column D, it should be obvious that the reference commences from D12 onwards.

  • Column C represents the price for BTCUSDT.
  • Column D represents 3 candle high meaning the highest price of the previous 3 candles.
  • Column E represents 3 candle low meaning the lowest price of the previous 3 candles.
  • Column F calculates the trading signal.

The formula =IF(D13=””, “”, IF(C13>D13, “Buy”, IF(C13<E13, “Sell”, “”))) means
– if the entry in cell D13 is blank then keep F13 blank otherwise
– if C13 (BTCUSDT price) is greater than D13 (3 candle high) then buy signal for the BTCUSDT is generated else
– if C13 is lower than E13 (3 candle low) then sell signal for the BTCUSDT is generated.

  • Column G represents entry price. This is the price at which the trading signal is generated.

The formula =IF(H13=H12, G12, IF(OR(H13=”Buy”, H13=”Sell”), C13, “”))
means,
– if the entry in cell H13 is same as H12 then the value in G13 should be the value in G12 otherwise,
– if H13 is either “Buy” or “Sell” then the entry in G13 is the value in C13 (BTCUSDT price) else,
– if H13 is neither “Buy” nor “Sell” leave it blank.

  • Column H represents the status of the trade. Given our assumptions and input parameters there are four status that can occur, “Buy”, “Sell”, “TP (Take Profit)” and “SL (Stop Loss)”.

The formula:

=IF(OR(H17=””, H17=”TP”, H17=”SL”), F18, IF(H17=”Buy”, IF(C18<G17+$C$4, “SL”, IF(C18>G17+$C$5, “TP”, H17)), IF(H17=”Sell”, IF(C18>G17-$C$4, “SL”, IF(C18<G17-$C$5, “TP”, H17)), “”)))

Can be simplified as follows:

If the entry in H17 is either blank or TP or SL then choose the value in F18 (F column has either Buy or Sell or blank values). Otherwise, look into the next If condition.

If the entry in H17 is “Buy”, meaning we have a buy position, and if the price of the asset goes below the stop loss limit then we exit the position at stop loss and if the price of the asset goes above the take profit limit then we exit the position at take profit.

Similarly, if the position is “Sell” and the asset price rises above the selling price beyond the stop loss limit then exit the position at stop loss and if the asset price falls below the selling price beyond the take profit limit then exit the position by taking the profit.

  • Column I represents the profit/loss status of the trade. P/L is calculated only when we have squared off our position. The formula =IF(OR(H13=”SL”, H13=”TP”), IF(H12=”Buy”, C13-G12, IF(H12=”Sell”, G12-C13, 0)), 0) can be summarized as follows:-

The first if condition states that proceed to the next if condition only if the corresponding status in column H is either “SL” or “TP” else the entry in the cell is zero.

The next set of if conditions calculate profit assuming either stop loss or take profit has been achieved. If the status in column H is “Buy”, then the profit/loss is calculated as C13-G12.

Remember that the column G has the price at which you traded (in this case “Buy”) and the column C has the market data for BTCUSDT. Hence the profit/loss is simply the difference between the price at which you sold minus the price at which you bought.

If the status in column H is “Sell”, then the profit/loss is calculated as G12-C13 simply meaning the difference between the price at which you sold (shorted) and the price at which you bought later thus squaring off the position.

  • Column J calculates the cumulative profit.

Visit QuantInsti for additional insight on this topic and to review the files available for download: https://blog.quantinsti.com/candlestick-trading-a-momentum-strategy-with-example-excel-model/.

Disclosure: Interactive Brokers

Information posted on IBKR Campus that is provided by third-parties does NOT constitute a recommendation that you should contract for the services of that third party. Third-party participants who contribute to IBKR Campus are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results.

This material is from QuantInsti and is being posted with its permission. The views expressed in this material are solely those of the author and/or QuantInsti and Interactive Brokers is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to buy or sell any security. It should not be construed as research or investment advice or a recommendation to buy, sell or hold any security or commodity. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.

Disclosure: Bitcoin Futures

TRADING IN BITCOIN FUTURES IS ESPECIALLY RISKY AND IS ONLY FOR CLIENTS WITH A HIGH RISK TOLERANCE AND THE FINANCIAL ABILITY TO SUSTAIN LOSSES. More information about the risk of trading Bitcoin products can be found on the IBKR website. If you're new to bitcoin, or futures in general, see Introduction to Bitcoin Futures.

IBKR Campus Newsletters

This website uses cookies to collect usage information in order to offer a better browsing experience. By browsing this site or by clicking on the "ACCEPT COOKIES" button you accept our Cookie Policy.