Tuesday, 30 January 2018

FANG Stocks, tech portfolio

Everyone knows about the FANG stocks rally. But what does FANG mean? It’s a group of technology stocks, Facebook, Amazon, Netflix, and Google. If we look back to the beginning of 2015, we would regret not having invested in these stocks. Please bear in mind that it’s my first article using Python, so it can seem a little bit simple.


Stocks summary


Facebook

       Facebook stock, own elaboration with python and Quandl

Facebook is the biggest social network. It enables users to share opinions, ideas, photos, videos, and other activities online. It´s involved in the development of social media applications for people to connect through electronic devices. Its products include Facebook, Instagram, Messenger, WhatsApp, and Oculus. The revenue comes mainly from advertising.

Amazon

         Amazon stock, own elaboration with python and Quandl

It´s engaged in the provision of online retail shopping services  The efficiency of its distribution centers makes difficult to compete with Amazon. In addition, they have Amazon Web that it’s focused on the global sales of computing, storage, database, and AWS service offerings for start-ups, enterprises, government agencies, and academic institutions.

Netflix

        Netflix stock, own elaboration with python and Quandl

This company provides subscription service streaming movies and TV episodes over the Internet and sending DVDs by mail. Netflix obtains content from various studios and other content providers through fixed-fee licenses, revenue sharing agreements and direct purchases.

Google

        Google stock, own elaboration with python and Quandl

Alphabet operates as a holding company with interests in software, health care, transportation and other technologies. It operates through 2 segments: Google and Other Bets segments. The first one includes the following services: Search, Ads, Commerce, Maps, YouTube, Apps, Cloud, Android, Chrome, Google Play as well as hardware products, such as Chromecast, Chromebooks, and Nexus. The other one includes: as Access or Google Fiber, Calico, Nest, Verily, GV, Google Capital, X, and other initiatives.

Individual Stocks

At this point, I believe that you have your own preferences but let´s imagine that we are in 2015. Wouldn’t be better to create a portfolio with all of them?  Also, it´s another way to diversify our portfolio


    Log returns own elaboration using python

We can see how the individual stocks performed in the period. As you can see Netflix has been the more volatile. 


                                                                 Arithmetic Returns of the individual stocks

Google was the worst performer but it doubled in value. I would like to remind you that the Nasdaq index has returned 63% since 2015.
Before we put together all these stocks, let´s check the individual distributions:


             Log return distributions own elaboration

All of them have in common that the extreme observations are positive, which explains in part the reason of the rise in these stocks.

The Portfolio

After reviewing these companies and considering that they have different business units, we decide to create a portfolio. In order to make it simple, we can assign the same weight for each stock, in this case 25% of the initial capital. 

     Portfolio statistics and log returns distribution own elaboration

Considering the long run and this portfolio´ strategy (buy and hold), it´s easy to think that the majority of the daily returns are bigger than zero. This is confirmed by the chart above.
Is it safe to build a portfolio like we have done?  No, some of the reasons are that it´s not properly diversified and the correlation between the assets is positive. Luckily the companies have diversified some of their activities and they are heavily investing in technology which will bring revenue in the future. 
The portfolio return has been 104%.

                                                            Portfolio return own elaboration

Now it's the time to check the risk:

    Portfolio drawdown history, own elaboration

One of my favourites risk metrics is the drawdown. I created this chart showing the portfolio drawdown over the time. The maximum drawdown was 14.10%. This figure surprised me but the main concern is that the stock market raised on a daily basis

Sum up

I hope you like it. We have seen how the main tech portfolio has behaved since 2015. I wouldn’t invest in this kind of portfolio for the reasons mentioned above. In addition, I think that the index rally has been supported by an accommodative monetary policy. Using Python and Quandl has been great and I hope to bring more content in the future. Thanks.

Have a good trading!!


Disclaimer


I wrote this article myself, and it expresses my own opinions that shouldn't be used as a trading advice. Trading carries considerable risk due to the high leverage involved

#Alphabet #Amazon #drawdown #Facebook #FANG #Google #investing #maxdrawdown #Netflix #portfolio #python #quandl #stocks #Trading

Sunday, 21 January 2018

Canadian interest rate decision, the falling USD and the indexes rally


We had a busy week in terms of news and economic releases. The UK CPI and the European CPI were in line with the expectations. The Bank of Canada raised the interest rates. We saw a better than expected building permits in the US. Maybe the biggest surprise on Friday was the UK Retail Sales that show the third-worst figure in the last 5 years. On the other hand, the speculation of the government shut down drove the USD down. Sadly, now it’s official, as it happened yesterday night.


