[amibroker] Re: 4 weeks candles/backtesting

 

4 weeks = 20 bars (not 28 as you mention) providing there are no public holidays etc. 


If using weekly time frame then they will always start on a Monday (or the next trading day if a public holiday, and end on a Friday (or previous trading day if a public holiday) 

By way of example, If using ROC(C,1) in the weekly time frame - It will take the Friday Close (for a week starting Monday) and the Friday close of that week to calculate the ROC. That it, it wont use the Monday and Friday Close of the week. 

Run the below in explore mode, and pick a stock and ensure you see what data it drawing, it will give you a good idea on how to achieve what you are looking for. You can also play with Close, Open etc. 

TimeFrameSet(inMonthly);
Annual = ROC( C, 12);
sixmonth = ROC (C,6);
threemonth = ROC(C,3);
TimeFrameRestore();

TimeFrameSet (inWeekly);
eightweeks = ROC (C,8);
fourweeks = ROC(C,4);
oneweek = ROC(C,1);
TimeFrameRestore (); 

daily = ROC(C,1); 

Filter=1;

AddTextColumn (FullName(), "Full Name", 77);

addcolumn ( annual, "Last 12 Months");
addcolumn ( sixmonth, "Last 6 Months");
addcolumn ( threemonth, "Last 3 Months"); 

addcolumn ( eightweeks, "Last 8 Weeks");
addcolumn ( fourweeks,"Last 4 Weeks");
addcolumn (oneweek, "Last Week");
AddColumn(MA(C,25), "SMA25");
AddColumn(Close, "Close");
addcolumn (daily, "Daily"); 


Cheers Adam

__._,_.___

Posted by: madwill26@yahoo.com.au
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (6)

Check out the automatic photo album with 2 photo(s) from this topic.
first day every 4th week.PNG rolling 4 week bar.PNG

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/


.

__,_._,___


EmoticonEmoticon