Pages:
Author

Topic: Much Ado About Moving Averages (Read 2841 times)

full member
Activity: 239
Merit: 100
June 11, 2014, 12:23:22 PM
#21
I backtested from 1/1/2012-6/1/2014.  Here is what we get: net profit $805, 46 trades, 60% profitable, 23% drawdown and a profit factor of 3.25. It looks like the short SMA values caused most of your losses through whipsaw trades. You can see the results on the link below:

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

When you email us for bitconnector, then reference this forum post and I'll also send you the strategy code.  In NinjaTrader the backtesting allows you to easily change all the variables when backtesting, so I made all the lookbacks into variables.

Also, oda.krell is right about including slippage and commissions to make results the most realistic.  I didn't include them, but various levels of slippage/commission can be added as well as order quantity can be changed.
Ah, shame, I had such a good feeling about it Cry

Oh well, thanks for designing and trying it out anyhow! Just emailed you guys, so hopefully I can get started with devising funky strategies as soon as possible. I'm still of the conviction that the MACD+MA combo has great merit, just need to alter it some to adjust for "noise" signals resulting in the whipsaw trades. Maybe change the short SMAs to DEMAs since, as you say in the OP, they're supposedly better.
newbie
Activity: 32
Merit: 0
June 11, 2014, 11:56:25 AM
#20
Out of curiosity, could you backtest a combination strategy, giving buy and sell signals both at SMA10/7, DEMA33/18 and MACD 21, 28 crossings?

I am interested enough to see how this turns out I'll call it "The Follow Sheep" strategy and i'll give you the code if you want it.  To be clear, do you want all of these conditions met on every entry/exit or do you want to enter/exit if any one of the conditions is met independently of the others?
Heh, excellent name! Grin I'd greatly appreciate the code if it turns out to be profitable. Actually, I'd greatly appreciate the code regardless, as then I could have a look at it to get a basic gist of whatever scripting/programming language you use, download BitConnector and start playing around with different strategies myself.

Enter/Exit if any one of those conditions are met independently. I looked at charts and noticed that sometimes MACD gave better timed buy and sell signals, and sometimes the moving averages, and so got the gut feeling that a combination would get me the best of both worlds Smiley

I backtested from 1/1/2012-6/1/2014.  Here is what we get: net profit $805, 46 trades, 60% profitable, 23% drawdown and a profit factor of 3.25. It looks like the short SMA values caused most of your losses through whipsaw trades. You can see the results on the link below:

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

When you email us for bitconnector, then reference this forum post and I'll also send you the strategy code.  In NinjaTrader the backtesting allows you to easily change all the variables when backtesting, so I made all the lookbacks into variables.

Also, oda.krell is right about including slippage and commissions to make results the most realistic.  I didn't include them, but various levels of slippage/commission can be added as well as order quantity can be changed.
legendary
Activity: 1470
Merit: 1007
June 11, 2014, 10:27:34 AM
#19
Forgot to ask in the first place, but what's the cost per trade during the backtest?

Given even moderate volume, slippage+fees (mainly slippage, though) easily reach 4% per trade pair. Once that is taken into account, I suspect any strategy that just cranks out one trade after another won't be profitable compared to one with less frequent trades.

That said, I'd still like to see the follow_sheep results Cheesy
full member
Activity: 239
Merit: 100
June 11, 2014, 10:10:44 AM
#18
Out of curiosity, could you backtest a combination strategy, giving buy and sell signals both at SMA10/7, DEMA33/18 and MACD 21, 28 crossings?

I am interested enough to see how this turns out I'll call it "The Follow Sheep" strategy and i'll give you the code if you want it.  To be clear, do you want all of these conditions met on every entry/exit or do you want to enter/exit if any one of the conditions is met independently of the others?
Heh, excellent name! Grin I'd greatly appreciate the code if it turns out to be profitable. Actually, I'd greatly appreciate the code regardless, as then I could have a look at it to get a basic gist of whatever scripting/programming language you use, download BitConnector and start playing around with different strategies myself.

