Bias Systems: Andrea Unger

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 56

®

The Trading Method of the 4-Time World Champion

BIAS SYSTEMS
How to exploit repetitive behavior
such as seasonal patterns

ANDREA UNGER
INTRODUCTION

There’s a Chinese proverb I’ve always kept in mind as a trader: “When you lose, don’t lose the lesson”.
It’s something I firmly believe in: every mistake made, every “lesson learnt”, helped me refine my method
and build a correct approach to trading, the same I’ve been teaching my students for years.
Mistakes in trading can be expensive, so following the advice of those who’ve trodden the same path in the
past is the best way to avoid making mistakes in the future.
I’d like to be able to tell you, as many self-proclaimed “gurus” do, that all you need is to learn a few “secret”
tricks to become a trader, but THAT’S just not true, and those looking for some magical formula are simply
wasting their time and energy.
The only way that works is to study, to learn from those who have real experience in the field.
That’s why I’ve concentrated my know-how and direct experience in this report on how to exploit the repe-
titive behaviour of some markets, such as seasonal patterns.
I hope my advice and experience will help you avoid the traps many traders fall into.

Andrea Unger, Founder of Unger Academy® and the only 4-Time World Trading Champion

Click on the link to download the code of the


indicator described below and watch
a video on how to use it!

https://autc.pro/BiasEN
BIAS SYSTEMS
ANDREA UNGER INTRADAY BIAS SYSTEMS 4

Markets often behave in a repetitive way, something that can in some ways be explained, and you can build
automated intraday and multiday strategies to exploit this behavior.

WHAT IS A “BIAS” SYSTEM?

If we’re talking about trading strategies, the term “bias” covers all the logics that attempts to exploit recur-
ring behaviors that may arise at quite regular intervals, using one particular financial instrument, or on a
basket of several financial instruments. In fact, to build this kind of system you have to analyze the behavior
of an instrument at various times of the day, week, month or year, and try to see whether the financial in-
strument has any regularly average trends in the interval of time studied. The most common bias is hours of
the day. In this case you try to see whether an instrument has a tendency to rise or fall for various consecutive
hours, and in a significant way within certain bands of the trading session.

VARIOUS EXAMPLES OF BIAS

Bias systems, as mentioned above, could be analyzed on the basis of different time intervals. The main ones
I’d like to draw the reader’s attention to are:
• Intraday bias: you attempt to analyze whether a financial instrument has a tendency to rise and/or fall
for various consecutive hours in the trading session;
• Intraweek bias: in this case you try to see whether there’s a up and/or down trend for a few consecutive
days (or portions of days) during the trading week;
• Intramonth bias: this type of strategy is evaluated in an attempt to see what happens buying on every
working day of the month and closing at the end of the same. In this way you try to see whether there’s
a trend in the working month that can be exploited;
• Seasonal systems: in this case you try to see whether there’s a seasonal trend in the year. The analysis of
this type of strategy requires a certain amount of experience however, due to the limited amount of data
available (in fact, there will be just a few events if you analyze data from the last decades).
ANDREA UNGER INTRADAY BIAS SYSTEMS 5

INTRADAY BIAS
SYSTEMS
ANDREA UNGER INTRADAY BIAS SYSTEMS 6

Intraday bias
This is a BIAS-based approach to developing automated strategies. And the idea is to check if there are time
windows within the trading session in which the financial instrument has an up or a down BIAS that could
be exploitable. You try to see whether the financial instrument, on average, rises or falls in a significant and
consecutive way for various hours during the day. To do this, simply create a script for your platform that
buys at the start of each (hourly) bar during the day, and closes the trade when the bar itself closes.

CODE 1 in EasyLanguage/PowerLanguage
Input: MyTime(0);
if Time=MyTime then buy next bar market;
if marketposition=1 then sell next bar market;

AN EXAMPLE OF THE CODE

To run this type of basic analysis we use the script in code box 1, coded in Power Language on the Multi-
Charts platform. At this point we apply the signal created to the chart and optimize the “MyTime” input to
see what happens if we trade the financial instrument every hour of the session. Now let’s try applying the
signal to Crude Oil Futures, using a 60 minute chart. The “MyTime” input is optimized from 0 to 2300 in
steps of 100, to check the average behavior of Crude Oil during the entire session.
You can clearly see from the highlighted regions that there are distinguishable periods of negative results
from periods of positive results (Figure F1), all of which are in buying crude oil at the beginning of the
hour and selling at the end of that hour. Also, remember that the session starts at 18:00 or 6:00 PM, which
is why the result at that point is empty because the platform considers the closing time of the instrument.
In this case note that the Crude Oil Futures’ session appears to be split into two parts: one part from 19:00
to 12:00 next morning shows a significant bearish trend (in fact there are many consecutive bars with nega-
tive results if trading long at that time), but in the part from 12:00 to 17:00 the average behavior is definitely
bullish. We’ll exclude the 17:00 bar from the analysis of the bearish part. In fact this is when Crude Oil
closes the session and trading starts again at 18:00 so it’s better to avoid working at times between different
sessions.
ANDREA UNGER INTRADAY BIAS SYSTEMS 7

F1 Optimization report - Bias hourly test on Crude Oil


FONTE: Ungeracademy®, screenshot obtained with MultiCharts

To get a better idea of the financial instrument’s behavior, you can export the optimization data to Excel and
plot the results of the single bars as histograms (Figure F2). At this point we can draw up a basic strategy:
• we’ll open a short position every day at 19:00 and close it at 12:00 the next day;
• we’ll open a long position at 12:00 and close it just before the end of the trading session.
ANDREA UNGER INTRADAY BIAS SYSTEMS 8

F2 Optimization report - Bias hourly test on Crude Oil scaled on Net Profit
FONTE: Ungeracademy®, screenshot obtained with Excel

As the long position will be closed at the end of the trading session (just before 17:00), I rewrote the entire
code on the basis of a 15-minute chart, so I can exit in a more precise way at the end of the session. In fact,
if I continued to use a 60-minute chart, I would have had to close the position 1 hour before the session
closed or as soon as the market opened again (at 18:00), altering the original idea; but with a 15-minute time-
frame I can tell the platform to exit 15 minutes before the end of the same session, at 16:45. This shouldn’t
have a significant impact on system performance, but should prevent unpleasant live trading problems that
might arise!

