Showing posts with label profit. Show all posts
Showing posts with label profit. Show all posts

Sunday, 19 April 2020

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 build up the account to be able to deal with possible drawdowns.


6B 06/20 day chart
6B 06/20 future























Monday was a very quiet day in comparison with the previous days. The British Pound jumped 
almost 50 pips early in the morning but after that, the USD recover its strength. This changed again after midday when the price started to rise again.


6B 06/20 13/04/2020
6B 06/20 trade chart

I realized that I had a notification. My algo bought 5 lots during a retracement. In the beginning, it went against me, but it quickly recovered. It didn’t make a big movement but was more than enough to finish the day with a small profit. I personally don’t like to take positions at that time on the day because the algo closes the positions around 17:00. To be honest, it doesn’t matter if I like it or not, what I need to do is check that it’s statistically significant.  


Profit and new account balance



Trade 13/04/2020
Trade 13/04/2020

As I said, it was a small profit, but these kinds of days help to build up the account. The maximum adverse excursion was small. The algo closed the position close to the maximum favorable excursion which I’m very happy about. I have the feeling that I’m leaving a lot of money on the table. I am allowed to make one change in the algo during the competition and I’m seriously considering adding a take profit. These will reduce the time in which the algo maintains positions open and more importantly it will secure profits. On the other hand, it won’t let the profits run as much this is why I need to carefully check before I implement the change.


Account balance and realized PnL
Account balance and realized PnL


The account balance at the end of the day was $1003468.75. Even if it’s not real money, I feel very well because the algo is behaving as I expected and it’s able to recover from drawdowns.

Thanks for reading this post!

Monday, 13 April 2020

6th day, no gain no loss…



As you can imagine after reading the title, it was a flat day. Actually, I made a small profit but it didn’t cover the commissions. Let’s see what happened during that day in the EUR/USD and GBP/USD futures:


British Pound


It was a directional day for the British Pound without any big spike or swings as we saw in the previous days.  This was explained by the increase of COVID-19 cases in the US and the expected approval of further help by the FED.

6B 06/20 


It raised almost without stopping until 14:30 where the price was ranging between 1.2387 and 1.2405. In one of these retracements, the algo was triggered and it sent a buy of 5 lots. I wasn’t sure about opening the position considering its morning trend and range. One of the best aspects of using algos is that we remove discretionary decisions and feelings. After entering in the position, like the most part of the times, the GBP/USD futures fell to 1.2374. After that, it rebounded breaking the highs of the day and it reached the 1.2429 level. It couldn’t breach these levels and it went back to 1.2400 where the algo closed the position.

6B 06/20 trade chart


This chart shows more detailed of what I explained in the previous paragraph.

6B 06/20 trade


In contrast with other days, the MAE ($437.50) is around 1/3 of the MFE ($1281.25) and this shows how well the market behaved for the algo I’m using. One of the problems is that the ETD is still high because the algo is not closing with a signal. Until now, the algo has closed according to the time configured.


Euro FX


The Euro vs the US Dollar didn’t have a clear trend. It was a total swing. It seems that the EUR was stronger in the morning while the USD took its place in the afternoon.

6E 06/20


As you can see, and as it was expected, the algo was triggered in a retracement. It performed well during the first hour. After that, the Euro dropped strongly but seems that the traders didn’t believe in this movement and the buying pressure took the price to the point in which the position was open. At this point, it continued to rise to 1.0909 where the dollar strength came back. The position was closed at 17:08 London Time

Trades and account balance


I didn’t get profit in both trades. I lost $398.75 in the EuroFX trade including commissions and I won $395.75 in the British Pound also including commissions.

08/04/2020 trades


I shouldn’t be upset… I made a profit without considering commissions. At the end of the day is not real money and this is good learning and I would like to remember that in my opinion the commissions and the slippage should be included when you are backtesting a system. In my experience, if the system is not good enough this will make the difference between making profit or loss.

Account Balance


One of the conclusions that I found in the first 6 days is that probably I should implement a fixed take profit or maybe consider a trailing stop. It’s early to say but probably I will run some tests to see if the statistic ratios are better than my current algo.

Thanks for reading this post!


#algorithmic_trading, #Trading, #Euro, #EUR, #GBP, #British Pound, #USD, #EURUSD, #GBPUSD, #Dollar, #performance, #profit, #loss, #FED, #COVID-19, #Robotrader

Sunday, 12 April 2020

Day 5, Profit after a hard day


The 5th day was a positive day. It was the first day in which the algo was triggered in Euro FX future, known as 6E in CME. Until this moment, the algo was executing orders only in the British Pound futures. Let’s have a look at both instruments:

Euro FX

The algo performed very well showing its real purpose. It entered long in a retracement and luckily after that, the Euro went up. It was a very directional day.

6E 06/20 

 
As you can see there were only 2 moments in the day in which the position was losing money.


Orders 6E 06/20

The final profit was $1657.50. 


British Pound

As I said before this currency cross has been recently quite volatile in comparison with the Euro/USD. I believe that the news has a bigger impact on this instrument.

6B 06/20


I was looking at the different parameters when the notification popped up on my screen. At that moment, I had a feeling that this trade couldn’t end up in profit. I saw the P&L falling continuously for an hour. After that, the price went up to the point in which I entered. I felt a little relieved but I knew that it won’t last. It dropped again making a double bottom. Even if I don’t believe or follow the charts, I had a little belief that maybe the price will go up again breaking the confirmation line. I was right. The price went from 1.2292 to 1.2395. As soon as the US trading session started, the USD raised versus other currencies. This pair plunged to 1.2303 from the maximum of the day. I believe that after a big movement the prices always revert to their mean but we need to be careful in the current situation. I was lucky because the price recovered more or less 60% of the last downside movement and at that time, my algo closed the position making a small profit.


Trade 6B 06/20


As you can see the MAE shows that at 1 point I was losing more than $1400. We can also see a big MFE showing almost $1800, that was reached after the double bottom. Sadly, as you know, even if it’s not real money, the final profit was far from the MFE. This is why the End Trading Drawdown shows up as $1373.75 the difference between the maximum favorable excursion and the final profit.


Final Profit


The final result was $2127.50. I was happy to have this profit after the losses from the previous week.

Thanks for reading this post. 

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

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

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