Enter/Exit if any one of those conditions are met independently. I looked at charts and noticed that sometimes MACD gave better timed buy and sell signals, and sometimes the moving averages, and so got the gut feeling that a combination would get me the best of both worlds Smiley
newbie
Activity: 32
Merit: 0
June 11, 2014, 09:05:02 AM
#17
I added a filter of the 50 day SMA. It eliminated 1 trade that resulted in a $99 loss.  However, it also introduced lag on trade entries.  I did not add a MACD, however, by itself it beat the DEMA with the 50 day SMA.  In any case,  increasing filters (i.e., adding prices above x MA and other indicators) lowers the chances that the results in the past will be representative in the future.

I'm not trying to rain on anyone's parade.  if you have a strategy that is working and it fits your style, then by all means make money.  As far as backtesting goes, it is important to keep in mind that there are no free lunches and that adding additional filters can have costs.
Out of curiosity, could you backtest a combination strategy, giving buy and sell signals both at SMA10/7, DEMA33/18 and MACD 21, 28 crossings?

I am interested enough to see how this turns out I'll call it "The Follow Sheep" strategy and i'll give you the code if you want it.  To be clear, do you want all of these conditions met on every entry/exit or do you want to enter/exit if any one of the conditions is met independently of the others?
hero member
Activity: 574
Merit: 500
June 11, 2014, 03:19:17 AM
#16
STill waiting on access to to your BETA ninja add-on Huh

EDIT: ...lolz should have checked email b4 posting  Cheesy
full member
Activity: 239
Merit: 100
June 11, 2014, 12:40:17 AM
#15
I added a filter of the 50 day SMA. It eliminated 1 trade that resulted in a $99 loss.  However, it also introduced lag on trade entries.  I did not add a MACD, however, by itself it beat the DEMA with the 50 day SMA.  In any case,  increasing filters (i.e., adding prices above x MA and other indicators) lowers the chances that the results in the past will be representative in the future.

I'm not trying to rain on anyone's parade.  if you have a strategy that is working and it fits your style, then by all means make money.  As far as backtesting goes, it is important to keep in mind that there are no free lunches and that adding additional filters can have costs.
Out of curiosity, could you backtest a combination strategy, giving buy and sell signals both at SMA10/7, DEMA33/18 and MACD 21, 28 crossings?
member
Activity: 112
Merit: 10
June 10, 2014, 11:39:56 PM
#14
$637 is broken, $600 is coming
newbie
Activity: 32
Merit: 0
June 10, 2014, 11:31:01 PM
#13
That one swings both ways:

"At/near the $1200 ATH, the moving average avoiding bulls were extremely confident that the rally would continue forever, and didn't sell in time."


The daily DEMA 33/18 suggested by OP gave a buy signal ~520 on April 15, holding since then. That's not exactly perfectly catching the bottom, but far from shabby considering that we're now more than $100 higher.
Furthermore, I imagine Moving Average-based trading can be made far more accurate by using clever combinations of different MA crossings, as well as MACD and price-MA crossings, to get earlier signals and confirmations (very important for twitchy exponential moving averages which can sometimes give false signals). For example, price crossing daily SMA50 on May 20th in addition to the DEMA crossing would've served as stronger buy confirmation and allowed one to buy at 460-ish, at the same time of the bear trendline breakout, and the decision (to hold) would've been further reinforced by daily MACD shooting up.

Of course as you say it's still largely reactive trading and personally I prefer other methods to (primarily) base my decisions on. But MA-strategies/momentum trading have the advantage of being fairly easy and straight-forward (and also easily automated for the more lazy traders Smiley ).


I added a filter of the 50 day SMA. It eliminated 1 trade that resulted in a $99 loss.  However, it also introduced lag on trade entries.  I did not add a MACD, however, by itself it beat the DEMA with the 50 day SMA.  In any case,  increasing filters (i.e., adding prices above x MA and other indicators) lowers the chances that the results in the past will be representative in the future.

I'm not trying to rain on anyone's parade.  if you have a strategy that is working and it fits your style, then by all means make money.  As far as backtesting goes, it is important to keep in mind that there are no free lunches and that adding additional filters can have costs.
full member
Activity: 239
Merit: 100
June 10, 2014, 11:54:38 AM
#12
That one swings both ways:

"At/near the $1200 ATH, the moving average avoiding bulls were extremely confident that the rally would continue forever, and didn't sell in time."