CODE 2 EasyLanguage/PowerLanguage
if Time>=1200 and Time<1300 then buy(“LE”) next bar market;
if Time>=1645 and Time<1700 then sell(“LX”) next bar market;
if Time>=1900 and Time<2000 then sellshort(“SE”) next bar market;
if Time>=1200 and Time<1300 then buytocover(“SX”) next bar market;

Code box 2 shows the code adapted to be used on a 15-minute chart (set to Exchange Time). The result of
the applied strategy can be seen in Figures F3, F4 and F5. The basic strategy appears to perform well and
produces results in all the backtested years (except for the last as it hasn’t reached year end yet), although the-
ANDREA UNGER INTRADAY BIAS SYSTEMS 9

re are major differences between the various years in the succession of the same. It’s important to emphasize
that 2008 was the only quite volatile year for Crude Oil and was one of the first years in which the market
was traded on electronic circuits. Therefore these factors may have altered the average trend we studied in
the previous optimization. In these cases, I recommend the reader ignore the first years of trading from the
historical data analyzed (2008 and 2009 in which the data are also quite “dirty”) and then repeat the optimi-
zation to see whether the results of subsequent years improve.

F3 Strategy Performance Report - Bias Strategy


on Crude Oil
FONTE: Ungeracademy®, figure obtained with MultiCharts

F4 Equity Line - Bias Strategy on Crude Oil


FONTE: Ungeracademy®, figure obtained with MultiCharts
ANDREA UNGER INTRADAY BIAS SYSTEMS 10

F5 Periodical Analysis - Bias Strategy on Crude


Oil
FONTE: Ungeracademy®, figure obtained with MultiCharts

AN INDICATOR TO FIND INTRADAY BIAS

I recently wrote the code for an indicator that plots the average trend of the financial instrument for each
bar of the day directly on the chart, to see if there was any bias.

F6 “Bias Explorer” Indicator


Average variation hour by hour on Gold
FONTE: Ungeracademy®, figure obtained with MultiCharts
ANDREA UNGER INTRADAY BIAS SYSTEMS 11

Figure F6 shows the average variation in monetary terms (which has already been multiplied by the coeffi-
cient of the instrument’s bigpoint value) of the average trend for each hour, in this case for Gold Futures.
The indicator is also used to set the value plotted on the chart as the cumulative sum, so as well as being able
to immediately see the average trend of each bar of the day, you can also see the cumulative trend in order
to make a direct hypothesis about which strategy to develop. In the case in question, at a glance you can
see consecutive hours when the market is bullish or bearish. We could develop a system using the following
rules:
• enter long at 10:00 and close the trade at 02:00 on the same day;
• enter short at 02:00 and close the trade at 10:00;

If we want to make this even easier to read we could plot the cumulative trend directly in the monetary value.
Remember, the value is reset again at midnight every day rather than when the session changes. The chart in
Figure F7, as mentioned above, can make it easier to find the relevant swing points in the session.

F7 “Bias Explorer” Indicator


Cumulative sum of the average of the price changes in monetary value at every hour of the day on Gold
FONTE: Ungeracademy®, figure obtained with MultiCharts
ANDREA UNGER INTRADAY BIAS SYSTEMS 12

Figures F8, F9, F10 and F11 show the results if we wrote the code for the system using the rules from the
previous chart (Figure F7).

F8 Strategy Performance Report - Bias Strategy on Gold


FONTE: Ungeracademy®, figure obtained with MultiCharts

F9 Equity Line - Bias Strategy on Gold


FONTE: Ungeracademy®, figure obtained with MultiCharts
ANDREA UNGER INTRADAY BIAS SYSTEMS 13

F10 Total Trade Analysis - Bias Strategy on Gold


FONTE: Ungeracademy®, figure obtained with MultiCharts

F11 Periodical Analysis - Bias Strategy on Gold


FONTE: Ungeracademy®, figure obtained with MultiCharts
ANDREA UNGER INTRADAY BIAS SYSTEMS 14

CODE 3 EasyLanguage/PowerLanguage - 60 minutes on Gold Future (exchange time)


if Time=0200 then sellshort(“SE”) next bar market;
if Time=1000 then buytocover(“SX”) next bar market;
if Time=1000 then buy(“LE”) next bar market;
if Time=0200 then sell(“LX”) next bar market;

Do you want to start making a profit with


Systematic Trading without wasting time
on discretionary analysis?

Book a FREE 45-minute Strategic Consulting Call


with a member of my team NOW, to see
how we can help you achieve your trading goals!

https://autc.pro/ReportEN
INTRAWEEK BIAS
SISTEMS
ANDREA UNGER INTRAWEEK BIAS SYSTEMS 16

Intraweek bias
This may also be referred to as the intraday seasonal BIAS, where we try to open positions at the beginning
of each day of the trading week and close them at the end of the day in order to discover any exploitable
biases.

WHAT IS AN INTRAWEEK BIAS?


An intraweek bias is the analysis of the average movements of a certain financial instrument during a week
on the stock exchange and it’s used to see whether the behavior of the financial instrument in question can
be exploited to a greater or lesser extent. The term “exploited” means whether a trading system can be cre-
ated that’s considered reliable, with logic based on the intraweek behavior of the financial instrument being
analyzed.

How do you calculate the intraweek average


trend?
There are many ways to calculate it. We can generalize and say that all we have to do is find a way to calculate
the price variations of each bar of the historical data for every day of the week on the stock exchange. Once
we have these data, we can analyze the results in an analytical way (using an Excel spreadsheet or your tra-
ding platform), or you can create a curve on a chart (to make it easier to interpret), calculating a cumulative
sum of the average variances of each bar in the week on the stock exchange. Personally, I prefer the second
solution, and various instruments can be used to put it into practice:
• some web sites: intradayseasonals.com generates this type of graphic representation (for free) and can
be a valid starting point;
• using data analysis applications (MatLab, Python, Excel, etc.): with data processing software you can
import the historical data of the financial instrument in question and write the code for an analysis of
this kind of trend, and display the results in a chart;
• using your trading platform: for example on MultiCharts and TradeStation you can run this type of
analysis and use the results as an indicator.

