Hello, I think, I know what you are doing wrong but, I don't understand this behaviour in AmiBroker. Perhaps Howard can comment on this post. I was reading about filters in Howard's book and I was wondering what is the difference between calculating a value of weekly indicator using daily data or doing it with TimeFrameSet controls? Clearly, 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 In the script below your original avg does not change with the scroll function when TImeFrameExpand is added to calculate the average. However, can someone explain why average calculated from daily data (green plot line) is different to the average calculated using TimeFrameSet (red plot line)? 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((m_rsi + w_rsi +RSI(2))/3,"avg. m-w-d rsi",colorWhite); Plot(AvgRSI, "ExpRSIavg", colorRed); Plot((RSI(50) + RSI(10) +RSI(2))/3, "RSIavg", colorGreen); //monthly, weekly and daily avg with daily Regards Richard --- In [email protected], "triangle702000" <jkr...@...> wrote: > > I've attempted to put together an indicator to display the average of > the monthly,weekly,and daily RSI. At first glance it seemed to come > out ok,but when I used the bar at the bottom right of the screen to > scroll back in time,I noticed that the new indicator changes when I'm > scrolling while with a regular RSI,or any other indicator for that > matter,the values stay the same for any particular day even though > they are scrolling by on the screen.( I'm not sure if I'm explaining > this very clearly.) > > For instance, say the value is 16.33 for aug. 1 2008. If I use the > bar to scroll back , the indicator line changes as it's scrolling and > if I click on aug 1 again the value will be different say 7.29. Also > I calculated the average of the last day shown manually and it does > not match the value shown by the indicator.It's my first attempt > using "timeframe", so I'm still trying to get the hang of it.Thanks > for any help you can give. Here's the code I wrote... > > SECTION_BEGIN("avg of m,w,d rsi"); > 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) > > > Plot((m_rsi + w_rsi +RSI(2))/3,"avg. m-w-d rsi",colorWhite); > _SECTION_END(); >
