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



Thursday 23 November 2017

Concerns about the US inflation

Yesterday, we saw the FOMC meeting minutes and they delivered what the market expected. They held the rates unchanged and they confirmed that the process of balance sheet normalization will continue. The Fed highlighted the performance of the economy and the low unemployment. It’s true that the US economy is strong and the last GDP reading was better than expected. However, everything is not as the Fed would like it, and FOMC members expressed their concern about the inflation outlook. Let’s see how the markets reacted:


EURUSD December 2017 future

     Source: TradingView, EURUSD Dec17 future, 1 Hour

The Euro has been rising since the beginning of November. If we add to this trend the inflation concerns the result is a weaker dollar. We didn´t see a significant movement, the candle highlighted in yellow shows the upside movement after the FOMC minutes, as you can see the biggest movement was earlier in the morning.

10 Year T-Note December future


     Source: TradingView, 10 Year T-Note  Dec17 future, daily

Everytime that there is a negative outlook the bond futures raise, and this is what the 10Y T Note future did yesterday. I’ve been following for a while this contract and there is a clear triangle that if broken, I believe that it would go up to the resistance at 125.75.


2 Year T-Note December future


    Source: TradingView, 2 Year T-Note  Dec17 future, daily

In contrast with the 10 Year T-Note, the 2 Year T-Note hasn’t swung. The bearish trend is remarkable.


10 Year T-Note - 2 Year T-Note December spread


     Source: TradingView, 10 Year T-Note-2 Year T-Note Dec17 spread, daily

I’ve chosen to spread 1 contract of the 10 Year T-Note future versus 3 contracts of the 2 Year T-Notes. In my opinion is the best spread you can make with these two futures.


Yield between the 10 Year T-Note and the 2 Year T-Note


    Yield between the 10 Year T-Note and the 2 Year T-Note, source: St. Louis Fed

Historically this yield spread is an indicator or the recessions. We can see that it has narrowed during the last 4 years. This indicates the flattening of the interest rate curve.One of the reasons is the improvement of the US economy is pushing the short-term yields higher. The second reason is there is a strong buying pressure in the long maturities that doesn´t allow the yields to go up.

Conclusion


The Federal Open Market Committee statement doesn´t  significantly affect the markets if it delivers what the analysts expected. If it had been hawkish on the inflation outlook, we would have seen a strong bond selloff and buying pressure in the USD. The macro indicators are important but in trading is better to focus on the difference between the figure and the value expected by the market participants. I would use the yield spread introduced in this post for a medium or long-term investment. I will publish a strategy based on the yield spread between the US 10 year bond and the US 2 year bond in the future.
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 18 November 2017

How can we make a strategy profitable modifying a couple of things?

Nowadays trading is in vogue, even more, if we consider the new cryptocurrency trend. Basically, everyone wants to jump in. The trader lifestyle is desired by all the people. Sadly, trading is harder than what the social media shows. The industry is changing a lot. Concepts such as machine learning, artificial intelligence are taking importance in leading investment banks and hedge funds as they are heavily investing in it.

Why do the biggest companies invest in machine learning, artificial intelligence, and algorithms?


It´s very difficult to replace an experienced trader because he knows how to adapt the strategies in different economic cycles and conditions. Some hedge fund managers are hiring a lot of developers and programmers to create algos that emulate the behaviour of their best traders. This seems really expensive, at least in the first years, but I believe that in the long run will save money for the hedge fund. How can you emulate the trader behaviour? In my humble opinion, I would divide the strategies applied by the trader in little pieces and I will study the trader´s track record in order to study the conditions (price, type of order, macro events on that day, news) of the trades. Once I understand the reasons I will try to replicate its piece of strategy and I will code it. Once it’s coded and tested, I will assign a subaccount to use this strategy and I will do the same process for each strategy. To sum up, I will have a trading account made-up of subaccounts that run a specific strategy. We can say that the main account is the portfolio and the subaccounts are different traders or fund managers.
This process can take a lot of time and some parts can be difficult to replicate.

What aspects should we modify to make a simple strategy profitable?


The strategy is based on the EURUSD futures but I'm not going to explain how it works. The main purpose of this post is to show you how to modify a simple strategy to improve the profitability and reduce the risk. It only trades once a day if the conditions are met. This backtest shows the last 5 years. The initial portfolio was 50000 USD.

Plain strategy



This is the strategy without any modification. 

     Statistics of the strategy, own elaboration using RStudio