IntradaySeasonals.com analysis
As mentioned above, IntradaySeasonals.com gives you a free and easy-to-understand chart of the main
Futures and Forex financial instruments showing the cumulative sum of the intraweek average variances,
so the user can analyze these trends and use them to build trading systems. In my opinion it’s a good web
site that lets you run the principal analyses. You can’t however customize it or divide the historical data into
ANDREA UNGER INTRAWEEK BIAS SYSTEMS 17

different time sections, and this could represent an obstacle when checking the solidity of the same trend.
You can (at least partially) solve this problem by coding a system with data from the portal, then analyze the
solidity directly by examining the results of the system (for example by studying the regularity with the raw
data system). Another question to consider in relation to the data provided is how up-to-date the historical
data is, as the web site doesn’t specify the date of the last update for the data displayed, which rollover rule
and criteria were applied to the Futures’ contracts, and which flow the data are from (Figure F12).

Analysis using MatLab or other applications

F12 Intraweek Bias on British Pound Future


FONTE: IntradaySeasonals.com

As mentioned above, you can create your own instrument to analyze this type of trends. I decided to use
Octave, a programming language that’s very similar to MatLab and the interface and functions are quite
similar too. It’s freeware, but wasn’t developed specifically for trading (for this specific use) and you initially
need to set up the calculation processes. The disadvantage is that this all takes quite a long time, as does
studying the language.
The advantage is that by coding your own software you can choose exactly what data to use and how to use
the data (and know the rollover rules used), how to calculate what you want to obtain, and finally how to
display the results of your studies (graphically or analytically).
In particular, I chose to use the following type of calculation:
ANDREA UNGER INTRAWEEK BIAS SYSTEMS 18

1. I calculate the average difference between the close market price and the previous market price for every
bar of each day of the week;
2. I create a curve, which represents the cumulative sum of all the values obtained in the previous point.

This calculation is repeated on different portions of the historical data. In greater detail, the historical data
is divided into different portions and each section is analyzed using the process described; this is done to
check if there is any behavior that could potentially be exploited, in consideration of the different periods
analyzed, and to avoid being misled by average values that look good but aren’t confirmed for portions of
data from different periods.
The result obtained is shown in Figure F13, in which the day of the week is shown on the axis of the abscis-
sa (variations in the days are shown as portions and refer to each bar of the same day), while the cumulative
sum of the calculated average variation, expressed in monetary terms, is shown on the axis of the ordinates.

F13 Intraweek Bias on British Pound Future


FONTE: Ungeracademy®, figure obtained with Octave
ANDREA UNGER INTRAWEEK BIAS SYSTEMS 19

ANALYSIS USING MULTICHARTS AND TRADESTA-


TION
Some trading platforms such as MultiCharts and TradeStation can be used to run similar analyses to those
that can be obtained with other “Data Analysis” software. You can write the code for an indicator that shows
the weekly average trend using both MultiCharts and TradeStation. I coded a version that can also be used
on these platforms (Figure F14).

F14 “Bias Explorer” Indicator on British Pound Future


FONTE: Ungeracademy®, figure obtained with MultiCharts
ANDREA UNGER INTRAWEEK BIAS SYSTEMS 20

AN EXAMPLE OF ANALYSES ON RBOB GASOLINE


FUTURES (NYMEX)
On the basis of these premises, I’d like to take a practical case so you can reflect on the choices I make when
creating this type of system, in the hope that this will give you a good place to start.
After evaluating various products, I decided to try and develop this type of strategy starting with RBOB
Gasoline Futures (the gasoline Futures listed on the New York Marketile Exchange, now part of the CME
Group).
Figure F15 shows the chart you can download from intradayseasonals.com, for RBOB Gasoline Futures.

F15 Intraweek Bias on RBOB Gasoline Future


FONTE: IntradaySeasonals.com
ANDREA UNGER INTRAWEEK BIAS SYSTEMS 21

Note that some of the movements of the financial instrument appear to be recurrent:
• from Tuesday to Friday there appears to be a bullish bias during the afternoon until evening;
• during the entire week there appears to be a bearish bias in the early hours of the session, although of a
varying intensity, until the end of the morning (Italian time);
• the fall in the price that usually starts at the beginning of the week up to Tuesday, would appear to be the
most significant one, compared to the one that on average occurs on other days;
• the rise in the price that develops Friday afternoon appears to be the most significant, compared to what
on average occurs in other sessions during the week on the stock exchange (Figure F16).

F16 Most Significant Movements on RBOB Gasoline Future


FONTE: IntradaySeasonals.com
ANDREA UNGER INTRAWEEK BIAS SYSTEMS 22

At this point, to confirm my findings, I use the program I created in Octave to check whether the same
characteristics can be found, to see if there’s some regularity in these movements by studying the same phe-
nomenon, but on different portions of historical data (Figure F17).

F17 Intraweek Bias on RBOB Gasoline Future


FONTE: Ungeracademy®, figure obtained with Octave

On the basis of the chart in Figure F17, it would appear that the trends found previously are confirmed, in
particular note that:
• the trend of the red line and the blue line is similar, with reference to the movement that averagely
begins at the start of the stock exchange week, and this confirms the bias found in two different portions
of historical data. In fact the blue line only considers data from January 2010 to December 2013, while the
red line considers data from January 2014 to the latest available datum (in this case up to April 2018);
ANDREA UNGER INTRAWEEK BIAS SYSTEMS 23

