I've found a solution for this. I had wanted to find a way to use indicators based on the weekly timeframe while backtesting in the daily timeframe, without being subject to the "expandFirst" / "expandLast" problem.
The solution is to use the indicator as normal, but multiplying the parameters by five. Thus my 50-week EMA becomes EMA(C,250), and my weekly MACD(12,26,9) becomes MACD(60,130,45). I've compared the two visually, and they are virtually identical. Hope this helps, Paul --- In [email protected], "polomorabe" <[EMAIL PROTECTED]> wrote: > > I wonder if anyone can help me with this backtesting problem I've been > having. I backtest in the daily frame, and as an extra filter, I use > the slope of the weekly MACD historgram. I use the TimeFrameExpand > function to bring the weekly data into the daily timeframe. > > For ages, I noticed a discrepancy between my backtest results and my > daily scan results, and yesterday I think I found the reason for it. > > What I have noticed is that, for example if the weekly MACD-H for IBM > changes direction on Wednesday's close. This means that when I do my > daily exploration before the Thursday open, IBM will become a stock > buy candidate, if all other conditions are satisfied. However, when I > backtest at the end of the week, IBM appears as a buy candidate on > Monday, because the weekly MSCD-H condition is satisfied for the > entire week. > > I went back to the User Manual, and found the explanation for the > TimeFrameExpand function expandFirst and expandLast parameters. Does > this mean that the calculated weekly value is made available on either > Monday or Friday of the given week? > > Is there a way to correctly backtest the case where the weekly signal > becomes valid in mid-week? > > Many thanks, > Paul >