The mean is positive and it shows that the system will make on average 16.21 USD per day. Sadly is not that easy, because there are winning days and losing days. The best day it banked a 3250USD profit. On the other hand, the worst day shows a loss of 2440 USD. The Sharpe Ratio is very low. The returns’ distribution was a normal distribution around 0. The main problem is that there were trades that lost a big percentage of the portfolio. This is why I decided to limit the loses in the second strategy. Let’s see the maximum Drawdown.


     Max drawdown and track record of the strategy, own elaboration using RStudio

Any serious investor can’t tolerate this drawdown considering the size of the portfolio. I wouldn’t be confident to use this system after reviewing the track record. Basically, it goes sideways.

Strategy 2, limiting loses


In this case, I decided to limit the loss to 600USD per day. Let’s see if the system has improved or not.



     Statistics of the strategy, own elaboration using RStudio

In general terms, this system is worse than the first one. The system makes 15,19 USD per trade on average, which is  1 dollar less than in the first strategy. The worst loss has been limited but the distribution contains more days on the negative side. The days with big swings generated the most part of the loses. The return is only 19.96% in the backtesting.




     Profit and Loss from trades distribution, own elaboration using RStudio

The losing days are concentrated around the maximum loss allowed.


     Max drawdown and track record of the strategy 2, own elaboration using RStudio

The distribution is not appealing to me. The best thing is that the max drawdown is smaller than in the first strategy. This system is clearly limited by days with big ranges.

Strategy 3, looking for different entries


Once I limited the losses of the first system and I checked that it wasn’t working as I would like it, I decided to change my entries. Will this be the solution?


     Statistics of the strategy, own elaboration using RStudio

Modifying the entries improved a lot the system. Now the system mades 49.88 USD per day. The standard deviation is lower. It would have returned 81.4% in 5 years, around 17% per year. What a change!! The winning days' percentage has increased and the Sharpe Ratio is very good. You should think that the commissions are not included.


    Max drawdown and Track record of the system, own elaboration

This is the best point. Look at the line! Now the system is consistent and the maximum drawdown has decreased a lot.

Conclusion


Even if you have read or heard about a successful trading system, you shouldn’t trade it without testing it before. We have seen that with minor tweaks the strategy can improve a lot. I hope that this post will help you to understand the process. The sky is the limit, in this field, the creativity doesn’t have limits. If you are a professional trader this can help you to test ideas and become more confident. Another important point is that you shouldn’t invest in these strategies even when the statistics are good. You should test them with a paper trading account and compare that the behaviour is similar to the previous backtesting. This is crucial because there is the risk of overfitting. I hope you like.

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

Tuesday 14 November 2017

Europe strength, UK inflation


We had a lot of data today. Early in the morning, we have seen an outstanding German GDP. The next big announcement was the UK CPI that surprisingly has shown the same reading as the previous one. Followed by this, the German ZEW economic sentiment and the European GDP.At the same time, the central bank governors from the Fed, BCE, BoE, and BoJ were in a communication event hosted by the European Central Bank. Let’s check more in detail what happened with the British Pound and the Euro.

UK inflation data


As I said before, the UK CPI has been released at 9:30. The reading was 3,00%, the same as the September figure. This makes pressure to the Bank of England. Will they raise rates in December? On the other hand, the uncertainty about getting a Brexit deal is growing. If the policymakers don´t reach a deal focused on trade, the British economy will suffer due to the contingency plans from the private companies. In this theoretical scenario, the BoE will be in trouble because the inflation will peak and they have a limited margin to raise the overnight rate due to the high level of debt held by the households. This scenario has a low probability in my opinion.


GBPUSD December 2017 future

     Source: TradingView, GBPUSD Dec 17 futures, daily

Here we can see a bearish trend in the British Pound vs the US Dollar that seems that it’s consolidating and creating a strong resistance around 1.3070. This trend signals the disappointment of the rate rise in the current situation and the uncertainty of Brexit.

     Source: TradingView, GBPUSD Dec 17 futures, 30 min

The reaction of the strong UK CPI has been negative for the GBP in the first two hours after the release. After that, it has recovered. 


    Source: TradingView, GBPUSD Dec 17 futures, daily

The Pound has broken higher while I was writing this post. Head and shoulders confirmed.


European data


Europe has shown its strength with the macroeconomic data today. This morning Germany has released a strong Gross Domestic Product. The GDP (YoY) was in line with the expectations, but the GBP (QoQ) was better than the forecast.


      Source: ZeroHedge, chart taken from Bloomberg