Interest Rate decision

    Source: TradingView, USD/CAD (FXCM), 15 min

As you can image, the CAD went up with the interest rate decision. The market participants expected a hawkish statement considering that the Canadian economic outlook is expected to keep strong and allow to raise the interest rates in the future. Sadly, the BOC showed its dovish side confirming that some monetary accommodation will be needed.


     Source: TradingView, USD/CAD (FXCM), daily

We can see that the USD recovered in the last 2 trading days after the dovish comments of the Bank of Canada and the uncertainty about NAFTA.


US Dollar Index


    Source: TradingView, US Dollar Index, daily

The USD has been falling during the last 3 months while the bond yields have been raising. If we only consider the FED policy, the dollar should be going up. On the other hand, and in my humble opinion, some policies are not coordinated to meet certain economic targets. In addition, some political issues such as the government shut down are reflected on the USD.

Unstoppable Indexes

DAX

    Source: TradingView, DAX future, daily

The Dax is trading on its all-time highs and seems that it´s not going to stop. The European indexes are not as directional as the American indexes. One of the biggest risks, in my opinion, is an expensive euro because this will slow down the trading with other economic areas.  The ECB will hold a meeting next week that will guide the traders about the future economic policy.

FTSE

     Source: TradingView, FTSE future, daily

The FTSE is another example of great performance. The recovery since the Brexit referendum has been incredible. The uncertainty of the possible split up with Europe hasn´t affected the index. It´s true that after the referendum the British Pound fell a lot and helped some funds to take bigger positions in the stock market.

US indexes


S&P 500

     Source: TradingView, SP500 future, daily



     Source: TradingView, Dow Jones future, daily

The last 2 charts are identical. If an investor opened positions in 2013, now he would have doubled his investment. Some of the biggest investments banks have warned their clients about a possible big sell off to take profits. One of the reasons behind this is that these indexes have never been overbought in their history. In addition, we have seen the largest inflows ever in equity funds.  When everyone is buying after the biggest rally ever, it´s better to take profits while we can. If you don’t believe in this theory, ask the bitcoin investors that bought the cryptocurrency at 19000$.

Opinion

We have seen interesting movements this week. Everyone is monitoring the Central Banks statements. We need to focus on the Bank of Japan and the European Central Bank next week. I would like to see how the ECB deals with a strong Euro. I don’t think that the US government shut down will last long. About the stock markets… well, I said before. These things don’t end well.

Have a good trading!!




Disclaimer


I wrote this article myself, and it expresses my own opinions that shouldn't be used as a trading advice. Trading carries considerable risk due to the high leverage involved


#BankofCanada #bitcoin #DAX #DowJones #FTSE #FX #indexes #InterestRates #opinion #SP500 #Trading #USDollarIndex

Sunday, 14 January 2018

US CPI is King, at least for the interest rate derivatives

I’m a big follower of the economic data. I follow closely the inflation figures because the interest rate markets usually move. It’s difficult to say what you should trade in this situation but it´s easy to predict the direction of the movement. Let’s see what happened and how the markets reacted.

US CPI surprise


I expected a figure in line with the expectations. Maybe, my expectation was driven by the lack of surprises in the European inflation, but I was wrong this time. The US CPI (YoY) was released showing a better than expected figure, 1.8% vs 1.7% expected. At the same time, the US CPI (MoM) showed 0.3% vs  0.2% expected. The party started and the futures markets started to move.

Market reaction


The sell-off in eurodollar futures was expected after the economic indicator release. Let’s start with the 10Y T-Note Futures.


10Y T-Note Futures March 18

10Y T-Note March18 future, 30 min
    Source: TradingView, 10Y T-Note March18 future, 30 min

Good downside move, you can see the importance of this movement in the traded volume in the 30 minutes after the release. It’s not valid to sell at any point, as you can see this future went up after 14:00 London time.

Eurodollar December 18 future

 Eurodollar Dec18 future, daily
    Source: TradingView, Eurodollar Dec18 future, daily

This is a great example of how the American economy has improved from 2016.As you can see it´s in a downtrend since September 2017.


Eurodollar Dec18 future, 30 min
    Source: TradingView, Eurodollar Dec18 future, 30 min