• The same reasoning goes for the other side of the bias in question, in other words the long side. The
long side of the trend would also appear to be confirmed. The latter however appears to have lost in terms
of intensity compared to the previous period (shown by the blue line). Anyway, if we observe the scale of
the variations, also over the last 5 years it appears there was a long side with an average variation of around
$200, a value that certainly also makes the long side of the strategy interesting, despite the recent and pro-
bable flattening of the trend.
At this point we can try to code the strategy, which could initially follow these rules (that can be deduced by
referring to the times in the IntradaySeasonals.com chart):
• open a short position at 22:00 on Sunday (NY time), the equivalent of 04:00 on Monday (Italian
time);
• close the previously opened short position at 11:15 on Tuesday (NY time), the equivalent of 17:15
(Italian time);
• open a long position at 11:30 on Friday (NY time), the equivalent of 17:30 (Italian time);
• close the long position at 15:15 on Friday (NY time), the equivalent of 21:15 (Italian time);
I used this combination of rules and in my option they work (both in terms of NetProfit and on the basis
of other profitability indicators, avg trade first and foremost). However, the whole short side of the system
appears to have a significant Drawdown and quite marked periods of irregularity. I tried changing the times
to see if there was a good compromise that produced more stable results. In my opinion, improvements can
be obtained by shortening the duration of the trade on the short side, and closing the short position earlier.
In particular, I noted several improvements closing the short position on Monday at 16:30 (NY times), the
equivalent of 22:30 Italian time, in other words half an hour before the trading session ends. In this way the
NetProfit and Avg Trade are sacrificed slightly, but you do have a more “tradable” system (from a psycholo-
gical point of view) with greater constancy in terms of results.

CODE 4 EasyLanguage/PowerLanguage
If dayofweek(date)=5 and Time=1130 then
buy(“LE”) next bar market;
if dayofweek(date)=5 and Time>=1515 then
sell(“LX”) next bar market;
if dayofweek(date)=0 and Time>=2230 then
sellshort(“SE”) next bar market;
if dayofweek(date)=1 and Time>=1630 then
buytocover(“SX”) next bar market;
ANDREA UNGER INTRAWEEK BIAS SYSTEMS 24

The results obtained by applying this strategy can be seen below. The system was tested using MultiCharts,
fed with TradeStation data on a 5-minute timeframe and the historical period considered was from January
2010 to July 2019. As for the results in Figures F18 - F23, we can make the following considerations:

• NetProfit is interesting on both sides of the system: approximately $110,000 for the long side and
$143,000 for the short side;
• avg trade is good and on average should avoid excessive impact from commissions and slippage: ap-
proximately $230 on the long side and $300 on the short side;
• the equity curve shows good strategy constancy for almost all the historical data considered. There were
a few difficulties with the system in 2017 and 2018. 2019 however seems to produce good results, so we
could assume that the difficulties in the last two years have ceased and system performance is once again
quite regular;
• if we observe the Annual Period Analysis, note that in the current year the Avg Trade would be approxi-
mately $260 ($13,000 NetProfit/50 trades placed), which confirms the sustainability of the system also
in the more recent period (current year).

F18 Strategy Performance Analysis - Bias Intraweek Strategy on RBOB Gaso-


line
FONTE: Ungeracademy®, figure obtained with MultiCharts
ANDREA UNGER INTRAWEEK BIAS SYSTEMS 25

F19 Equity Line with Drawdown - Intraweek Bias Strategy on RBOB Gasoline
FONTE: Ungeracademy®, figure obtained with MultiCharts

F20 Equity Line - Intraweek Bias Strategy on RBOB Gasoline - Long side
FONTE: Ungeracademy®, figure obtained with MultiCharts
ANDREA UNGER INTRAWEEK BIAS SYSTEMS 26

F21 Equity Line - Intraweek Bias Strategy on RBOB Gasoline - Short side
FONTE: Ungeracademy®, figure obtained with MultiCharts

F22 Total Trade Analysis - Intraweek Bias Strategy on RBOB Gasoline


FONTE: Ungeracademy®, figure obtained with MultiCharts
ANDREA UNGER INTRAWEEK BIAS SYSTEMS 27

F23 Annual Period Analysis - Intraweek Bias Strategy on RBOB Gasoline


FONTE: Ungeracademy®, figure obtained with MultiCharts

OTHER MARKETS THIS TYPE OF ANALYSIS CAN


BE USED ON
I tried to apply this type of study also on other markets, with interesting results on some. I refer in particular
to British Pound Futures, EuroFX Futures, the Futures of the principal US indexes (Mini S&P 500, Nasdaq
100, Mini Dow-Jones 30) and Gold Futures.
Our test specimen for this version of the approach will be the eMini S&P500 Future at CME.
• Tool: Mini S&P 500 (CME)
• Session: 5:00 PM to 4:00 PM (next day) GMT -6 (Chicago Time)
• Data: IQFeed
• Test period: January 2008 to March 2018
• Platform: MultiCharts

F24 Optimization Report - Day by day on eMini S&P500 Future


FONTE: Ungeracademy®, figure obtained with MultiCharts
ANDREA UNGER INTRAWEEK BIAS SYSTEMS 28

As you may notice in the first column (Figure F24), there is the optimization parameter I have named “My-
Day,” whose values correspond to the days of the week; hence, 1-5 referring to Monday through Friday,
respectively, with the non-trading weekends excluded. And our test yielded some interesting variations in
the profits between the days. For example, on the average trade column it seems Tuesday and Thursday, for
whatever reason, have yielded very high values in comparison; furthermore, the same days also seem to have
much lower maximum drawdowns. As such, it may be beneficial to create and implement a strategy based
on this concept. Perhaps it would not be enough to trade a system based off of this rule, but it nevertheless
provides a very important and insightful edge on those two days.

Do you want to start making a profit with


Systematic Trading without wasting time
on discretionary analysis?

Book a FREE 45-minute Strategic Consulting Call


with a member of my team NOW, to see
how we can help you achieve your trading goals!

https://autc.pro/ReportEN
INTRAMONTH BIAS
SYSTEMS
ANDREA UNGER INTRAMONTH BIAS SYSTEMS 30

Intramonth bias
We have covered both instances of intraday seasonal BIAS in previous sections. Here, we will see the more
conventional idea of seasonality, which is identified across the months to distinguish ascending or descen-
ding monthly BIAS.

HOW DO YOU CALCULATE THE INTRAMONTH


