Pages:
Author

Topic: Goomboo's Journal - page 10. (Read 281459 times)

newbie
Activity: 10
Merit: 0
September 17, 2013, 09:30:07 AM
Saw this and thought of you guys on this thread (which started me looking at this stuff):

http://etfhq.com/blog/wp-content/uploads/2013/01/sma-ema-eod-cross-return.gif

Link to the full article that the image came from:
http://etfhq.com/blog/2013/01/15/golden-cross-which-is-the-best/

newbie
Activity: 41
Merit: 0
September 14, 2013, 11:44:44 AM
Oda, in your experience, how have 18/45 hourly held up? In my experience it's one of the most profitable, especially on BTCe.

I never tested anything on BTCe, but for mtgox:

I'm assuming 1% fee. Without treshold, poorly (minus 3%, on my May to August data).  With -0.2/0.2 treshold, pretty good, +30%. But lots of trade signals (25). Too much for my taste, I guess.

Thanks.
legendary
Activity: 1470
Merit: 1007
September 13, 2013, 11:49:44 AM
Oda, in your experience, how have 18/45 hourly held up? In my experience it's one of the most profitable, especially on BTCe.

I never tested anything on BTCe, but for mtgox:

I'm assuming 1% fee. Without treshold, poorly (minus 3%, on my May to August data).  With -0.2/0.2 treshold, pretty good, +30%. But lots of trade signals (25). Too much for my taste, I guess.
newbie
Activity: 41
Merit: 0
September 12, 2013, 07:40:02 PM
Oda, in your experience, how have 18/45 hourly held up? In my experience it's one of the most profitable, especially on BTCe.
legendary
Activity: 1470
Merit: 1007
September 10, 2013, 06:48:34 PM
Oda.krell, thank you very much for the excellent post. I will take it into account for my own testing, but so far, it seems to hold up (using a different range for testing.) I have a quick question for you, though: when using Gekko, you state that you've set the initial number of candles to 1 for testing, but when actually using Gekko to advise/trade, what do you set that value to?

I should say that I don't directly trade based on any single EMA method, I'm doing it half algorithmic, half intuitive :P

But to get the signals for my EMA methods, I use gekko with the default 100 intitial candles... no reason not to, I only set it to 1 so that in my backtest buy and hold and ema method would start on equal grounds.
member
Activity: 66
Merit: 10
September 10, 2013, 11:44:01 AM
Oda.krell, thank you very much for the excellent post. I will take it into account for my own testing, but so far, it seems to hold up (using a different range for testing.) I have a quick question for you, though: when using Gekko, you state that you've set the initial number of candles to 1 for testing, but when actually using Gekko to advise/trade, what do you set that value to?
newbie
Activity: 57
Merit: 0
September 09, 2013, 06:09:24 AM
Coolio. Doesn't do Forex yet, but still awesome.
legendary
Activity: 2478
Merit: 1362
September 09, 2013, 02:52:00 AM
Whoever came up with Cryptotrader is a genius. I wish such a thing existed for Forex. Or does it?

Yup, look at that: https://www.quantopian.com/
newbie
Activity: 57
Merit: 0
September 08, 2013, 08:10:59 PM
Whoever came up with Cryptotrader is a genius. I wish such a thing existed for Forex. Or does it?
legendary
Activity: 2478
Merit: 1362
September 08, 2013, 10:32:04 AM
Oda, great post, I'll read that carefully.

I leave this here : A usefull website to write algo/backtest/trade live (paid feature) - https://cryptotrader.org/
legendary
Activity: 1470
Merit: 1007
September 08, 2013, 07:59:22 AM
Preparing an addendum on 'higher volume trading'. Not as systematic as I would like it to be maybe, but I crudely estimated a range of slippage for higher volume (up to 1000btc) and will re-run the most promising parameter combinations (daily only, hourly will be pointless) with that range. Will be interesting, not sure if EMA can still beat B&H. I'll also repost it in a new thread once I'm done with that.
legendary
Activity: 1148
Merit: 1018
September 08, 2013, 06:15:20 AM
I guess that estimating slippage in function of volume will be tricky, market depth is constantly changing and a two equal market orders executed with a 5 minute difference can have dramatically different outcomes in term of slippage because of limit orders that quickly appear and disappear. Anyhow I'm really interested in the mythology you will follow and the results you will get!

