Showing posts with label data analysis. Show all posts
Showing posts with label data analysis. Show all posts

Sunday, 15 July 2018

Why I took a 5-day Moving Average instead of the 9-day Moving Average?


As I promised in the last post, I will review my decision of taking a smaller moving average. My purpose wasn’t to overfit the model, I was looking for a drawdown in which I feel comfortable. 

How did I start?


I had an idea about a day trading system. My objective was a good performance with adjusted risk. I’m a big fan of the stop loss. If you, as a trader or an investor, can avoid drawdowns bigger than 20-25%, you will be successful over the time.

Our example



The good point about the way I run the backtestings is that it’s easy to change some parameters and adapt to different indicators. Obviously, I ran the strategy with different moving averages in order to know what parameters generated a smooth performance curve avoiding big drawdowns. 

Max drawdown and final balance from the different MA, own elaboration
       Max drawdown and final balance from the different MA, own elaboration

As you can see the best profit to drawdown ratio was the system based on the 5-day Moving Average. This seems logical as it’s a daily trading system. The reason behind the bigger drawdown, in the MA3 system, is that the there is more noise in the entry signals and it´s not accurate enough with the tight stop loss. In the case of the MA9, MA15, and MA50, the signals are more accurate but the retracements and the close stop loss don´t allow the systems to perform as well as the ones with lower moving average. If you see the MA9 system's figures, you will understand that the profit is exactly the same as the MA5 but the drawdown is worse. 



Max drawdown  from the different MA systems tested, own elaboration
        Max drawdown  from the different MA systems tested, own elaboration

This chart is complementary to the table and the explanation above. Surprisingly, at least for me, the MA50 has a lower drawdown than the MA15. If we think about it, probably the best system would be between the 3 and the 9-day moving average. As I said before, I didn’t optimize the system. 



Performance of the different systems tested, own elaboration
         Performance of the different systems tested, own elaboration

This chart is more important than the ones shown above. Here you can see how the MA5 system has barely stayed under the initial balance invested. Even after its worst drawdown the system was up more than 5% while the other ones went under 10K (and the worst one, under 9K) The main reason is that a “small drawdown” is not as painful as a big one, in simple terms, capital preservation will assure you better financial future. Imagine that you could have avoided all mistakes in the stock market (or futures) or at least you could have limited your loses. I’m sure that today, you will be better off. The reason is the asymmetrical leverage.

(second part of this post: First lesson for an investor )

 Having said that, I would like to add that I´m not questioning your investments decisions. I´ve made so many mistakes in the past and some of the trades were good considering the expected value of the trade. 



 Final balance of the systems tested, own elaboration
          Final balance of the systems tested, own elaboration

To finish, I wanted to show you the chart of the final balance after 3.56 years. The best system has returned 56.6% which is a little bit more than 18% per year.

Final thoughts


I hope that you like this post. The main purpose was to show you how to analyze the systems and even extrapolate the basis and test different indicators or the same indicator at a different level. The stop loss can be painful but I wouldn’t place an order without knowing my stop and target. As I said the asymmetrical leverage is very important because recovering small losses is easy while recovering big drawdowns can be really difficult. You have seen this concept with the system reviewed. 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 #MovingAverage #Backtesting #Drawdown #Analysis #QuantitativeAnalysis

Thursday, 28 June 2018

Momentum system


Sometimes we look for a clear trend in the different markets. This can be difficult these days because the volatility is back. I believe that there are many opportunities but you need to adjust the strategy’s timeframe. Obviously, when we see the chart at the final of the day,  it´s easy to see the levels where we should have bought or sold. I would be happy as far as you do this in order to learn the order flow and how the news affected the security. However, you shouldn’t take seriously the important levels of the day (if you are only checking the day instead of a longer timeframe) because anyone knows what is going to happen tomorrow. I wouldn´t like to discourage you if it works for you but in my opinion is like singing “if I were a rich man” without trying to make money.

Why is the data important? Introduction to the system

As I said indirectly in the first paragraph, I don’t know what the asset prices are going to do tomorrow. The most important for me, leaving my thoughts apart, is the historical data. Here is where statistics takes importance. Let’s get biased for a minute thinking that every time that the price is above an indicator (or another variable) we should buy and every time is below the chosen variable we should sell.


Let´s take the Moving Average 9 as this variable and check the probabilities.

                                               Probability table, example own elaboration

Only to sum up, we have a buy signal every time that the opening is above the MA9 and a sell-side every time the opening is below this indicator. This example is not the best one. I wouldn’t publish this screenshot in a book. Apart from this joke, we had 426 buy signals but only 203 days that the future closes above the opening. Investing in a strategy that has 47.7% success ratio doesn´t seem the smartest thing to do but this is where the money management comes! In the case of the sell signals, it's slightly better showing 52.4%.

Backtesting

Before I show the results I would like to confirm that I´ve used the 5-day moving average instead of the MA9.  The main reason is that the performance was better and the drawdown was lower. This test has been done with the FESB historical data (Eurostoxx Banks). The reason why I chose this product is because I thought that it was directional enough to apply the strategy.





                                                  Backtesting statistics, own elaboration using R programming

As you can see the backtesting results are not bad. Each trade generated 6.42 EUR on average. The biggest win was 740 euros which is great considering that we started with 10000 EUR. I used a tight stop loss, only 2 ticks. Even with that, we can see that the FESB is very directional and the stop was hit only on 53% of the trades. The return has been 56.60% in almost 3 years and a half.



      PnL curve, own elaboration using R programming


The most interesting thing is that after the max drawdown (1570 between the 98th day to the 270th day) it has been rising. Obviously, when your portfolio has grown and you are using the same money management and risk management, the drawdowns are smaller than at the beginning. 



                                                      Max drawdown, own elaboration using R programming


Each trade was simulated with 2 lots and the maximum daily loss was 20 EUR (2% of the initial capital)

Sum up

I like analyzing trading systems and I´ve been working on this strategy for a while. I´m surprised about its performance because I expected worse statistics. Surprisingly, the % of successful trades were almost the same as the previous example shown above. This post doesn´t show the real performance because the commisions are not included. I will write a post in the future explaining why the short-term moving averages fit better than the long term in this kind of system. 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...