AVERAGE TREND?
Calculate the average price variations for every day of the month; in fact it’s the same principle applied above
for intraweek patterns. The only difference is that the calculation is done on the basis of the month instead
of the week. Note that there are two ways to calculate the intramonth average trend:
1. calculating it for the days of the month: in this case you calculate the average of the variations from
the close of the current session to that of the previous day, for every calendar day of the month. Note
however that in every month there will be days for which there’s no data, both because most financial
markets are closed for the weekend and holidays, and because some months are shorter than others;
2. the second method involves counting the current working day in each month and therefore considering
the working day (or trading day) in the month. In practice, you calculate the average variances from the
close to the previous session for every working day of the month.

Unfortunately, to date I haven’t found any free source online to recommend; but the good news is, you can
study these trends in various ways using the most popular platforms:
• exporting the data required for this type of analysis to process the data with Excel or another application
(e.g. MatLab, Octave, Python);
• or you can plan a simple backtest for every trading day of the month and use the results to analyze the
trend for each day.
ANDREA UNGER INTRAMONTH BIAS SYSTEMS 31

MATLAB/OCTAVE ANALYSIS
As mentioned above, you can analyze this kind of trend using other programs such as MatLab, Octave or
Python. I chose Octave and also implemented a study of the intramonth patterns in the program I used for
the intraweek patterns. The functions in Octave are very similar to MatLab and you can work quite efficient-
ly on matrixes, so it’s an excellent application for this kind of analysis, and it’s free too. Obviously the pro-
gram wasn’t designed with pre-set functions for this specific task, so you do have to code all the operations
to get the result you’re looking for, which does take some time. The advantage, on the other hand, is that you
can customize the entire calculation process to suit your requirements.

In particular, I set up the program to perform the following operations:


1. calculate the summation of the variations for every trading day of the month between the close of the
current bar and the previous one;
2. divide all the values found for the average number of events. In this way the end-of-month data that
occurs less often, has less of an effect on the end result;
3. the cumulative curve of the average variances is shown in a chart, weighted with the criterion described
above.
At the end of the process you obtain a chart like the one in Figure F25, in which the trading day of the
month is on the axis of the abscissa, and the monetary value of the cumulative sum of the weighted average
variances in relation to the average events that occurred, is shown on the axis of the ordinates.

F25 Intramonth Bias on Cru-


de Oil Future
FONTE: Ungeracademy®, figure obtai-
ned with Octave
ANDREA UNGER INTRAMONTH BIAS SYSTEMS 32

ANALYSIS USING MULTICHARTS AND EXCEL


With some platforms like MultiCharts and TradeStation you can export the principal data of a financial
instrument to a text file, so it can easily be analyzed in Excel or another electronic spreadsheet program.
I wrote a script that can be used both as an indicator and a signal with MultiCharts, that exports both the
average value of the variations for each trading day of the month, and the cumulative sum of the same va-
riations, weighted in relation to the average events that occurred. Therefore the values exported can easily
be imported into Excel and analyzed in quite a simple and intuitive way.

F26 Analysis of average daily changes on Feeder Cattle Future


FONTE: Ungeracademy®, figure obtained with Excel
ANDREA UNGER INTRAMONTH BIAS SYSTEMS 33

F27. Analysis of
the cumulative
variation of the
average on a daily
basis on Feeder
Cattle Future
FONTE: Ungeraca-
demy®, figure obtained
with Excel

F28.Custom Future Setup - Feeder


MultiCharts
FONTE: MultiCharts
ANDREA UNGER INTRAMONTH BIAS SYSTEMS 34

AN EXAMPLE OF AN ANALYSIS ON FEEDER


CATTLE FUTURES (CME)
On the basis of these premises, I’d like to give you an application example on Feeder Cattle Futures listed
on the Chicago Mercantile Exchange (CME). Feeder Cattle Futures are characterized by scarce liquidity and
they aren’t traded a lot (average volumes per session are approximately 5,000 contracts), but these Futures
are strong trend followers: they are therefore quite volatile with quite significant price swings that let you
trade prolonged trends.
The purpose, in the case in question, is to try and improve a trading idea that works due to its nature quite well
with Feeder Cattle Futures, using breakout logic on the previous day’s limit levels, so it’s a very simple system.
The code is written for MultiCharts/TradeStation, the instrument used is Custom Futures on Feeder Cattle
Futures, and the rollover criterion is based on the Open Interest of the next contract compared to the cur-
rent one.

CODE 5 in formato EasyLanguage / PowerLanguage


buy next bar highd(1) stop;
sellshort next bar lowd(1) stop;

The initial system code is quite banal (code box 5), but the breakout and trend follower behavior of the in-
strument would appear to be confirmed. In the images of the enclosed report (Figures F29-F30), note how
the financial instrument responds in a positive way to the applied logic. In fact, the resulting equity curve is
certainly encouraging, despite the fact it’s a raw data motor rather than a finished system. Furthermore, note
that the average trade is just $112, mostly concentrated in the central part of the backtest period and this
doesn’t offer protection from the impact of commissions and slippage, even more so as this is an instrument
with scarce liquidity.

F29. Equity Curve with Drawdown (unfiltered breakout on Feeder Cattle Future)
FONTE: Ungeracademy®, figure obtained with MultiCharts
ANDREA UNGER INTRAMONTH BIAS SYSTEMS 35

F30. Total Trade Analysis (unfiltered breakout on Feeder Cattle Future)


FONTE: Ungeracademy®, figure obtained with MultiCharts

We can try to see if there’s bias in the month when it’s best to trade only long and a part when on the other
hand it’s best to trade only short. To do so, we can try to find any trends using the previous charts (31).

F31. Average Daily Trend (Feeder Cattle Future)


FONTE: Ungeracademy®, figure obtained with Excel
ANDREA UNGER INTRAMONTH BIAS SYSTEMS 36