The Geman ZEW economic sentiment was slightly worse than expected, 18.7 vs 20 expected by the analysts. The European GDP growth was in 2.5% and the industrial production 3.3%. These figures confirm the good moment of the European economy.

EURUSD December 2017 future

     Source: TradingView, EURUSD Dec 17, daily

The USD has been raising vs the Euro since September. The European Central Bank has shown its conservative side while the Fed is clearly hawkish. Today the central banks' governors agreed that the economic policy will take part only if the improvement of the economies continues. 

Source: TradingView, EURUSD Dec 17, 30 min

The Euro has rocketed today with the positive data. The strange thing is that we haven’t seen any retracement.

Conclusion


It’s been a good day for the euro but there are some issues to resolve. The main concern is the European inflation is not as high as the BCE would like it. The strengthening of the euro can lead to keeping the inflation low and Draghi knows about it. In the other side, the Bank of England is raising rates in order to fight the inflation.  This is not well seen by the market participants due to the Brexit uncertainty. In the other side of the Atlantic, Janet Yellen confirmed that the Fed will raise rates according to the economic improvement. Working nowadays in a central bank is not easy, considering that they need to be careful with their language, prepare the markets to avoid repercussions on the real economy and guide consumers about the expected outlook. All of these things shouldn't affect your trading but I think macroeconomics is helpful at least to understand the big movements.
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 12 November 2017

Technical Analysis, brief introduction

What is it?


It’s an analysis methodology for predicting the direction of the asset prices. It’s based on the study of the past market data focusing only prices and volume. In addition, there are several technicals indicators that were created by mathematicians and famous investors to avoid the subjectivity of reading charts.

What are the principles behind it?


There are three principles:
  • Market action discounts everything
  • Price move in trends
  • History tends to repeat itself

The first one says that everything is discounted by the market, this is why its followers focus only on prices and volumes. It’s supposed that even a negative external factor will be priced because as soon as someone notices the sellers will come to the market.

Price move in trends, if the prices of the asset are rising it's called bullish trend. If the prices are falling is considered as a bearish trend. This depends on the time frame you check because maybe it's a bearish trend in the 1Hour charts while it's bullish on the daily chart.

The third principle is related to some patterns or price formations. It’s believed that if you see these patterns and according to the past you can guess where the prices will go.

The most famous patterns



Double top, it’s based on two highs in which the price couldn´t go higher. It’s supposed that if the price goes down and breaks the low between the two highs, the price can go down the same distance between one of the hights and the low.

     Source: TradingView, Failed double top in Gold Futures, daily

This example shows a failed double top. In this specific case was due to the growing geopolitical uncertainty that drove the gold prices higher.


Doble bottom, it´s similar to the double top but indicates the initiation of a bullish trend. 

    Source: TradingView, Eurodollar spread Mar19-Mar20, daily

This example is good and shows that after breaking the resistance the Eurodollar spread traded higher. 



Head and shoulders. It's a reversal pattern which can be formed by three peaks  (if the previous trend was bullish) or three troughs (in case of a bearish trend). The range is bigger in the formation in the middle. It shows weakness and can show the final of the trend.

     Source: TradingView, WTI future, daily

This is not the best example, but you can see the formation and the reaction after it broke the neck of this pattern.


Triangles, it´s one of the best figures to trade because usually there is a big move after the triangle is broken.
     Source: TradingView, WTI future, daily

There are more patterns such as flags, channels, diamonds that I’m not going to review in this post.

Technical indicators to follow


The most famous indicators are all classes of the moving average (simple, weighted, exponential) and the crosses between this averages and the price of the asset. The MACD, that basically is a cross between two moving averages with different time frames. The RSI indicates how strong is the movement. The Bollinger Bands were created in the 80s and they create a channel around the price that is adjusted by the volatility. Fibonacci Retracements are quite popular in the trading community because it´s believed that the prices rebound in certain levels.

My opinion


I like it as a quick way to see what’s going on in the different markets. I wouldn’t use in day trading without the support of the market profile. In addition, it’s difficult to use in day trading because unexpected news can affect the asset you are trading. I consider the Technical Analysis as an interesting tool for the medium to long-term (always supported with some fundamentals and risk management)

Conclusion


Technical Analysis is a great way to approach the markets and follow the movements. If you like, there are great books about this topic. In my opinion is not enough for trading, and I would recommend complementing this analysis with another one (depending about the asset you can use fundamental analysis, study the financial ratios, the sector, the economy…)  This was only a brief introduction to Technical Analysis. I will review the technical indicators in the future showing how profitable are in a backtest. I hope you like it. 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