You can see the importance of the data and the scale of the movement in the 30 min chart. It´s funny to think that 7 ticks move is big but you should consider that the size of the trades is usually higher than other futures with more volatility. If there is not a release or news is strange to see big movements in this kind of products.

Different examples, across the interest rate curve 

Eurodollar futures Dec19, Dec20, Dec21, Dec22, own elaboration
     Comparison Eurodollar futures Dec19, Dec20, Dec21, Dec22, own elaboration

All the maturities behave exactly as the December 2018 contract shown before. The December 2021 is different, someone sold at market just in the moment of the release or a little bit before, this is why there is a big gap. The most important thing is that the dec21 move was smaller than the dec20 and dec22. I can see that in the volumes increased in the bounce back for Dec20 and Dec21. It means that the traders don’t want to be short in this maturities. It’s difficult to say if there will be a possible slowdown in the US economy in one year time but I  don’t dismiss this scenario.

Eurodollar Spreads

Eurodollar spread Dec18-Dec19, daily
     Source: TradingView, Eurodollar spread Dec18-Dec19, daily

We can see that this spread is trying to go up from the min of 0.1400, this means that the outlook for the next year is positive. The main problem, and it will be highlighted in the next chart is that the long-term chart shows how the spread is tightening. 


Eurodollar spread Dec20-dec21, daily
     Source: TradingView, Eurodollar spread Dec20-dec21, daily

I´ve selected this spread because shows a clear downtrend. After checking, the Dec19-Dec20 spread shows the same pattern and we can think about the slowdown scenario mentioned before.

Sum up and opinion


I hope you like it. Following the economic indicators and how they affect the markets is one of my hobbies. I’m looking forward to bring this interesting subject and explain the concepts clearly. As you have seen, the better than expected US CPI generated a sell-off in the US bond futures and in the interest rate futures across the whole curve. This doesn’t mean that the rally in equities will last forever and there are signs that could be a slowdown in the US economy in the coming year or year and a half. In terms of the US equity market, I think that it will keep going up in 2018. I use the bank earnings as a leading indicator of the economy.

Have a good trading!!



Disclaimer


I wrote this article myself, and it expresses my own opinions that shouldn't be used as a trading advice. Trading carries considerable risk due to the high leverage involved



Saturday, 6 January 2018

Trading system based on proprietary indicator, Part 3


This is the third part of the series of posts about the trading system based on my own indicator. We will see how the commissions affect the performance of the system. I will compare with the benchmark in the future.

Comparison table




Comparison table including the backtesting with the commissions included and deducted from the portfolio, own elaboration