On the basis of the chart in Figure F31 it would appear that there are mainly two alternating phases in the
trading month:
• from the 3rd day of trading in the month until the 14th there appears to be a marked bearish trend. In
fact we can see that on average there are many consecutive days in which the price falls and the series is
interrupted by just a few days in which the price rises;
• from the 15th day of trading in the month until the 2nd day of the following month on the other hand,
there appears to be a marked bullish trend. Also in this case, note how the series of consecutive bullish
days is quite marked and isn’t affected to any great extent by the few bearish sessions found on average
in that period of time.

Therefore, we can try to use the days found with this type of analysis as a filter for the system written pre-
viously. After a few tests, I found the application of the filter to be sufficiently valid when used as follows:
• trade long only from the 15th trading day of the month;
• the long trade will be closed on the 1st possible day of the following month;
• short positions can only be opened before the 15th trading day of the month;
• short trades will be closed from the 15th working day of the same month;
• the entry triggers are the same as in the previous version (previous day’s limit breakout).
the strategy code can be seen in code box 6.

CODE 6 EasyLanguage/PowerLanguage format


var: TDOM(0);
if month(d)<>month(d)[1] then TDOM = 0;
if sessionlastbar[1] then TDOM = TDOM + 1;

if TDOM<15 then sellshort next bar lowd(1) stop;


if TDOM>=15 then buy next bar highd(1) stop;
if TDOM>=15 then buytocover next bar market;
if TDOM<15 then sell next bar market;

When a filter is applied, note (Figures F32-F33) the following:


• the Net Profit of the strategy decreased, but in a pretty insignificant way;
• the Max Drawdown increased from approximately $17,500 to $22,500;
• the Average Trade increased fourfold from $112 to $446;
• the equity curve of the system is more irregular than the first one shown;
• The average time frames for holding positions for each trade has quadrupled, from about 42.6 bars
(15-minute) to 176.5 bars.
ANDREA UNGER INTRAMONTH BIAS SYSTEMS 37

F32. Equity Curve with Drawdown (unfiltered breakout on Feeder Cattle Future)
FONTE: Ungeracademy®, figure obtained with MultiCharts

F33. Total Trade Analysis (unfiltered breakout on Feeder Cattle Future)


FONTE: Ungeracademy®, figure obtained with MultiCharts
ANDREA UNGER INTRAMONTH BIAS SYSTEMS 38

In my opinion the increase in the Max Drawdown is mostly due to the length of time that each position
opened is traded on the market: in fact, if the market is against the open position, you remain in the same
position until the end of the period set in the trading rules and this can expose the trader to severe risks.
Therefore, while acknowledging that the applied filter does produce a partial improvement (mainly in ter-
ms of the average trade), it would be necessary to implement an effective method to manage the positions
opened in a sustainable way. Some possible solutions might be: using a stop-loss, a trailing stop and/or con-
figuring a time-based exit trigger.

OTHER MARKETS THIS TYPE OF ANALYSIS CAN


BE USED ON
While attempting to apply this type of study I noted that the filter could also respond well with other com-
modities’ futures: in particular with some energy futures such as Crude Oil, RBOB Gasoline and Heating
Oil, listed on the NYMEX.
ANDREA UNGER INTRAMONTH BIAS SYSTEMS 39

GENERAL CONCLUSIONS
Some readers may be asking themselves a question that springs spontaneously to mind: “Can I choose, also
in this case, the best days on which to trade long or short on the basis of the intramonth pattern of a finan-
cial instrument, and only trade on the most promising days?” I definitely wouldn’t recommend it, because
the number of events might be very low with this filter in relation to an intraweek approach. If we consider
that usually it’s a good idea to run backtests from 2008 or 2010 depending on the instrument, this means
we have a statistical sample of around 10 years of historical data, the equivalent of about 120 months or
520 weeks. Obviously the sample that refers to every day of the week is much more representative than one
that refers to every working day of the month, and as a consequence if we considered trading only on the
most promising days, it would be much safer to use the intraweek approach than the intramonth approach.
I’d recommend looking for ample areas of stability in the month, such as that of the Feeder Cattle Futures
in the current article, and finding windows in the average trend that are ample enough to avoid overfitting.

F34. Average Daily Trend (Crude Oil Future)


FONTE: Ungeracademy®, figure obtained with Excel
ANDREA UNGER INTRAMONTH BIAS SYSTEMS 40

In the example shown in Figure F34, applying the analysis to Corn Futures, note that no strong areas of
stability can be found (Figure F35). In my opinion it doesn’t make much sense to concentrate on the best
days, as there doesn’t appear to be a marked alternance in consecutive bullish or bearish days, and this could
make a system unstable and result in negative future performance.

F35. Average Daily Trend (Corn Future)


FONTE: Ungeracademy®, figure obtained with Excel

For this demonstration, I will be using different tools, like data from Yahoo Finance monthly data, which is
completely free, and the ubiquitous Microsoft Excel for my testing platform.
• Tool: S&P 500 (CME)
• Data: Yahoo Finance
• Test period: January 1950 to March 2018
• Platform: Microsoft Excel
The setup for the test is simply to calculate the percentage change in the instrument’s price compared to the
previous month. And this calculation will be limited only to the close price of the monthly data. To carry it
out, I imported all the monthly data into Excel. After plotting the buy-and-hold on the chart below, I simply
calculated the percentage Delta in respect to the previous month.
ANDREA UNGER INTRAMONTH BIAS SYSTEMS 41

F36 Buy&Hold on S&P500 index from 1950 to 2018


Fonte: Ungeracademy®, figure obtained with MultiCharts

As you can see (Figure F36), the BIAS appears strongly bullish in general, apart from some crises in a few
years. I then tabulated the monthly BIAS results.

T1 Monthly Analysis of Buy&Hold on S&P500 index from 1950 to 2018


Fonte: Ungeracademy®, figure obtained with Excel
ANDREA UNGER INTRAMONTH BIAS SYSTEMS 42