#trading #technicalanalysis  #charting #indicators #introduction


Thursday 9 November 2017

Why should we use R to backtest some strategies? Quantitative approach

We live in a technological era. Basically, we can have whatever we imagine. Walt Disney said once: “If you can dream it, you can do it”. What happens if we put together the technology and the investment world?


Algo Functionality or develop from scratch with a programming language


I know that there are a lot of trading platforms that offer their own easy language or built-in algo functionality, sadly, in my opinion, is not flexible. Let me explain in a better way, you can do a lot of things but mostly it’s focused on Technical Analysis.
Using programming languages allows you to apply whatever you have in mind as far as you can code it. However, it´s more difficult and learning takes time. There are a lot of books and online courses.  
I started with R a couple of years ago. It’s an open source programming language and software environment focused on statistics. I think is one of the easiest and it has similarities with Excel. There are a lot of specific packages that contain different functions and studies. It’s a powerful tool to backest some strategies.

     R Studio screenshot, own elaboration

Create your own systems


Let me sum up some of the advantages and disadvantages of developing a trading system in R.

Advantages

  • You can analyze and backtest large datasets
  • The statistical insights you get from the data can help you to build new systems.
  • It’s more flexible, you can base your decisions purely on the data or even support with some technical analysis.
  • You can optimize the different variables and see how it affects to the system
  • Once the system is live, the risk management won´t be discretionary and you will know the maximum risk you are taking.
  • Attaching  risk management systems and money management systems provide interesting scenarios to consider


Disadvantages

  • Takes time to learning about programming
  • I would recommend to have a good knowledge of trading or investing
  • You will find out that the most part of your ideas are not profitable
  • Programming some of the trading ideas is challenging
  • Linking with the Brokerage API can be difficult


Successful Hedge Funds and Market Makers

There are a lot of Hedge Funds that are known for their specialization on systematic trading using only quantitative models.  Renaissance  Technologies is well known in the sector and they started this way of trading a long time ago. In the recent years, more hedge funds are following these methods and some of the reasons are above. Developing and applying these systems are the hardest part.  Can we emulate this activity in our home? Well, in my humble opinion, we can try. First, we should now that our possibilities are reduced in comparison to a hedge fund or investment bank. These companies employ big teams of people, they can afford to invest money in the latest technology and they have been a long time in the business.

What is the process I follow?

First is the idea generation. Before this step, you should be familiar with the product and understand how it moves. It can be as simple as buying at 9:00 and selling after 5 minutes. You can complicate as much as you want but you should think that you need to code it later. Adding variables to the system will reduce the times that you trade and you will need a larger data sample to meet statistical significance.

Second, you need to download the data from your trading platform or data vendor. Remember to check if the data contains any error. Even if you know the product, I recommend analyzing from a statistical point of view. This can provide you better insights than the chart. The size of the sample should be big enough to meet the statistical significance

Third, code your strategy. Try to make the code as flexible as possible because you will need to optimize some variables in future tests. I would recommend focussing on the risk management and money management because they are key parts for the success of the system. Add ratios to measure the performance, the risk-reward, the biggest drawdown, the success ratio…

Four, applying the strategy to the data. If you are not happy with the ratios shown, try to optimize some variables.

The last step should be adapting your code to the brokerage API to execute the trades.

My little system


I’m not going to disclosure the strategy but it’s based on mean reversion. I chose the Euro-Bund (FGBL) for its liquidity and I believe that we can see significant moves in the near term. The system is designed to open and close positions on the same day. I do apologize for any error as the strategy is at an early stage. Let’s check how is performing from the beginning of the year.

The initial portfolio was set up as 20000 Euros.
    Statistics and ratios from the strategy, own elaboration using R Studio

Let me briefly comment these ratios. As you can see each trade generates 79.35 EUR gain on average, please consider 77 trades because the system doesn’t trade every day. The biggest gain was 910 EUR. The worst day it lost 620 EUR, which shouldn’t be right because I limited the losses to 250 EUR per day. After a while, I discover that it was due to an error in the data. The system has generated 6110 euros this year that considering the initial portfolio of 20000 euros brings a 30.55% return. The probability of a successful trade is 59.65%. The Sharpe Ratio is 2.38.




   Histogram of the closed trades, own elaboration

This is the distribution of the PnL generate by each trade. Sadly it’s concentrated around -250 euros and this is because some movements trigger the stops. 


   PnL Curve since the beginning of the year, own elaboration