Please consider copying your post to a dedicated thread. It's golden information and shouldn't be buried in the middle of another thread.
legendary
Activity: 1470
Merit: 1007
September 08, 2013, 06:06:09 AM
Oda: excellent post. You really covered everything. It definitely needs a thread on its own.

While I was reading it I was going to reply that when deciding a strategy, its mandatory to factor also a) the amount of time you will need to invest in trading and b) your trading volume, which will influence the amount of slippage you will have... But you already covered that too, bravo!

Finally, in my opinion 0.5% slippage on average is currently achieved by trading a rather smallish volume,  but I guess that it is a good estimation for 90% of the readers in this forum.

Thanks. Means something coming from you.

Re: slippage. When I ran the tests above I thought 1% fee is already rather high. Then we had a discussion about slippage with higher volumes, I boasted I never had trouble with it, and wham, a few hours later I suffered a loss mainly due to slippage. If I run another backtest, I will a) try to find a way to estimate slippage percentage as a function of volume and then b) run  different backtests with different "fee" values, i.e. how a method performs for small traders (say around 1 btc), medium traders (100 btc?) big traders (1000 btc maybe)
legendary
Activity: 1148
Merit: 1018
September 08, 2013, 06:01:02 AM
Oda: excellent post. You really covered everything. It definitely needs a thread on its own.

While I was reading it I was going to reply that when deciding a strategy, its mandatory to factor also a) the amount of time you will need to invest in trading and b) your trading volume, which will influence the amount of slippage you will have... But you already covered that too, bravo!

Finally, in my opinion 0.5% slippage on average is currently achieved by trading a rather smallish volume,  but I guess that it is a good estimation for 90% of the readers in this forum.
legendary
Activity: 1470
Merit: 1007
September 08, 2013, 05:46:07 AM
Warning: This is going to be an extremely long post. One day I will be able to write and explain my ideas in a more concise manner. Today is not that day. Consider yourself warned. There's a summary at the end that contains all the important bits, feel free to skip the rest.


Introduction

The following test of different EMA strategies was based on a few simple assumptions that can be summarized as follows:

(1) Recent performance (i.e. the result of back-testing on recent historical data) is a much greater factor in determining future profits than performance on older historical data.

(2) The simple parameter search we employ seems to favor curve fitting, which makes future performance of the parameters doubtful. Therefore, we need to back-test across different time segments to confirm results found in recent history.

(3) Trading is more expensive than previously assumed. It is necessary to take into account not only the rather high trading fees itself, but also slippage while executing a trade, and possibly even the delay between the EMA method signaling a trade and the trader executing it, which tends to cut into profits.


Methodology

The obvious parts: I'm using Gekko for back-testing, performing a search for optimal parameters for EMA crossover methods, yadda yadda yadday. All of the following is based on mtgox data.

I didn't perform an exhaustive search across those main EMA parameters, but only plugged in those values that had been previously established as profitable in this thread. In particular, I need to thank ErebusBat for his August 10 post, highlighting the profitable parameter ranges.

I only tested *hourly* and *daily* variants of the EMA method. A very sloppy test on 12h interval gave pretty bad results. I suspect that a 2h version of EMA crossovers (with different parameters of course) might peform quite well. I chose '1 hour' and '1 day' because I wanted to see results from the usable range of time periods: faster than 1h is almost certainly too sensitive, slower than 1d probably is too slow for the pretty volatile btc market.

Time period(s)

Like I said above, I believe it makes sense to put more weight on recent performance when trying to find optimal parameters for an EMA crossover trading strategy. The reason is simple: say a method performed spectacularly well during 2011 and 2012, but fails to generate any profit in the current year. It would be rather naive to simply look at the aggregate profit and conclude that the method will perform with that (aggregate) profit on average in the *future*. Basically, it would be nice if our method would have generated money not only in the distant past but also the last few months, right?

I decided to start the primary backtest after the April 10 peak, for the reason that the (double?) exponential growth  during the weeks before April was unusual, even for the fast bitcoin price movement. So post-peak it is. I based the decision where to start exactly after the peak on Bollinger Bandwidth (2h interval). Volatility around and immediately after the April 10 peak was extremely high, only around May 4th it went back to normal. Well, "bitcoin normal". So "recent history" is 2013-05-04 to 2013-08-22 (110 days). Almost 4 months, enough data to chew on in my opinion.

In addition, I needed another period to backtest the backtesting results on. For that I chose approximately a time period going back 1 year from, so the "entire history" is: 2012-10-22 to 2013-08-22 (304 days).

Benchmark

We need something to compare our results again, right? "Buy & hold" (from now on: B&H) is the obvious candidate. However, B&H is problematic. Why? You'll notice that when proponents of B&H on this forum talk about its profits, they assume you bought in at a really low price point, like in early January, or at the lowest point after the bubble burst in April. Which is bullshit of course. That's not "B&H", that's "magically knowing the local minimum", and if you can do that, you don't need trading advice anyway, you're already the richest person on Earth.

So let's define B&H for our purposes: B&H profit is calculated as the volume weighted 12h price in the middle of the last day of our testing period, divided by the price halfway through the first day of the testing period.

Gekko settings

As I said, I think most parameter searches in here assumed slightly too low trading costs. An actual trading fee of 0.5% is quite normal on mtgox as far as I know. Also, some slippage usually occurs (unless you buy or sell only minimal amounts). Finally,unless you have a trading bot, there will be a delay between the EMA method signalling a trade and the trade being executed, which often reduces profits. So I decided to set the "fee" value to 1%, which includes all profit reducing factors mentioned above. Note that setting this value higher favors B&H on the one hand, and "slower" EMA methods (i.e.  methods that react slower to trends, and yields less trade signals) on the other.

The intial history setting defines the number of candles at the beginning of the data that are reserved to calculate the EMA methods initial average values. Default is 100, but this is a bad value for our purposes: the EMA methods would include all the volatile data for the initial history that I carefully exluded. So candles is set to 1, which essentially means the EMA method buys immediately. Which is good, because that's what B&H, our benchmark, does as well, so they start on equal grounds.


Results

Finally.

Anyone still reading this?

Congratulations. You must be really bored.


Hourly intervals

The list starts with the classical EMA20/10, since that's how Goomboo's thread started. You will notice it performs pretty bad.

The only other parameters I list below are the ones that performed best during backtesting. In particular, if a parameter combination didn't manage to outperform the B&H benchmark on the recent data (May to August), I immediately dismissed it (except for EMA20/10), based on my initial assumption that performance on recent data matters most.
  
Results are ranked by profit on recent history (h1), followed by profit on the entire history (h2), the 'long' and 'short' average parameter, the optimal 'treshold' values and finally, number of trades executed.

Code:
time periods
------------

h1: 2013-05-04 to 2013-08-22 (110 days)

h2: 2012-10-22 to 2013-08-22 (304 days)


EMA results
-----------

* 1h EMA20+10, -0.3/0.3
  h1: +2.5%, 41 trades
  
* 1h EMA24+15, -0.4/0.4
  h1: +32%, 19 trades
  h2: +518%
  
* 1h EMA29+18, -0.25/0.25
  h1: +38%, 23 trades
  h2: +850%

* 1h EMA28+18, -0.4/0.4
  h1: +42%, 15 trades
  h2: +823%
 
Code:
benchmark
---------

recent history (h1): 2013-05-04 to 2013-08-22 (110 days), B&H profit: +9.9%

entire history (h2): 2012-10-22 to 2013-08-22 (304 days), B&H profit: +945%

Pretty good recent profits for the hourly methods, huh? But did you notice that I didn't find a single hourly EMA method that outperforms B&H on recent data AND on the entire history? Some come close though, EMA29+18 gives +850% on h2 vs. B&H 945% on h2.

But as I said several times, I don't think performance on the older data is equally important. It mainly serves as a sanity check, to protect us from too much curve fitting. Here's an example of such curve fitting: I found some combinations that perform *even better* when set to some very high treshold value, like -1.8/1.8, or some odd combination of treshold, like -0.2/1.8. If you test those parameters on the older history (h2) however, you'll see that it falls apart. That's a pretty good indicator that those parameters where the result of curve fitting.

