Showing posts with label stop loss. Show all posts
Showing posts with label stop loss. Show all posts

Friday, 10 April 2020

The algo, day 1, 2, 3 and 4


Hi, I would like to start this post introducing the idea behind the algo. Also, I would like to highlight that this is not financial advice because the purpose of this algo is to participate in a simulated algo trading competition.

Current situation

One of the first questions that came to my mind was about the current situation with the Covid-19 and how it would evolve during the competition. At that point, was very tricky because it’s very difficult to forecast the future and to be honest, I don’t know how the markets will react to the help provided by the central banks. I see some similarities with the financial crisis, but I believe that there are more unknowns and the lockdowns extensions can trigger some bankruptcies for small and medium businesses. This will result in a decrease in consumption and the gross domestic products will reflect this as well. The financial situation of some companies and individuals will deteriorate and this will affect the banking sector. This issue can have a domino effect. Luckily, the central banks and the national governments are taking measures to try to avoid the spread of the disease and try to go back to normality (even if it’s done gradually)

The algo

I was considering different types of algos before the competition. As you know, some of the most important algo types are:
  • trend following 
  • mean reversion
  • volatility breakout
  • range algos

As I explained in the previous paragraph, the situation was one of my biggest concerns and I was expecting the volatility to continue at least for 3 months. Considering that the central banks were approving measures, I thought that the markets could have some rebounds. This is why I decided to design an algo that is able to catch the trend after a retracement. The main indicators used are two Exponential Moving Averages and a Stochastic.

I chose the Euro FX (6E on CME) future and the British Pound future (6B on CME) and every time that the algo is triggered, it sends a 5 lots order.

Day 1, 2 and 4


The algo was triggered only in the British Pound futures during the first 4 days. I lost $655 in the first trade, as you can see it wasn’t the best day. Its maximum adverse excursion was $875 and the maximum favorable excursion was $500 (this explains that the position was showing $500 profit at a certain time during the position was open) 

The second day was far worse because it hit the stop loss. The similarity with the first trade is the maximum favorable excursion that reached $562.5 at some point during the session.

I didn’t have any entry on the third day.

Finally, I had a small profit on the 6th of April. It was the most volatile day.




Summary

I have introduced a brief opinion of the current situation and I have explained how it was one of the most important facts to choose the algo for the competition. I have shared the idea of the algo and I have reviewed the first 4 days. I will keep posting how the algo is performing and interesting facts that can explain some movements in the Euro and the British Pound futures.

Wednesday, 5 September 2018

Simple trading system, does it work in the Nasdaq?

Introduction

There are so many trading styles and the traders can take their decisions from technical analysis, important levels, value investment, quantitative analysis, price movement, and order book study. Some of them combine more than one method at least to have another point of view or to have another idea generation source.

Nowadays, it's easy to find resources for trading. There are plenty of resources online, such as videos and courses. If you are more traditional, you can search for books and see what the people are saying about them.

Some of the most successful traders are known for being contrarians. What does this mean? Maybe they are aware of how powerful the trends could be, however, they are not investing for the long term. They are looking for a quick profit in a short period of time (depends about the how big is the position, who is executing and what are the targets, it can last from a few seconds to less than 3 months).  How do they act? Basically, if a stock or a future has been raising for a while and has a strong trend, they can consider that the product is overvalued and that it will revert to the moving average or at least it will revert enough to make a profit.

The idea

Now, we know what they do. I always thought about it. One of the problems is the timing when I should enter into a trade like that. There are so many statistical methods that you can apply to that. It can be based on the number of days (imagine that the stock has been raising for the last 60 days and you think that every “X” days, there is a retracement), it can be based on the price change (that you can consider it overvalued), it can be a combination of both. We can see that creativity is another part of the trading research. Probably, I will write a post about the whole process in the future but today we are going to review a simple idea.

The trading system is contrarian so it will consider yesterday % change. If yesterday the stock or the underlying product went up, the system will sell it today. And the other way round, if the stock fell yesterday, the system will buy it today.

Nasdaq


I’ve chosen the Nasdaq index as an example. It represents the technology stocks.

    Nasdaq continuous future, daily, source: TradingView

It hasn’t stopped rising since 2010. I wanted to show the period 2014-2018 that I will study in this article. Considering the strong bullish trend maybe I shouldn´t use a contrarian system. I will show you that one of the most important aspects is the risk management (always combine with a profitable system)

Backtest example

Before we start, I need to explain a couple of things. In my opinion, the market behaves differently when it goes up than when it goes down. The falls usually are very sharp. This is why I decided to choose a tighter stop for the sells. I’ve chosen the stops randomly, the buys have a stop of 4 ticks and the sells have a stop of 2 ticks. Let’s check the results:




                                        Backtesting, own elaboration using R

Good news! The mean is positive which is a good starting point. However, making $9.53 per trade is not enough without considering fees and slippage. The system makes $2190 on the best day. The worst lost is $20. The kurtosis is really high because all the values are concentrated around 0. To be honest, the system only makes money on the 3% of the trades. So it’s not tradable even if it makes 103.65% in four years. It would be great if the system had more entry requirements and the number of trades would be reduced. That way the statistics would improve a lot. The Sharpe ratio isn’t great. 



                                                           Max drawdown, own elaboration using R

Considering that the trading system loses in 97% of the trades, the max drawdown is very good. Obviously, each time that it loses, the amount is very small (around 0.2% of the portfolio)



Trading strategy performance, own elaboration 

We can see the characteristics of the system. A few profitable trades and a bunch of losing trades. The probability of taking the loss is very high with our tight stop losses. In other hand, every time that we are right, we make a lot of money.

Sum up

Sadly, there isn’t a good conclusion for this post. I think that I have a lot of work to improve this system.  In addition, this is not a professional way of running a backtest. We should have a period of time in which we test our idea, another period for optimization and different windows of time to test the optimized parameters. Also, we should always consider broker fees and slippage. The system shown is not tradable but it shows that a sounding risk management system is very important. Another idea that we should take from this post is that even a contrarian system can perform in a market that has a clear trend. 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...