PureBytes Links
Trading Reference Links
|
Hello Keith,
This is precisely what I have done to modify the original code.
TimeFrameExpand fills up the weekly gap in daily data.
However, can you explain why average calculated from daily data
(green plot line in my AFL code) is different to the average
calculated using TimeFrameSet (red plot line)?
Regards
Richard
--- In amibroker@xxxxxxxxxxxxxxx, Keith McCombs <kmccombs@xxx> wrote:
>
> Here you go:
>
> |TimeFrameSet(*inWeekly*);//switch to weekly time frame
>
> w_rsi=RSI(2);//weekly rsi(2)
>
> TimeFrameRestore(); // restore time frame to original(daily)
>
> d_rsi=RSI(2);//daily rsi(2)
>
> wex= TimeFrameExpand(w_rsi,*inWeekly*);
> dex= TimeFrameExpand(d_rsi,*inDaily*);
>
> a= (wex + dex)/2;
>
> SetChartOptions(0,0,chartGrid10|chartGrid90);
> Plot(a,"daily and weekly average",*colorYellow*);
>
> *Filter* = 1; // set filter to select which bars to display
> AddColumn(wex, "wex"); // the more the merrier
> AddColumn(dex, "dex");
> AddColumn(a, "wdavg");
> |
>
> richpach2 wrote:
> >
> > 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 amibroker@xxxxxxxxxxxxxxx <mailto:amibroker%
40yahoogroups.com>,
> > "triangle702000" <jkra70@> 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();
> > >
> >
> >
>
------------------------------------
**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
*********************
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
*********************************
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|