In conclusion, several hourly parameter combinations drastically outperform B&H during h1, even with the rather high trading fee I chose. Those methods perform well enough on the entire history as well, so I expect them to be reasonably generalized and perform well enough in the (near) future.

Daily intervals

Tresholds were 0 for all of the daily results. The daily EMA crossover method is "cautious" enough already and doesn't benefit from tresholds, it seems.

Code:
EMA results
-----------

* 1d EMA21+20
  h1: +4%, 3 trades
  h2: +826%

* 1d EMA37+5
  h1: +6%, 5 trades
  h2: +288%

* 1d EMA24+15
  h1: +7%, 3 trades
  h2: +826%

* 1d EMA21+18
  h1: +9%, 3 trades
  h2: +847%

* 1d EMA29+12
  h1: +12%, 3 trades
  h2: +827%

* 1d EMA20+10
  h1: +17%, 3 trades
  h2: +366%
  
* 1d EMA5+1
  h1: +20%, 19 trades
  h2: +1339%
  
* 1d EMA20+1
  h1: +23%, 9 trades
  h2: +878%

* 1d EMA23+3
  h1: +24%, 5 trades
  h2: +564%

* 1d EMA24+2
  h1: +24%, 5 trades
  h2: +727%

* 1d EMA20+6
  h1: +32%, 3 trades
  h2: +676%

* 1d EMA16+4
  h1: +32%, 3 trades
  h2: +639%
 

Code:
benchmark
---------

recent history (h1): 2013-05-04 to 2013-08-22 (110 days), B&H profit: +9.9%

entire history (h2): 2012-10-22 to 2013-08-22 (304 days), B&H profit: +945%

As you can see, daily method profits on recent history are somewhat lower than those of the hourly variant, but the number of trades is much lower as well.

Also, I think I found the answer to a question that came up earlier in this thread. Marcus Antonius reported that daily EMA20+21 generated a spectacular 3533% profit over the entire history of trading. The h2 profit of that parameter in my own test confirm this, it is rather high at +826%. Applying this parameter to the recent data h1 however is much less spectacular, only +4% profit. It's up to you to decide of course, but I wouldn't trust a method, that once upon a time performed extremely well, but in the past months failed to generate any serious profits.

On to the better parameters: 20+6 for example performs very well on recent data (+32%) and reasonably well on the entire history (+676%, vs. B&H 945%).

One strange beast showed up in my search: EMA5+1 is a rather fast version of the daily method, compared to the other parameter combinations (see the high number of trades). It performs relatively well on recent data, and *extremely* well on the old data. I'm not sure what to make of it, but I suggest to watch how this combination performs in the future.


Summary / Conclusions

  • There's a trade-off between "historical" performance and "recent" performance. My assumption was that recent performance is more important for future performance, but we also need to look at performance in the more distant past to check how consistently profitable the found parameters really are.


  • EMA20+10 is dead. At least with hourly interval size.


  • Hourly EMA crossovers absolutely need treshold values to be profitable, especially if we assume relatively high cost of trading (fees+slippage).


  • One of the best *hourly* parameters I found during my search: EMA28+18, treshold -0.4/0.4. Profit May to August: +42% (vs. B&H profit +9.9%). Parameters hold up well in the "historical" back-test as well.


  • Good *daily* parameters: EMA20+6, EMA16+4. Both generate +32% profit on recent data. Note that those profits were generated with very few trades (3), which could be important if you want to trade as seldom as possible, and if your trading volume is large enough that your profits are reduced by large slippage.


  • Another profitable *daily* combination: EMA20+1. Profit May to August is +23% (less than the ones above), but still outperforms B&H during recent history. Note that this combination performed better on historical data, and it generated the recent history profit with a total of 9 trades, more than the parameters above, which increases the chance that future results are somewhat in line with historic results.


  • Which interval is better, hourly or daily? Hourly EMA methods can generate higher total profits in principle, but there's a trade-off: hourly requires a much higher number of trades to reach this profit, which means more work for the trader, more fees, more chance for slippage and more room to make mistakes. Personally, I would recommend using methods with daily interval size.


  • Here's my attempt to answer the recurring question "Can a simple strategy like EMA crossover actually beat B&H?". Answer: it depends. If you have (a) enough time to trade often, and more importantly: trade as soon as you receive a crossover signal, and (b) trade with a relatively small volume so that slippage stays manageable, then the crossover method beats B&H by a significant margin. On the other hand, if your goal is to trade as little as possible, or your trading volume is large enough that it causes significant slippage on your exchange, then B&H might be the better choice. But even if you use B&H, I would still suggest to use one of the daily EMA crossovers to determine at which point to *buy in*, e.g. to avoid buying in in the middle of a big correction/downtrend.


  • Another caveat: there's always the risk that past performance and future performance diverge. As we've seen, testing different EMA parameters on different partitions of the historical data yields very different results. There is always the possibility that the EMA parameters you choose now, based on back-testing, will actually generate a loss in the future. In practice this means you should probably define a limit up to which you trust your method: if the parameters you chose are unprofitable for, say, 2 or 3 months in a row, it might be time to look for new parameters.
