[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] TimeFrameSet question for Howard



PureBytes Links

Trading Reference Links

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



------------------------------------

**** 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/