And we notice there is a particularly important area of growth in the market within the October to Decem-
ber range, where the percentages have remained consistently positive when averaged across the many years.
And it seems the phenomenon even extends into January. Additionally, we notice that during the summer
the market appears to have more of a bearish trend throughout, except in July for some reason. But for July,
when we delve deeper we find that its positivity is not strong because its average of 55.9% is lower than the
general average of 59.7% for all the other months.
So, in general, what to read from this listing is that from May to September, there is a sort of market wea-
kness compared to the other part of the year where the growth averages are much more higher in general
(with the exception of February). Additionally, it also appears that the average increase of the average net
change as a percentage is extremely high at 0.70%; which is not bad at all.
If you would like to study this more in the details, I recommend you visit the following websites:

1. Moore Research Center (Figure F37): where you may access the seasonal pattern market area; note
that the link is not public. The website is interesting and useful for this purpose, but I have to note that the
contracts on the Futures here are not back-adjusted. Therefore, do expect to find some really strange gaps.
Additionally, you have to keep that under consideration because it may yield some false seasonalities.

F37 40 years seasonality on Feeder Cattle (1978-2017)


Fonte: Moore Research Center Inc.
ANDREA UNGER INTRAMONTH BIAS SYSTEMS 43

2. Seasonalgo (Figure F38): this website lets you conduct backtests specifically on this kind of phe-
nomena, and it will create a report for each year with the results. In the chart cropped below, I plotted the
normalized stacked curves for the crude oil December contract.

F38 Crude Oil Analysis


Fonte: SeasonAlgo.com

Also, on this website you will not be able to simply use a back-adjusted instrument each month; you will
have to specify the expiration of the contract. This is because some contracts may have different reactions in
different periods of the year. And this particular curve that is called the normalized stacked lets you explore
how the seasonality was in the latest N years. The example below if for only the latest 10 years plus 1, and
this is normalized on a scale from 0 to 100. So, you will be able to see if the season of the current year is in
line with the previous years or not—or, in any case, if compared to the average movement of the underlying
in a certain season. This website is not free; however, I find it extremely interesting and useful for exploring,
analyzing and exploiting the monthly seasonality phenomenon on instruments.
ANDREA UNGER INTRAMONTH BIAS SYSTEMS 44

Do you want to start making a profit with


Systematic Trading without wasting time
on discretionary analysis?

Book a FREE 45-minute Strategic Consulting Call


with a member of my team NOW, to see
how we can help you achieve your trading goals!

https://autc.pro/ReportEN
SEASONALITY
ANDREA UNGER SEASONALITY 46

The seasonality of Indexes

EMINI S&P500
Analizziamo la stagionalità del Mini S&P 500 quotato al CME con periodo di backtest che va dal 2000 al
2018.
Come potete notare in figura F39, negli ultimi anni l’indice presenta una tendenza al rialzo verso la fine
dell’anno, che pertanto costituisce il periodo più forte; analizzando invece la curva blu (che invece fa riferi-
mento agli anni dal 2008 al 2013) il movimento è leggermente più debole, e questo è probabilmente dovuto
anche agli anni di crisi del 2008, che hanno abbassato un po’ questa media. Ad ogni modo, da ottobre in poi
vi è comunque un movimento di leggera crescita. Su questo tipo di grafico la cosa non è molto visibile, anche
perché ad essere raffigurata non è la percentuale, bensì una semplice variazione monetaria dello strumento;
lo scopo del grafico è infatti quello di aiutarci a capire come si muove questo future in termini monetari.
Come nei casi precedenti, anche qui possiamo notare, soprattutto recentemente, una certa turbolenza nei
mesi estivi fino a settembre, che si dimostra anch’esso alquanto indeciso, soprattutto nella curva blu.

F39 Seasonality on S&P500


From 1 to 2 is the period from beginning to end of January, from 2 to 3 is the period from beginning to end of
February and so on, up to 12-13 which corresponds to the trend from beginning to end of December.
Fonte: Ungeracademy®, figure obtained with MATLAB
ANDREA UNGER SEASONALITY 47

Our first set up will be on the eMini S&P 500 future at the CME:
• Tool: Mini S&P 500 (CME)
• Data: Trade Navigator
• Test period: 2000 to 2018
• Platform: Octave
The considered period will be the same for all instruments on our list, 2000 to 2018. And I will not be going
too deep into the details of any one instruments as the objective here is to get an idea on the process and
obtain enough knowledge to set you on the path of studying the topic deeper.
The chart above shows the seasonality on the instrument. And in fact, if you compare this to our previous
analysis of the SP 500 index, you will find that the behavior is pretty similar; with a positive seasonality ap-
parent in the latter part of the year.
But in this particular chart, we have three different lines. The black line refers to the entire range of the
testing period. However, the blue and red lines are sub-divisions of the former, with the blue from January
2008 to December 2013, while the red is from January 2013 to April 2018. This segmentation allows for a
sort of confirmation of the BIAS behavior if we detect the same across both lines. Furthermore, the avera-
ge Delta on the vertical axis is simply expressed in a monetary amount. So, for instruments hosted in USD,
its unit will be USD—and otherwise for other cases, even if the symbol remains as “$.”
ANDREA UNGER SEASONALITY 48

DAX
For better clarity, we will carry out the same analysis on other instruments, starting with the DAX at the
Eurex exchange.

And similarly, we notice that the final part of the year is the strongest and most bullish period of the year.
But also, there is an area that goes from March to approximately the middle of May where we have a bullish
behavior. Also in the region between May and September, there is a sense of a market weakness. And there
are some retracements found at different periods within, but in general there is a marked weakness from
mid-May to approximately September. A point of note is to try to establish common areas between the red
and blue lines so the process works by confirming itself between the two different periods.

F40 Seasonality on Dax


From 1 to 2 is the period from beginning to end of January, from 2 to 3 is the period from beginning to end of
February and so on, up to 12-13 which corresponds to the trend from beginning to end of December.
Fonte: Ungeracademy®, figure obtained with MATLAB
ANDREA UNGER SEASONALITY 49

The seasonality of Commodities

CRUDE OIL
Next we have the Crude Oil future, and here we can note, at first sight, the present of a strong bearish BIAS
in the second part of the year.

F41 Seasonality on Crude Oil