newbie
Activity: 57
Merit: 0
September 06, 2013, 06:49:22 AM
- In other markets, I manage entries and exits using multiple timeframes

Would you give us an example?
full member
Activity: 133
Merit: 100
September 06, 2013, 06:17:55 AM
You end up losing a lot if you follow the averages now. I'm back to instinct mode for a couple weeks, until I feel market is healthy.
.
Uhh...what? Tongue  Daily traders are sitting on an unrealized profit of 41% on a position initiated on July 22nd, 2013.  Additionally, I posted this trade in this thread to demonstrate how to use the crossover.

Feelings are dangerous.  Have you backtested your feelings?  I've proven to myself that when I act on my feelings rather than a tested method, I consistently lose money.

Oops sorry, I was talking about the hourly averages (shame on me) I understood that was what most people in this thread are using. Of course daily EMA will smoothen the bumps ignoring most noise.

I know feelings are dangerous, leading you from trading to gambling, you teach me that on this very thread. But I just have very small amount of dollars on bitstamp, so can afford to gamble for short periods of time. Tongue

If I had any significant amount I would definitely follow your example and switch to the daily EMA. Thank you again.
legendary
Activity: 1148
Merit: 1018
September 06, 2013, 04:46:14 AM
legendary
Activity: 1470
Merit: 1007
September 06, 2013, 04:18:01 AM
I think Rampion gave a very good critical analyses of Gomboo trend following trading:
https://bitcointalksearch.org/topic/m.3087179

I respect Rampion's opinions in general, but I don't think this is a very good analysis of trend following trading. For one, he seems to have read only the first 2 or 3 pages of this thread, because he still talks about Goomboo's original 1 hour and 1 day EMA20+10 method, while in reality, this thread is, and has been for a long time, about properly backtesting algorithmic trading strategies, with vastly different parameters.

He has a point about fees and slippage -- as I just felt first-hand on bitstamp yesterday. My set of indicators gave decent, profitable signals in the past days, but slippage caused it to be a loss eventually. However, that's the first time this happened to me on such a scale.

Back to Rampion's post. I don't like that his whole argument is basically crafted around his initial assumption: that trend following crossover strategies aren't profitable. As a result, he jumps around between different arguments: it's too time consuming to check all that TA each day; even an algorithmic strategy requires some intuition when exectuing trades; fees&slippage eat into your profit...

...all of those points are true individually, but the conclusion he draws is not. Even taking into account higher fees & slippage, this type of trading has been proftiable, and we can show this by backtesting (*).

It's everyone's choice to trade differently, and there are good reasons to simply use buy&hold, but in then end, he's somewhat disingenuous when he writes:

> at the end of the day he is making an "informed gamble" as all the others TA daytraders do

Maybe TA daytrading is "informed gambling". But if that's the case, then buy & hold is "uninformed gambling" :D





(*) well, not really "show" of course since it's past performance, but backtesting is strong evidence in favor of it.
sr. member
Activity: 294
Merit: 250
This bull will try to shake you off. Hold tight!
September 05, 2013, 05:50:21 PM
I think Rampion gave a very good critical analyses of Gomboo trend following trading:
https://bitcointalksearch.org/topic/m.3087179
Pages:
Jump to: