I am a mere novice in terms of trading and would like some help and thoughts from someone with some experience on the following.
I was trying to backtest MACD histogram models yesterday so that I went long at a an upwards change in direction of a histogram and sold on this reversing.
In backtesting this, I got some good success testing against 2003 data. On most randomly selected groups of shares I got between 20% and 40% return.
However when tested against 2002 data, it lost without fail. I assumed this was because the market generally was in a downtrend and I was going long so put in a filter so a trade would only be accepted if the 25 day moving average was above the 30 day moving average - assuming this would ensure I only bought on uptrends. I still got loss after loss.
Can anyone give me some advice on this use of this indicator. When to use it, when not to, which shares it works for, which it doesn't (and why).
For anyone with amibroker - the code I've been using is as follows:
PositionSize=-10;//this means that 10% of current portfolio is invested each time
H0 = MACD() - Signal ();
H1 = Ref (MACD(), -1) - Ref (Signal(),-1);
H2 = Ref (MACD(), -2) - Ref (Signal(),-2);
H3 = Ref (MACD(), -3) - Ref (Signal(),-3);
H4 = Ref (MACD(), -4) - Ref (Signal(),-4);
H5 = Ref (MACD(), -5) - Ref (Signal(),-5);
H6 = Ref (MACD(), -6) - Ref (Signal(),-6);
a25=EMA(Close,25);
a30=EMA(Close,30);
Buy = H0>H1 AND H1>H2 AND H2<H3 AND H3<H4 AND H4<H5 AND a25>a30
Sell = H0<H1 AND H1<H2 AND H2>H3 AND H3>H4 AND H4>H5;
ApplyStop (0,1,15,0)
I was trying to backtest MACD histogram models yesterday so that I went long at a an upwards change in direction of a histogram and sold on this reversing.
In backtesting this, I got some good success testing against 2003 data. On most randomly selected groups of shares I got between 20% and 40% return.
However when tested against 2002 data, it lost without fail. I assumed this was because the market generally was in a downtrend and I was going long so put in a filter so a trade would only be accepted if the 25 day moving average was above the 30 day moving average - assuming this would ensure I only bought on uptrends. I still got loss after loss.
Can anyone give me some advice on this use of this indicator. When to use it, when not to, which shares it works for, which it doesn't (and why).
For anyone with amibroker - the code I've been using is as follows:
PositionSize=-10;//this means that 10% of current portfolio is invested each time
H0 = MACD() - Signal ();
H1 = Ref (MACD(), -1) - Ref (Signal(),-1);
H2 = Ref (MACD(), -2) - Ref (Signal(),-2);
H3 = Ref (MACD(), -3) - Ref (Signal(),-3);
H4 = Ref (MACD(), -4) - Ref (Signal(),-4);
H5 = Ref (MACD(), -5) - Ref (Signal(),-5);
H6 = Ref (MACD(), -6) - Ref (Signal(),-6);
a25=EMA(Close,25);
a30=EMA(Close,30);
Buy = H0>H1 AND H1>H2 AND H2<H3 AND H3<H4 AND H4<H5 AND a25>a30
Sell = H0<H1 AND H1<H2 AND H2>H3 AND H3>H4 AND H4>H5;
ApplyStop (0,1,15,0)