From 1 to 2 is the period from beginning to end of January, from 2 to 3 is the period from beginning to end of
February and so on, up to 12-13 which corresponds to the trend from beginning to end of December.
Fonte: Ungeracademy®, figure obtained with MATLAB

And in fact, the seasonality here is pretty strong and evident from about October all the way to December,
with perhaps a continuation until mid-January. Also, there is similar but slightly weaker seasonal from July to
approximately the end of August.
Secondly, while we could establish a bullish seasonality on both lines from about the middle of March until
the end of May, I have to admit that crude oil has had some really strange years. I remember 2008 was a really
strong year, and its outlier values may pull the general averages towards false conclusions. Which brings me
to a point of caution: do not take the information you derive from here as a given; you still have to rationa-
lize and evaluate the data by conducting more in-depth studies.
ANDREA UNGER SEASONALITY 50

NATURAL GAS

F42 Seasonality on Natural Gas


From 1 to 2 is the period from beginning to end of January, from 2 to 3 is the period from beginning to end of
February and so on, up to 12-13 which corresponds to the trend from beginning to end of December.
Fonte: Ungeracademy®, figure obtained with MATLAB

Natural Gas above has a tentatively strong bearish trend throughout, and this is also due in part to the
back-adjustment policies on the contracts during the year. But in general, we may find a bearish seasonality
on the later months of the year; i.e. from mid-September to the end of December. Perhaps this trend could
even be extended to the end of February in the next year, but it is a weak extension in my opinion.
ANDREA UNGER SEASONALITY 51

GOLD
We find a rather strange image on the Gold future. Although the bearish seasonality found in the latter
months on the red line appears interesting, it is not complemented on the blue line. It seems to be mirrored
only around December. As such, I would avoid the seasonality trend from September to the beginning of
December simply because there is no confirmation on the other period. If we set a condition for our analy-
sis, it only makes sense that we should respect it.
However, something interesting that does reflect on both lines is the small bullish seasonality in the first
parts of the year; from January to mid-February. Additionally, there is an interesting but complex seasonality
from mid-February to mid-April—which I personally presume would be difficult to be traded profitably.
But only backtests on these hypotheses could yield additional and decisive information because false seaso-
nalities do exist.

F43 Seasonality on Gold


From 1 to 2 is the period from beginning to end of January, from 2 to 3 is the period from beginning to end of
February and so on, up to 12-13 which corresponds to the trend from beginning to end of December.
Fonte: Ungeracademy®, figure obtained with MATLAB
ANDREA UNGER SEASONALITY 52

ORANGE JUICE
Here we have the Orange Juice. In my opinion, this is one of the most interesting seasonalities found in all
futures. And you notice at first sight that there is nothing interesting in the first part of the year; however,
from October (or the middle of October if we are going for commonalities) there appears a very interesting
bullish seasonality. And then immediately after it, there commences an important bearish seasonality at
around beginning of December all the way to the end of the year. And serving as confirmation, we observe
the same bearish seasonality on the blue line, a very important stipulation, as explained.

F44 Seasonality on Orange Juice


From 1 to 2 is the period from beginning to end of January, from 2 to 3 is the period from beginning to end of
February and so on, up to 12-13 which corresponds to the trend from beginning to end of December.
Fonte: Ungeracademy®, figure obtained with MATLAB
ANDREA UNGER SEASONALITY 53

CORN
The seasonality chart above is for the Corn future, which in my opinion is not that interesting. At first sight,
I notice that until June there appears to be no volatility on the instrument; so, it simply cannot be traded,
of course, because the average trade in any case will not be sustainable. But in the second half of the year,
some strong volatility seems to appear.
But personally, I do not notice an interesting seasonality in this period either. Perhaps September provides
something tradable, but it is too weak in the region represented by the red line. And generally, the red period
does not seem to match the blue period. So, I would avoid trading the seasonality approach on this instru-
ment.

F45 Seasonality on Corn


From 1 to 2 is the period from beginning to end of January, from 2 to 3 is the period from beginning to end of
February and so on, up to 12-13 which corresponds to the trend from beginning to end of December.
Fonte: Ungeracademy®, figure obtained with MATLAB
ANDREA UNGER SEASONALITY 54

WHEAT
On Wheat above, we find a similar situation to Corn where the volatility is too low to be tradable, especially
on the red line which shows almost no volatility throughout the year. And with the exception of the Au-
gust- September area, the red line does not seem to reflect the movements of the blue line at all. Still, this
might be worth running backtests for better clarity, but I doubt this instrument could yield any insightful
seasonality strategies.

F46 Seasonality on Wheat


From 1 to 2 is the period from beginning to end of January, from 2 to 3 is the period from beginning to end of
February and so on, up to 12-13 which corresponds to the trend from beginning to end of December.
Fonte: Ungeracademy®, figure obtained with MATLAB
ANDREA UNGER SEASONALITY 55

SOYBEANS
The last instrument on our list is the Soybean future. And to be honest, Soybeans does not look too good.
But we may notice that it seems to be rising in the first months, so there might be a little seasonality there.
Afterwards, it seems to go down on both red and blue lines, and then there appears a strong rebound around
March-April. So, we will have to verify this phenomenon before making any conclusions. Nevertheless, it
seems to start a consistent uptrend from the beginning of April until the first weeks of June, where there
seems to be a very strong increase in the volatility of the instrument. And even though they do not share the
same strength, we observe the same scenario on both red and blue lines.
And in the latter parts, it seems that there is a bearish seasonality in September that is also noticeable on
both red and blue lines. While the very last parts of the year yield nothing interesting, in my opinion. And
that is all for the section.

F47 Seasonality on Soybeans


From 1 to 2 is the period from beginning to end of January, from 2 to 3 is the period from beginning to end of
February and so on, up to 12-13 which corresponds to the trend from beginning to end of December.
Fonte: Ungeracademy®, figure obtained with MATLAB vcdsz<zgfds<cvb vcxz<
Do you want to start making a profit with
Systematic Trading without wasting time
on discretionary analysis?

Book a FREE 45-minute Strategic Consulting Call


with a member of my team NOW, to see
how we can help you achieve your trading goals!

https://autc.pro/ReportEN

You might also like