As you can see there are big differences between the backtesting without commissions and the ones that include them. The daily average return differs in the amount I chose as a broker fee. In this case and considering the size and the price of the security, I decided that the commissions will be 40 Euros per trade (20 Euros per side, buy and sell) Obviously the maximum and minimum daily profit differs in the amount of the broker fee. (There is one problem that I haven't fixed in the 10 Yrs backtesting and 10 Yrs backtesting with Fees. The max profit differs due to an early error in the data) The skewness and kurtosis are exactly the same. The returns have been significantly affected by adding the commissions and taking out the value of the portfolio.In the case of the 5 Yrs Backtesting the return is almost half due to the commissions. Considering that the system trades the same size all the time, this issue was expected. The advantage of that is that as soon as the portfolio grows, and even if the loss is the same amount as the beginning, the loss represents a lower percentage of the portfolio. I chose this way as a risk management in which I risk more in the early years while the portfolio is growing. Probably I should link the trade size with the value of the portfolio but depending on the system or the period studied can generate worse performance and could be riskier. The Sharpe Ratio is affected as well because the returns are lower. Another important point is that including the fees the max drawdown is worse than the one shown before. Depending on how we invest our savings, we should run an extra spreadsheet with all the cost related to the investments. 


Graphical description of how the fees affected to the different backtesting


5 Years test


    Differences between the portfolio with and without commissions, own elaboration


Sometimes a chart represents an idea better than the words. Here we can see the impact of the commissions in the system. The difference in the last trade is almost 5000 Euros. The system returns 37.15% which is the equivalent to 7.43% per year. It´s a good return considering the risk taken. The system without including commissions returns more than 12% per year.

10 Years test


     Differences between the portfolio with and without commissions, own elaboration

The differences are bigger in the 10 years study. The difference between both systems is 28000 euros. At this point is better not to do these numbers, giving away this amount of money is crazy. The best aspect is that after fees it returns an incredible 425%.


Sum up


I hope you like it. You shouldn´t focus on the effect of the commissions or the performance. The most important idea is considering all the cost related to running the trading system or the investments. In this case, I simplify the idea considering that a broker executes the trade on your behalf. If you trade on your own, you should add the market data, the brokerage commissions, and the trading platform costs. There is another point that I haven´t commented, the taxes. Sadly the trading costs and the taxes (if you make money) will reduce your profits.

Have a good trading!!




Disclaimer


I wrote this article myself, and it expresses my own opinions that shouldn't be used as a trading advice. Trading carries considerable risk due to the high leverage involved

Thursday, 7 December 2017

Trading system based on proprietary indicator, Part 2


Today I will show the trading system behaviour from October 2008. Let me introduce the macro situation before I review the backtesting results.

Brief description



The financial crisis started later in 2007. The stock market suffered a big correction in 2008. The volatility was far higher than nowadays. The central banks implemented the quantitative easing programs in order to stabilize the economies around the world. This is an example of the German Dax index and the Eurostoxx index.

     Source: TradingView, DAX vs Eurostoxx futures, daily, from 2008 to 2018


Results from October 2008


      10 Yrs Backtesting results, own elaboration with Excel and RStudio

The main difference is the volatility in the underlying. As you can imagine later in 2008 the volatility was really high and the stock market was in free falling until it bottomed in 2009.
As you can see the big bounces in 2008 are the reason for the big range shown in the backtest.

Comparison with the 5 Yrs Backtesting

                                          Comparison between the 5Yrs and 10Yrs backtesting, own elaboration

You can see a big improvement in the 10 Yr study vs the 5 Yr. The average profit was 151.28 EUR vs 95.86 EUR. The standard deviation and variance were higher due to the volatility from 2008 and 2013. The range is bigger as well because the stock was trading higher. Considering the strict risk management, I´m surprised about the winning trades percentage. I believe that a mean reversion strategy was the best one at this time, even more with the actions taken by the central banks. In addition, the return’s distribution changed and it shows higher extreme figures (in the positive side, which means a high probability of bigger profits) The system traded 733 times vs 130 times in the last 5 years, the profits are concentrated in the first 300 trades. The Sharpe Ratio is slightly worse.



                                          Max Drawdown, own elaboration using RStudio

I´m happy with this figure, losing 2820 EUR was the equivalent to 3.16% of the portfolio. This is a very conservative figure which I consider ideal. Sadly this is not applicable to another kind of strategies because the system opens and closes the positions on the same day.


         Portfolio growth, own elaboration using RStudio

There is not much to say about this chart. You can see the change in volatility from the first years to the recent years. The biggest profits are concentrated in the first 300 trades. The initial portfolio was 20000 euros. I haven´t included the commissions.

Sum up


We have seen how this system behaved during the last 10 years. You can think that is overfitted and this post doesn´t have value because I tested the system in the right period. This is not the purpose of this little article. I´m surprised with the performance but if you had bought the Dax in 2009, you would have multiplied your portfolio’s value by almost 4. In the next post, I will compare the trading system vs the DAX. I hope you like it. Thanks for reading.

Have a good trading!!




Disclaimer


I wrote this article myself, and it expresses my own opinions that shouldn't be used as a trading advice. Trading carries considerable risk due to the high leverage involved

Sunday, 3 December 2017

Trading system based on a proprietary indicator Part 1


This is a new concept. I will do three parts to analyze the trading system in a better way and compare it with a benchmark. The idea is introducing the trading system, showing the backtesting (last 5 years), comparing with the 10 years backtesting, studying the system vs the benchmark and applying money management to see how the performance and risk parameters change.

Brief explanation of the trading system


The system is based on a proprietary indicator as you can see in the title. The idea behind this system is mean reversion. The levels are chosen from the study of the returns’ distribution. Does it sound familiar to you? In addition, a strict risk management system has been applied. The maximum loss allowed is 0.5% as we will see in the next points. The trading system trades 1000 shares in each trade (in the future I will apply money management) The initial portfolio

 


Results after the last 5 years (backtesting)



Backtesting statiestics from RStudio and Excel
     Backtesting statistics from RStudio and Excel, own elaboration


As you can see the system makes 95.86 euros on average per trade. I would like to make clear that the system traded 133 trades and the commissions are not included. The maximum profit in a trade was 1650 euros while the biggest loss was limited to 100 euros.  The return was 12750 euros which is the equivalent of 63.75% in 5 years (around 12.75% per year). As you can imagine, considering the strict risk management, the losing trades percentage is higher than the winning trades percentage. But the average winner is higher than the average loss. The Sharpe Ratio is 4.32, which confirms the profitability of the system.



Max Drawdown, own elaboration
                                  Max Drawdown, own elaboration using RStudio


This is the measure that I like the most. The system only loses 925 euros in the worst trading period. If we check in percentage terms, it represents a 3.53% loss. According to the asymmetrical leverage rule with a gain of 3.57%, we offset the loss. This shows the importance of risk management.

Portfolio performance
      Trading system track record, own elaboration using RStudio


Here you can see how the portfolio has been performing. The most important is its consistency.

As a curiosity, performance comparison with different initial capital


comparison

With these numbers, we would be tempted to invest 5000 euros or less. The system doesn’t require a lot of capital. The main problem with a 5000 portfolio is that we will struggle because the costs are not included and we couldn´t trade 1000 shares each time.


Conclusion


This has been the first part of a series of posts about the same trading system. In my opinion, the performance and the risk metrics are good. In the next post, I will review the 10 years backtest. The purpose of that is to check that the system hasn´t been overfitted for the last 5 years and show how it performed in a longer period. I hope that you like it.

Have a good trading!!



Disclaimer


I wrote this article myself, and it expresses my own opinions that shouldn't be used as a trading advice. Trading carries considerable risk due to the high leverage involved



Sunday, 26 November 2017

DBK Trading System

Deutsche Bank is one of the biggest banks in Europe by total assets. During the last years, it has been struggling to adapt to the new low-interest rate environment.The losses from the financial crisis were very big. In addition, the big provision for fines and lawsuits drove its profitability to the negative side. Therefore, its shares have been dropping these years. In response to these problems, John Cryan, Deutsche Bank CEO, decided to implement a restructuring plan some years ago. 

    Source: TradingView, Deutsche Bank shares, daily

Even with the above, I believe that this bank offers value from a trader or investor’s perspective. Analyzing this bank is not the purpose of these post.  

Trading System Intro


I consider Deutsche Bank as one of the most important banks around the world and I believe it will be a reference in the coming years after resolving its problems. This is why I created a short-term trading system to buy the weakness of the stock. The system is based on risk management, the maximum risk taken per trade is 1% while the take profit is set at 10%. With these numbers in mind, we can expect a lower rate of successful trades.

Backtesting from the 30/10/2013 to 17/11/2017


Let’s see the theoretical behaviour of the system


     Statistics of the DBKT trading system, own elaboration using R Programming

The system makes 84.20 EUR per trade on average which is 0.8420 EUR per share considering that it trades 100 shares each time.  The distribution of returns is not as good as I would like it but I expected this problem before I tested the system. The biggest profit was 2290.05 EUR. The worst trade lost 478 EUR. It would have made 5304.77 EUR profit which is the equivalent to 26.52%. It’s a modest return but as we will see later it’s adjusted by risk. The Sharpe Ratio is good.

       Return’s distribution, own elaboration

Sadly some of the returns were worse than the max loss of 1%. This was due to the gaps in the opening. There are ways to solve this problem but it’s interesting to see this kind of problems in order to avoid miscalculations in the future. 


     Max drawdown and performance of the system, own elaboration

As you can see the worst loss was 2773.79 EUR which was the equivalent of a 12% loss for the portfolio.  However, the rise of following days offset the loss and drove the system to profitability. After that, the system was steady without important changes.

      Portfolio evolution, own elaboration


To sum up

We have seen a simple trading system applied in DBK equity. I would like to remind that analyzing this company wasn´t part of this post. I've chosen this security for its volatility. This system hasn´t been improved and it had some problems addressed above. The performance is good considering the 12% max drawdown. I've played with different portfolio sizes before publishing this post but I thought that the 20000 EUR portfolio was the best in terms of risk-reward. A 10k EUR portfolio would have returned 40% profit with 23% max drawdown but I prefer smaller drawdowns. 
I hope you like it.

Have a good trading!!



Disclaimer

I wrote this article myself, and it expresses my own opinions that shouldn't be used as a trading advice. Trading carries considerable risk due to the high leverage involved



8th day small profit that helps me to keep going in the competition

After a successful week and most importantly from recovering almost $6k, I wanted to consolidate my positive results. My desire was to b...