The daily DEMA 33/18 suggested by OP gave a buy signal ~520 on April 15, holding since then. That's not exactly perfectly catching the bottom, but far from shabby considering that we're now more than $100 higher.
Furthermore, I imagine Moving Average-based trading can be made far more accurate by using clever combinations of different MA crossings, as well as MACD and price-MA crossings, to get earlier signals and confirmations (very important for twitchy exponential moving averages which can sometimes give false signals). For example, price crossing daily SMA50 on May 20th in addition to the DEMA crossing would've served as stronger buy confirmation and allowed one to buy at 460-ish, at the same time of the bear trendline breakout, and the decision (to hold) would've been further reinforced by daily MACD shooting up.

Of course as you say it's still largely reactive trading and personally I prefer other methods to (primarily) base my decisions on. But MA-strategies/momentum trading have the advantage of being fairly easy and straight-forward (and also easily automated for the more lazy traders Smiley ).
legendary
Activity: 1470
Merit: 1007
June 10, 2014, 11:27:45 AM
#11
can anyone give me a dumb down explanation of all this (for noobs like me) greatly appreciated.

Here is a simple run-down in my own words:
TA (Technical analysis) is a useful set of tools, but not always accurate.
Moving Averages have severe issues for traders who count on them heavily.

At/near the recent lows (~$400/BTC) the moving average Bears where extremely confident they should not buy, and that was clearly the wrong "signal". By the time key moving averages give a clear signal you probably missed a large part of the move, and/or certainly didn't get the best prices.


That one swings both ways:

"At/near the $1200 ATH, the moving average avoiding bulls were extremely confident that the rally would continue forever, and didn't sell in time."


The daily DEMA 33/18 suggested by OP gave a buy signal ~520 on April 15, holding since then. That's not exactly perfectly catching the bottom, but far from shabby considering that we're now more than $100 higher.
full member
Activity: 228
Merit: 100
June 10, 2014, 11:17:15 AM
#10
Here's a great page to track moving averages of many coins: http://www.cryptocoinstats.com/priceaverage.php
legendary
Activity: 2114
Merit: 1040
A Great Time to Start Something!
June 10, 2014, 11:13:14 AM
#9
can anyone give me a dumb down explanation of all this (for noobs like me) greatly appreciated.

Here is a simple run-down in my own words:
TA (Technical analysis) is a useful set of tools, but not always accurate.
Moving Averages have severe issues for traders who count on them heavily.

At/near the recent lows (~$400/BTC) the moving average Bears where extremely confident they should not buy, and that was clearly the wrong "signal". By the time key moving averages give a clear signal you probably missed a large part of the move, and/or certainly didn't get the best prices.
legendary
Activity: 1470
Merit: 1007
June 10, 2014, 04:37:39 AM
#8
I can give a quick overview of moving averages.  A simple moving average merely takes the average price over the last x number of periods.  So, a 5 day moving average will give the average price over the last five days.  An exponential and double exponential moving average weights the most recent prices more heavily.

 This is usually put on a chart in the form of a line.  A moving average crossover is thought to be a buy/sell signal to indicate changes in momentum.   So if the 5 day moving average crosses a 25 day moving average it indicates the prices have moved up.  People use different periods of moving averages to try to better indicate profitable signals.  

hope that helps.

Thanks for clearing that up, it makes more sense to me.

Maybe one addition: Head over to Goomboo's thread if you're intersted, he's doing a very understandable introduction to average based systematic momentum trading.

You need to understand one thing though (that took me a while to really get my head around last year when I started trading): there's a tradeoff... "momentum methods", like trading based on signals from different moving averages gives you the ability to backtest your method and parameters (what let_me_backtest_that suggested in his first post). That's a huge plus. On the other hand, momentum trading means, by definition, that you "follow" the market. You will sometimes miss the early part of a huge swing because your signal isn't there yet. You will sometimes enter a trade that will end in a slight loss, because your averages whipsawed (that means: they crossed over, but then the trend never really formed, and the cross over again in the opposite direction)