I like this chart because it shows that in general terms the system is making money consistently. There are certain drawdowns that I would like to smooth if I decide to optimize some variables of the system.

Finally one of my favourites metrics, the maximum drawdown:


    Max Drawdown, own elaboration

The maximum drawdown is 2650 Euros which was the equivalent to around 10% of the portfolio at that time. It happened between the trades 51 and 62.
I think that the metrics are good, but discussing the performance is not the purpose of this post. You should focus on the process and how to get the advantage of that. Don’t think that every mean reversion system is profitable, I’m sure that if I change the risk parameters and I run the backtest again the system can show loses.

Conclusion


I hope you like it. If you like trading and coding, I recommend following this kind of approach at least for a second opinion. Some of the biggest hedge funds are investing in this kind of technology and they are trying to create systems that emulate the most experienced and successful traders. 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


#trading #quantitativeanalysis  #tradingstrategies #tradingsystems #Rstudio #riskmetrics #performance #FGBL


Sunday 5 November 2017

What is a credit spread?

Introduction

It is a options strategy that consists of buying one option and selling another option in the same underlying. Both legs, or options, should have the same expiry and a different strike. This represents a neutral strategy, in which you can profit for guessing the future movement or even if the underlying keeps trading in a range. One of the best parts of this strategy is that the investors or traders receive a net credit only for entering into this strategy. And this credit can be used to finance other investments or the margin to trade different products. I wouldn´t recommend using the Premium to make new trades.  In order to apply this strategy, you should have a good knowledge about options. The credit spreads are part of the vertical spreads.

What is the structure of these strategies?


Depending on your thoughts on the future movement of the underlying you can adapt the strategy. If you think that the uptrend will continue in the underlying, you can do a bull put spread. If you are bearish, you should apply a bear call spread.

  • Bear call spread involves selling a call option in the money (because it’s worth to exercise) and simultaneously buying a call option with the same expiry but higher strike.
  • Bull put spread, consists of selling a put option and buying another put option with the same expiry but lower strike.



Steps


The first step is to study the underlying. Once you know if you would buy or sell the underlying, you can have a look at the options available and the time frame you desire. After deciding the strikes and the expiry, you should place the orders. There is an important execution risk if you want to place limit orders because there is the possibility of being filled only in one of the legs. You can ask your trading platform administrators if they support this strategy, in that case, there is no risk of execution because as soon as you are filled in one of the legs they will send a market order to the other leg. At this point, congratulations, you have your credit spread but you should monitor carefully and close the position if it goes against you. You should always respect your risk management rules. Losing a small amount makes you trade tomorrow, and surviving is the most important thing. Check my post about asymmetrical leverage here.

Example



Let´s imagine that we want to apply the strategy we have just learnt in the stock “X”. This is how the “X” is trading. One trader thinks that it had a big rise and he’s showing some weakness in the up-trend. So, he believes that the stock can rise without breaking the resistance highlighted in yellow. And after that, the sellers will be back to the market and this stock will fall.

Own elaboration, Stock “X”, daily
     Own elaboration, Stock “X”, daily

The markets are moving a lot and the trader doesn´t want to take excessive risks with this stock so he decides to make a credit spread. In this case, he will sell the call with 121 as a strike and he will buy the call with a higher strike and the same maturity. After checking the prices he will buy the 123 call.


Strikes used for the bear call spread, own elaboration
     Strikes used for the bear call spread, own elaboration

Once we have the idea, let’s check how the strategy will perform in different scenarios (it’s recommended to do it before entering in the position)


Bear Call Spread payoff, own elaboration

        Bear Call Spread payoff, own elaboration

This is only one example without real prices. As you can see the maximum profit you can get is the net Premium received for the position (In that case we collected 1.1$ for selling the call option at 121 level, and we paid 0.5 for buying the call option at 123 strike). The worst scenario is that the underlying keeps rising because the strategy can lose 1.4$, which is the difference between the strike prices used in the strategy less the net Premium received. (2$ minus 0.6$ = 1.4$)

Conclusion


This is one of the easiest option strategies but a good knowledge about options is required. The advantages are the following:

  • It’s a neutral strategy and the traders can profit from betting the side in which the underlying will go or even from sideways movements in the underlying.
  • You get credit for entering in the strategy.
  • You can hold the position for weeks or months.
  • You can apply this strategy to any kind of underlying, stocks, index, commodities …


