Bitcoin Forum
May 22, 2024, 02:38:28 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 [3]  All
  Print  
Author Topic: Let's Backtest Some Indicators  (Read 7725 times)
Alisho
Full Member
***
Offline Offline

Activity: 206
Merit: 100


View Profile
September 21, 2014, 03:02:03 AM
 #41

DOES MACD BEAT BUY AND HOLD?

The MACD is a fairly straightforward momentum indicator.  It consists of the difference between a 12 and 26 bar EMA.  The difference between these two moving averages is the MACD.  It is smoothed by a 9 Day EMA that is called the "signal line."

The MACD  is usually plotted with a histogram that represents the difference between the MACD and the signal line.  The histogram can give either positive or negative values.  On the traditional interpretation, a buy signal occurs when the signal line crosses the MACD and a sell signal occurs when the signal line crosses below the MACD.   See the example below:

https://i.imgur.com/Llda1qf.png

The MACD is a popular indicator on BTC forums.  How does it hold up historically? Does it beat  buy and hold?  How does a long and short strategy perform?  We will perform two backtests.  The first will be a MACD long and short strategy.  The second will be a long only strategy.  Finally, we will compare this to buy and hold.

We will make the following assumptions: (1) The backtest will cover 1/'1/2012-6/1/2012.  (2) We will reinvest profits beginning with a $1,000 account.  (3) We will keep the default parameters for the MACD.

EDIT: The backtest is performed over 1/1/2012-6/1/2014

How does the long/short strategy perform?

The strategy entered 41 total trades - 59% were profitable- net profit was $9,820- there was a 98% a drawdown and a profit factor of 6.42.  See below

https://i.imgur.com/UcJD6aH.png

I am also attaching a youtube replay of each trade in the system to get a better feel for how the system would've worked.

https://www.youtube.com/watch?v=3mwCZOr-6fc&feature=youtu.be

You will notice that the system trades a different number of BTC depending on the account size.  Once it hit a large drawdown at the end of April 2013, then the system did not have the equity to trade larger quantities of BTC.

https://i.imgur.com/vwQTIqI.png

Now let's backtest the long only system.

The strategy entered a total of 21 trades - 76.19% were profitable - net profit was $135,000,  there was a 19% drawdown and a profit factor of 60.41.

https://i.imgur.com/ZFZLGI5.png

Here is the youtube replay.

https://www.youtube.com/watch?v=jE_eDDAe10w&feature=youtu.be

Ultimately, MACD outperforms a buy/hold strategy as seen below.  The Buy/Hold had a net profit of $126,600 and a drawdown of 73%.  (For Buy/Hold I entered a buy at the open of everyday with the same amount of BTC 202 on each trade to make the performance equivalent. )

https://i.imgur.com/kz70wD9.png

Here are a few takeaways:

1. Ultimately, MACD long only does beat buy and hold on both a net profit and drawdown.   It caught every major uptrend even though it lagged the market.

2. However, MACD long only underperformed buy and hold during the large price increases.  At one point, someone would've seen their BTC holdings drop from 202 to 58 due to price increases, lag and some losing trades.

3.  The drawdown  in USD on the MACD strategy is superior to buy/hold.  Returns should always be related to risk.  Someone trading the MACD would've had a $1,982 drawdown in USD, while the buy/hold drawdown equaled $159,000.

You can download updated BTC historical data formatted for NinjaTrader here:

http://www.signalstrengthfinance.com/bitconnector-bitcoin-trading-on-ninjatrader/

You can download the code for your own analysis on my blog;

http://www.signalstrengthfinance.com/bitcoinchartsmacd/


Trade Well and Prosper

Hi, thanks very much for this amazing work.. Could you share the code for the MACD indicator is this is possible.. I have not knowledge in programming.. I would really thankful. I would like to test it with other parameters.
xcapator
Sr. Member
****
Offline Offline

Activity: 322
Merit: 252

Here I Am !!


View Profile
December 18, 2014, 10:31:51 AM
 #42

With this type of indicator you could reasonably predict when the next long term spike is about to occur. Using 10 to 1 leverage you could turn 10 BTC into 12 pretty easily. (minus the fees)

Pages: « 1 2 [3]  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!