Identifying Trading Patterns — Behavioural Analysis of Traders

Lakshmi Ajay
Geek Culture
Published in
9 min readApr 2, 2022

--

Programmatic approach to understand the behavioural patterns of traders

Behavioural Analysis of Traders (Image by Author)

Do emotions play a role in trading? Can patterns be derived from sentiments?

We are all well aware of the two most common trading approaches, the technical analysis and the fundamental analysis. Apart from these indicators, there is another component that impacts the trading patterns and that is the emotional factor. Trading is a matter of mind over money in which the human psychology plays a major role.

In this article we will be considering Bitcoins from the cryptocurrency market to analyse the trading patterns. Given that the crypto market is open 24x7, when is it the best time to trade? Do people prefer weekend trading or weekday trading?

SOME QUESTIONS TO PONDER 🤔

10 AM or 6 PM? When does the maximum trade happen?

Monday, Wednesday or Friday? When do people trade more?

Weekday or Weekend — which is preferred by traders?

When is the best time to trade on a Thursday to increase the chances of making a profit in the next 12 hours?

When to go long or short on any day?

Time now is 4PM, Saturday. What are the chances of making a profit in the next 3 hours?

Let us make the data answer these questions for us!!

GETTING STARTED

  • Analysis is based on the Bitcoin hourly data for the year 2021
  • Data from the Binance exchange is used for the analysis
  • Backtesting is done on Q1 2022 data
  • Links to the data and the code is provided at the end of the article
  • NOTE: The time in the charts is as per UTC (Coordinated Universal Time)

10 AM or 6 PM? When does the maximum trade happen?

The crypto market is open for 24 hours and people around the globe trade on it. Does it mean that the volumes traded is uniform across the day?

Let us find out how the bitcoin has traded in 2021 based on the volume of BTC traded every hour.

If charts can talk….

  • Maximum volume is traded between 12 pm and 5pm
  • The next most popular trading zone is between 8 am to 11 am
  • There is a drop in volumes traded in the early morning hours, 2 am to 6 am
  • There is a little peak in the volumes at 8 pm everyday, probably people like to trade after work, before hitting the bed.

Monday, Wednesday or Friday? When do people trade more?

  • Most of the crypto trading happens over the weekdays with the maximum trades happening on Mondays.
  • Weekends show a comparative lower average trading volume as compared to the weekdays.

Weekday or Weekend — which is preferred?

Is there any difference in the trading volume pattern of weekdays versus the weekends?

  • In terms of trading volumes, it is higher on weekdays as compared to the weekends
  • Most of the weekday tradings happen between 12 pm & 5 pm
  • There is no real peak trading zone during weekends

When is the best time to trade on a Thursday to maximize the chances of making a profit in the next 12 hours?

Given that you want to buy some bitcoins and sell it after 12-hours, when would be a good time to buy it?

This chart shows the best trading times for each day with a window period of 12 hours.

Eg: Based on 2021 data for Bitcoin, we can say that if we buy Bitcoin at 10 pm on a Monday, there is a 63% chance that it will go up after 12 hours.

Similarly, if we buy at 4 pm on a Monday then there is a 61% chance that the price will go down after 12 hours.

Thursday trading tip
If you plan to trade Bitcoin on a Thursday with a 12-hour window, then it is probably a good idea to do the trade at 6 pm, which gives you a 66% chance of seeing a green trade after 12 hours.

When to go long or short on any day?

The best time to trade on a given day will differ based on the window period. Below are some of the best trading times for a window of 2-hours, 4-hours, 8-hours and 24-hours.

Check out the python notebook in the git repo for other time frames.

Time now is 4PM, Saturday. What are the chances of making a profit in the next 3 hours?

Let us say that on a lazy Saturday morning you feel like doing a short-term Crypto trading, then when should you do this trade?

Check out the below chart for a 3-hour window to know when is the best time to trade. From the charts, you have the maximum chance of making a profit if the trade is done at 8 pm with a 63.5% chances of seeing a green in 3-hours, followed by a 4 am trade with 61.5% chances.

Play with the code to get an overview for other days with a different window period.

BACKTESTING

Now for the interesting part. How does all the analysis help us? Is it possible to use it in some way while trading?

DOES THIS SOUND REALISTIC?

IS THIS POSSIBLE?

Let us check out the 2022 data to understand this better. Based on the analysis done for Bitcoin with the 2021 data, the following two tests are employed to backtest the findings:

TEST CASE-1: TEST WITH A FIXED WINDOW PERIOD FOR ALL DAYS

  1. Set a window period to do the trade (Eg: sell in 3-hours every day after buying)
  2. Identify the best trading time for each day based on 2021 data for the given window period
  3. Apply this trading time to buy & sell bitcoins in Q1 2022

TEST CASE-2: TEST WITH THE BEST WINDOW PERIOD FOR EACH DAY

  1. Identify the best trading window and time for each day based on 2021 data
  2. Apply this trading time to buy & sell bitcoins in Q1 2022

SOME QUICK DISCLAIMERS

  • Test results are only for reference, to show how much of the analysis actually holds good on unseen data
  • Profit/loss is computed based on only the open/close price of the crypto and the additional exchange costs are not considered

TEST CASE-1 (BITCOIN): FIXED WINDOW PERIOD

Now let us consider a 3-hour window to perform the trade.

On each day of the week, we want to buy bitcoins for $500 and sell it after exactly 3 hours. The time to buy & sell will vary for each day based on the analysis done on the 2021 data. The best trading time and the chances of making a profit for each day based on 2021 data is given in the blue box.

Now, using this data, if we had performed the trades consistently on all the days of Q1 2022, starting from 1st Jan, 2022 to 31st Mar, 2022, then the overall profit/loss made on each day would be as shown in the green box below.

Theoretically, over a period of 3 months, an investment of $500 would have given a return of $80.38 (WOW!! that is a profit of 16%!!)

Sounds perfect? Well, let us see the results with other window periods.

TRADING WITH OTHER WINDOW PERIODS

Similar to the above computation for 3-hours window, the trades were theoretically performed for the best 1, 2, 3, 4, 6, 8, 12 and 24-hours window period. The profit/loss for each window period is as shown in the below chart.

Except for the 6-hour, 8-hour & 24-hour windows the other window periods have performed well.

TEST CASE-2 (BITCOIN): BEST WINDOW PERIOD FOR EACH DAY

To continue the testing, let us identify the best trading window for each day based on the 2021 data.

Now let us try trading during these time windows from 1st Jan, 2022 to 31st Mar, 2022, i.e.
01-Jan-2022 (Saturday) — Buy BTC for $500 at 6 pm and sell it at 8 pm
02-Jan-2022 (Sunday) — Buy BTC for $500 at 8 pm and sell it at 10 pm
and so on till 31st March
31-Mar-2022 (Thursday) — Buy BTC for $500 at 12 pm and sell it at 2 pm

If this BUY-SELL trade is done everyday religiously on all the days from 1st Jan to 31st March, then the results would look like below:

INVESTMENT  : $500
DURATION : 3 MONTHS
PROFIT/LOSS : $73.8
PROFIT % : 14.76 %

TRADING WITH ETHEREUM

Given that we have done analysis on Bitcoin, how would the same logic work on other cryptos?

As an experiment, the same code was run on Ethereum data and below are the results.

TEST CASE-1 (ETHEREUM): FIXED WINDOW PERIOD

The 4-hours window gives the best results with a return of 38% in 3 months with an initial investment of $500.

TEST CASE-2 (ETHEREUM): BEST WINDOW PERIOD FOR EACH DAY

INVESTMENT  : $500
DURATION : 3 MONTHS
PROFIT/LOSS : $125.35
PROFIT % : 25 %

Who would not settle for that?

BUT THERE IS A CATCH…..

With 90 days from 1st Jan to 31st Mar, 180 trades are made(90 buy trades and 90 sell trades). If we take the exchange brokerage into account, then the profit numbers change drastically.

Here is a snapshot of the final profit/loss based on the exchange’s commission for every trade, assuming it is the same for buy & sell, maker & taker trades.

Looks like daily trade may not work out with all exchanges.

One possible option could be to trade only once or twice in a week when the returns are the best and evaluate the performance. Will leave it as an exercise to the interested folks to evaluate this option considering the exchange commission. The data and code used for this analysis is available in the next section.

DATA & CODE

The hourly crypto data used for the analysis is from cryptodatadownload.com

The data and the code to perform the analysis in this article is available in this git repo: CryptoTradersAnalysis

WHAT MORE?

  • The application can be enhanced further to constantly learn from the past data dynamically and use the trading time for a day based on the latest data
  • The code can be wrapped into a trading bot to automate the trading based on this strategy. Refer to this article if you want to learn on how to setup a trading bot: Building a Basic Crypto Trading Bot in Python

CLOSING NOTE

The main intention of this article was to programmatically explore on other methods to analyse the data apart from the traditional technical & fundamental analysis.

Note that all the analysis in this article is intended only for educational purpose and is in no means any kind of trading recommendation. Please do your due diligence before taking any trading decisions.

Hope the article was interesting & informative. Do explore the data more and leave a comment if you can find any other interesting patterns in the data.

Happy Exploring!! :-)

--

--