The disadvantages are the following:

  • First, a let me repeat myself, deep knowledge is required.
  • You need a trading platform that supports options and with specific functions to avoid the execution risk
  • You should monitor the position and close if it goes against you As always, risk management is one of the most important things


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


#trading #options  #tradingstrategies #verticalspreads #creditspreads

Friday 3 November 2017

Effects of the Bank of England rate hike

Introduction


The Bank of England raised the overnight rate from 0.25% to 0.50% yesterday. This is quite significant because it’s the first rate hike in a decade. The inflationary pressure was the key point in this decision. Some members were demanding a rate hike a long time ago. However, in the Bank’s policy statement, they cautioned that further increases in the overnight rate will be gradual and related to the performance of the economy.

My opinion


I understand that they raised the base rate in order to offset the growing inflation. Up to this point, everything is clear. But, considering that the Brexit negotiations haven’t progressed enough, I don’t think that is the best decision at this moment. According to Barnier, the European Chief Negotiator for Brexit, the Brexit talks could take months to progress. So, I think the BoE has taken the initiative to hike the rate as a temporary measure and the Bank’s policy statement confirms that it will be gradual. In the case of a hard Brexit, they can lower the overnight rate again or even support the economy in a different way until getting new trade agreements.


What was the market reaction?


I think the big credit traders and the institutionals thought the same as me. The British Pound plunged. The Long Gilt, the equivalent of the 10 T-Note and the Euro-Bund, rose. The UK interest rates, known as Short Sterling Futures, jumped showing the disappointment of this decision. Let’s see the movements more in detail.


GBPUSD December 2017 future

Source: TradingView, GBPUSD Dec17 Future, daily
     Source: TradingView, GBPUSD Dec17 Future, daily

This is a daily chart that shows the scale of the movement yesterday. It opened at 1.3266 and it closed at 1.3071, big drop. Early in the morning was rising and it tested the resistance at 1.3318. After that and driven by the disappointment from the market participants it fell. In its way down, the support at 1.3157 was broken and fell to the next support (1.3063)

Source: TradingView, GBPUSD Dec17 Future, 30 min
     Source: TradingView, GBPUSD Dec17 Future, 30 min

Here you can see in more detail the movement. It was falling in the morning, but when the interest rate hike was announced, the volatility came to play. Usually, if the economy is strong and performing well, an interest rate hike boosts the currency. In that case, the market participants thought that was not the best moment to hike rates.

EURGBP 

Source: TradingView, EURGBP FXCM CFD, 30 min
      Source: TradingView, EURGBP FXCM CFD, 30 min

This is the Euro vs the British Pound. The reaction was the same. The major movement happened in 30 min this is why I’ve chosen this time frame.

Long Gilt 

Source: TradingView, Long Gilt OANDA CFD, Daily
     Source: TradingView, Long Gilt OANDA CFD, Daily

The UK 10 Year Bond future made a very technical movement because it respected the resistance at 125.756. It’s true that at this point, and considering the importance of the level, the most part of the traders considered to sell or take profits. But let’s check this better in the following chart:


Source: TradingView, Long Gilt OANDA CFD, 15 min
     Source: TradingView, Long Gilt OANDA CFD, 15 min

I’ve chosen 15 minutes because I can explain better each candle. We can see that was barely flat before the announcement. At 12:00 UK time, as soon as the BoE confirmed the rate hike, this bond rose driven by the buying pressure. I consider the next candle as a Doji pattern because the buyers and the sellers were conflicting. At this point, and due to the big movement, I believe that some firms were taking profits. The next candle broke higher but failed to close above the resistance at 125.75. This level was used to take profits and open short positions because the movement since the announcement was big. Around 14:00, the buyers came to the market helping to close at the highs of the day.

As a curiosity, I would like to share this article from Efinancialcareers:

Conclusion


In normal conditions, an interest rate hike makes the value of the currency going up as well as the interest rate yields. The Brexit shadow appeared after the rate hike and this is why the British Pound and the bond yields plunged. I haven´t focused on the UK short-term interest rate futures, known as short sterling futures,  but they rose significantly showing the disappointment with the decision. I can understand that the Bank of England did it as a temporary measure to try to fight with the high inflation and the high level of personal debt. The future path of the rate hikes in the UK depends on the Brexit negotiations, and I don’t see any significant progress on them.  The market is pricing all of these facts. I like to follow the interest rate markets because you can see what´s going on without reading the news. As always, I hope you like this post.

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


#trading #InterestRateHike #macroeconomics #fx #GBP #InterestRates #BoE #RateHike #LongGilt #Brexit

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...