Where I'm getting at: average crossover methods are a great starting place for a trader, in my opinion, if for no other reason than that they really invite rigor and planning, as opposed to "intuitive" trading which usually ends in tears. On the other hand, not everyone is comfortable with mainly "reactive" trading, which trading with averages is in the end, so you need figure out what trading style works best for you.
hero member
Activity: 518
Merit: 500
June 09, 2014, 08:13:26 PM
#7
I can give a quick overview of moving averages.  A simple moving average merely takes the average price over the last x number of periods.  So, a 5 day moving average will give the average price over the last five days.  An exponential and double exponential moving average weights the most recent prices more heavily.

 This is usually put on a chart in the form of a line.  A moving average crossover is thought to be a buy/sell signal to indicate changes in momentum.   So if the 5 day moving average crosses a 25 day moving average it indicates the prices have moved up.  People use different periods of moving averages to try to better indicate profitable signals. 

hope that helps.

Thanks for clearing that up, it makes more sense to me.
newbie
Activity: 32
Merit: 0
June 09, 2014, 05:50:39 PM
#6
I can give a quick overview of moving averages.  A simple moving average merely takes the average price over the last x number of periods.  So, a 5 day moving average will give the average price over the last five days.  An exponential and double exponential moving average weights the most recent prices more heavily.

 This is usually put on a chart in the form of a line.  A moving average crossover is thought to be a buy/sell signal to indicate changes in momentum.   So if the 5 day moving average crosses a 25 day moving average it indicates the prices have moved up.  People use different periods of moving averages to try to better indicate profitable signals. 

hope that helps.
hero member
Activity: 518
Merit: 500
June 09, 2014, 03:23:02 PM
#5
can anyone give me a dumb down explanation of all this (for noobs like me) greatly appreciated.
newbie
Activity: 32
Merit: 0
June 09, 2014, 03:07:36 PM
#4
Thanks for the questions and response!

I'll make the sales pitch short and sweet:  For someone who doesn't use fully automated systems bitconnector allows you have multiple real time charts open with saved charting parameters, 100s of built in indicators, real time alerts via email when trading conditions are met and increased order functionality like stoploss orders.  

About DEMA:

1. Yes, it would've been hard sit through the dead cat bounce to 1000.  Systematic trading takes the same kind of discipline as discretionary trading to be successful.  A mere backtest wouldn't give you that confidence.  There would have to be in and out of sample tests, testing on unseen data, monte carlo simulations etc.

2.  I will agree that for other methods such as filtering, trend identification and retracement trades, the DEMA may not be the best.  Also, the exact combination for each of the crossovers is surely curve fitted.  I merely chose the most profitable for comparison purposes.  I did find the same results when researching profit factor and % profitable.   Below are the top 20 optimized results that were not included in the original backtest (Jan -June 2014).  

SMA
https://i.imgur.com/kz3qEI1.png

EMA
https://i.imgur.com/unhdXp6.png

DEMA
https://i.imgur.com/e7YfrCF.png


 
legendary
Activity: 1470
Merit: 1007
June 09, 2014, 02:10:50 PM
#3
Much appreciated, OP.

Never tried NinjaTrader, but will give it a shot. Also, what are the advantages of signing up for BitConnector for someone who doesn't use fully automated trading? Care for a sales pitch, I'm actually interested Smiley

Two short remarks about the DEMA results:

One, the resulting trades in the 2013/2014 bear market are extremely "unintuitive". Example: You would have had to sit out (all fiat potentially) the entire dead cat bounce to ~1000. It's certainly possibly if you really, really trust your momentum signal, but, boy, I would have been nervous during that period.

Two, I don't agree that the DEMA beats the other options straight and obvious. The optimal parameters you gave for the DEMA are, imo, almost certainly overfitted. The initial post-ATH SELL signal lands *perfectly* on the first rebound. I can't say exactly how much your profit comes from that instance, but it's probably a good chunk. This is almost certainly a lucky hit, and won't be reproducible.

What I'm trying to say is: DEMA might still be the preferably choice for average crossover strategies, but at least the DEMA parameters you mention look like they owe a good deal of their profit to one lucky trade after the bubble popped.

DEMA chart:

full member
Activity: 230
Merit: 100
June 09, 2014, 11:58:22 AM
#2
Many thanks for this, very appreciated!

😀
Pages:
Jump to: