Hello Howard, I was reading about filters in your book and I don't understand TimeFrameSet behavior in AmiBroker. I was wondering what is the difference between calculating a value of weekly/monthly indicator using daily data or doing it with TimeFrameSet controls?
For example, one can calculate m, w and d average of RSI by just using parameters w = d * 5 and m = w * 4 (RSI(50) + RSI(10) +RSI(2))/3 //daily=2 periods, weekly=5*2, monthly=4*weekly In the script below can you please explain why average calculated from daily data (green plot line) is different to the average calculated using TimeFrameSet (red plot line)? it seems to be a small shift in values. Is this due to the TimeFrameExpand function filling up daily data array with monthly values? If this is the case then the more acurate result is obtained from daily calculations. This may not be the best example of using TimeFrameSet. Perhaps there one should use TimeFrameSet in other AFL coding applications. TimeFrameSet(inMonthly);//switch to monthly time frame m_rsi=RSI(2);//monthly rsi(2) TimeFrameRestore(); // restore time frame to original(daily) TimeFrameSet(inWeekly);//switch to weekly time frame w_rsi=RSI(2);//weekly rsi(2) TimeFrameRestore(); // restore time frame to original(daily) MonthlyRSI = TimeFrameExpand( m_rsi, inMonthly ); WeeklyRSI = TimeFrameExpand( w_rsi, inWeekly ); AvgRSI = (MonthlyRSI + WeeklyRSI + RSI(2))/3 ; //monthly, weekly and daily avg with TimeFrameSet control Plot(AvgRSI, "ExpRSIavg", colorRed); Plot((RSI(50) + RSI(10) +RSI(2))/3, "RSIavg", colorGreen); //plot monthly, weekly and daily avg calculated with daily data Regards Richard
