Exploration Performance Calendar week each Year

Hello friends,

I am using Amibroker and I want to do an Exploration for a Special calendar week in history. For example Performance from Gold in US-Dollar in calendar week 13 each year.

I know how to do Exploration with "Day of Week" or "Monthfunction" and I know how to explore tradingday of the year.

But I think calendar week is more complex. Any ideas how to do? Or is this afl still available?

Thanks in advance for your helping Hands.

Regards

Martin

@masiegert a formula to get the number of week of the year was posted here

Here I made one for daily TF.


/// Filter exploration output by number of weeks passed since beginning of year

/// @link [https://forum.amibroker.com/t/exploration-performance-calendar-week-each-year/11319/2](https://forum.amibroker.com/t/exploration-performance-calendar-week-each-year/11319/2)

week = 13;// set week since year start
yr = Year();
dow = DayOfWeek();
new_year = yr != Ref(yr,-1);
new_week = dow < Ref(dow, -1);
sum_weeks = SumSince(new_year, new_week);
Filter = sum_weeks == week-1;
AddColumn( Close, "Price", 1.2);

2 Likes

failure-message

Thanks but I got this failuremessage

aflcode%20kalenderwochenberechnung

Thanks I have got this afl and I want to share it here

"Failure, failure..."

There is no failure when running proper AmiBroker version!

How about investigating yourself why that message pops up?

It is showing that message because you need AmiBroker 6.10 for function SumSince.

Read here

https://www.amibroker.com/guide/afl/sumsince.html

On the top right corner you can read AFL 4.10.

So once again as it has been posted in other threads already.

Required AB version always is AFL version plus two... 4.10 plus 2 is... 6.10.

And since we all are math geniuses we may even subtract "two" from 6.10 and we get.... AFL 4.10.

Isn't math nice?

BTW there is also "What's new" page

https://www.amibroker.com/guide/whatsnew.html

And "big surprise".... SumSince is showing up there too.

Once again I'd like to thank you fxshrat for sharing your knowledge and coding abilities with us, I was just wondering how to do this exact task and found that you had already done it and shared it. Just wanted to say a big thank you. I for one truly appreciate it.
Tony

1 Like

I strongly advise using

Version( 6.40 );

on top of ANY formulas posted on this forum. This will prevent copy-paste artists from complaining and make them aware they are using too old version.

1 Like