TimeFrameSet question

I have an issue with the use of TimeFrame. I have looked through the AFL guide and read ( a few times ) the tutorial relating to TimeFrame issues, searched the forum for examples, and actually all seems pretty clear to me. Only problem is I cant get it to work.

I have a strategy that I have been trading successfully for a year based on standard EOD data. I want to try to improve this with some further restrictions based on intraday entries and exits so now am in posession of a years worth of intrday data from Pi.

I have loaded my Amibroker with the EOD code and also the 1-minute data I purchased. To test functionality the very first statement I have altered in the code is TimeFrameSet( inDaily ) to make sure my strategy will repeat the EOD backtest performance using time compressed 1-minute data. I do not ever use TimeFrameRestore so assume all calculations will now be done based on daily data. I would thought this would be enough to accomplish this test, but apparently not, as my backtest returns nothing.

Any help would be most appreciated.

Do you realize that you have answered your own question already!

You simply ignore documentation examples using TimeFrameSet(), TimeFrameRestore(), TimeFrameExpand() despite of having read them (as you said).

So don’t be surprised about your outcome.

Solution is simple one, re-read tutorial(s) and follow exactly the examples given there instead of coming up with own ideas of which of those three functions are required (a la
"Today I’m going to try this funky TimeFrameExpand function only because today the sun is shining and since it is getting warmer out there it means something is expanding…" No, don’t come with such or similar conclusions!).

If selected interval being 1-min (as in your case) and there doing calculations in Daily TF and if applying TimeFrameSet() then it is mandatory action to apply TimeFrameRestore and TimeFrameExand from the must-have list also in order to have data properly aligned.

1 Like

Sheesh, must you guys always be so condescending in your responses ! I am NOT ( despite what you think ) a complete and utter idiot. I will happily compare my trading ROR with you !

But I will openly admit I am not a master at programming Amibroker, I am a beginner and would like a little assistance from people who genuinely care to assist others.

Sometimes I think some of you who respond this way are just school yard bullies, hiding behind the internet so noone can call you an asshole to your face.

Thanks for your assistance.


I really “like” guys like you who start whining out loud when their problems got solved and nothing seriously bad having happened actually. Instead in between their lines or behind closed doors they are the actual ones being receptive to using name calling.

I did not call you asshole (like you have indirectly written so stop being a pathetic hypocrite) nor have I bullied you. Where? Because I was stating the fact that you have just ignored tutorial(s) you read? You did not me. Or because of the sunny fictional story? (No sense of little humor at all? Bad weather on your end? Not my fault.)

Instead you should be thankful that I have taken my free time for pointing out your wrong doings directly. You won’t forget in the future again. Be rest assured.

I am not here to make friends (friends are not made via Internet) and have no intentions to spread virtual social network kisses and truckload of emoticons all over the place.

@rangemaster and @fxshrat - guys please cool down. It really leads to nowhere when we assume bad intentions from one another.

People on the forum, including me, come from various parts of the earth and english is not mother’s tonque of many of us.
We may lack “feeling” of subtleties of the language and native speakers may interpret the tone in other way than intended. Native speakers take english for granted. For many it is not.

That is why answers from non-natives are rather direct and lack “stylistic sugar” and native speakers may interpret it as rude, even though they are not intended to be rude in the eye of the writer.

For better or worse in Internet era english is communication medium and not everyone is Shakespeare. Not everyone is in fact at the level of 10 year old english native speaker. Sometimes people stuggle to take the message across. Imagine yourself writing in foreign language. It is not “automatic” experience.

So please give others a little leeway and please don’t assume bad intentions.

By the way it is pretty common that technical forums come across as “rude”, see the most popular technical forum on the planet StackOverflow:


Some questions sometimes are not perfect too and “trigger” “questionable” responses

We live in the world that is running at supersonic speed and everyones tries to get the job done in quickest possible way and that sometimes mean cutting corners.

So when somebody points out the part of the manual it is not meant as rude. The person who answers does NOT know you and does NOT know what you did and what you did not. Some people already read the manual part pointed to, some did not. There is simply no way for person who is hundreds miles away to know what the other person thinks/did. So please take that into account. If you met personally and drank a bottle of beer or wine you would probably say that “this other guy is quite nice after all”.
Internet is awful communication medium and non-verbal communication is all lost (and that is usually 90% of the entire message), so please keep that in mind and try to be accommodating. I am struggling with all that myself, I am actually quite bad, but well at the moment we have to try at least .


To the matter itself:

That won’t work because (quote from http://www.amibroker.com/guide/h_timeframe.html):

How does it work internally ?

Time-frame functions do not change the BarCount - they just squeeze the arrays so you have first N-bars filled with NULL values and then - last part of the array contains the actual time-compressed values. This is why it is essential to expand the data back to the original frame with TimeFrameExpand. The following simple exploration shows what happens after you switch to a higher timeframe. Run Exploration on current symbol, all quotations, periodicity set to daily and you will see how “weekly close compressed” column contains empty values at the beginning and weekly compressed data at the end of array.

 Filter = 1;
AddColumn(Close, "Daily close");

AddColumn(wc = Close, "weekly close compressed");

AddColumn( TimeFrameExpand(wc, inWeekly), "weekly close expanded"); 

So in one sentence if you don’t expand, you will have incorrect timestamps.

So to test DAILY interval using compressed intraday data, you need to go to the Settings and change Periodicity to “DAILY”. AmIBroker will compress intraday data for you and perform daily backtest with correct timestamps as explained here: http://www.amibroker.com/kb/2006/03/19/how-does-the-daily-time-compression-work/

TimeFrame functions are intended NOT to replace Periodicity setting. These two have different purpose and different inner working.


I completely agree with your comments, and with the Stack Overflow comments. But I will suggest that no matter what level of English proficiency is available many of these types of comments are truly rude. I do not go out of my way to critique the subtleties of the poor English in the responses, but I could have, as the English was not great, but I choose not to attack that perspective. I am sorry it has come to this, but if these people do not actually want to help me ( and I am convinced they do not ) then why do they even respond at all. I have become almost “afraid” to ask questions on this forum for fear of getting blasted, because it so often happens. I can see by responses out there many others get slammed as well. Some maybe deserve it a bit because of a lack of homework. I thought my request was made in a very pleasant tone and I had done a fair bit of homework. Why does it have to be this way ? I am very appreciative of people who genuinely want to help.

Amibroker is a fantastic product. But getting help is a painful process.


Thanks for the very informative answer. I truly do appreciate that kind of response :slight_smile:

1 Like

You see here we go again. A total hypocrite complaining about rudeness and being the only one being rude so far the whole time in this thread and spreading wrong assumptions all other the place. If that is not the epitome of rudeness what is it then?

Have you actually cared to read and understand my response? You wrote you never ever did use TimeFrameRestore nor TimeFrameExpand (who actually told you not to use them? For sure not the docs) and I have told you to not do that but have corrected you that instead those two are mandatory to be used together with TimeFrameSet in order to properly align data of higher compression.

Too bad there is not downvote feature here like at StackOverFlow for such whiners. :sob:

EDIT: Here is your English mother tongue for you:
“No good deed goes unpunished”


From your perspective it is valid point. On the other side of the channel there is a person who tries to help but does not have enough information about you. He/She does not know what kind of experience you have and what you did already. Pretty often questions are very vague and guessing game starts. Many of those guesses/assumptions that are made by person who tries to help can be incorrect. Yet, an attempt to help is being made. Such attempt should be appreciated. I know that it may hurt the ego if you already did what is advised in reply, but as I wrote in my previous reply, the responder does not know you and does not know what you did already. If you were face-to-face your face expression would give him/her infinitely more information and you would get to the agreement in few seconds. But this is all lost in text, so the person who tries to help starts with ‘lowest common denominator’ and it may hurt somebody on the other side, even though there were NO bad intentions in reply.

@rangemaster I don't want to take any side here and I would like to point out, that I am also against rude replies, but I really don't see that many rude replies on this forum - they are exceptions.

Consider the fact, that writing a really useful and informative reply takes someone like me (I am Polish) much more time than it would take a native speaker. What bothers me is the fact, that many users (among them native speakers) are not willing to spend more that 1 minute to write a question (I am not talking about you) and in return they expect an essay explaining everything in detail. Morover in many cases the solution could be found in 10 seconds using Google or this forum's search functionality, because similar or identical questions have been asked x times or are explained in details in AB documentation. What is most frustrating and what happens really often are situations when user x receives a really helpful response - sometimes containing ready to use code and doesn't find the time to say thank you - instead just disappears into thin air.... You devoted your free time, maybe spent an hour or more helping some unknown user and you have the right to feel disgruntled. If all of this happen over and over you might not tollerate that very well ...

Lastly, I have taken fxshrat's side many times (and maybe I shouldn't do it again for some reasons) but I have to, one more time. You are new here - you have joined 3 days ago, yet you have written that you are convinced, that fxshrat's intention was not to help you. By the way, you also used plural (these people do not actually want to help me), so you are convinced that there are more people who devote their time just to criticize or bully others on this forum. I would say it is very unfair - especially in case of the user who (apart from Tomasz) has gathered by far the highest number of likes - currently 390! Those likes come from users who find his replies valuable. Even if sometimes harsh, they are almost always very informative. You will find that out when reading hundreds or thousands other posts on this forum...




@Tomasz that is an excellent point that many of us (myself included) often forget. Attempts an humor on a forum such as this, with users from many countires and cultures and over a wide range of ages (with members from their 20’s into their 80’s), is very difficult without those non-verbal communication messages we would send and receive if we were actually sitting together in a room.

I too believe that most of us have much in common (with our passion for analysis of the financial markets and AmiBroker of course) and would enjoy each other’s company if we lived in the same town. I look forward to more posts @rangemaster, and do not get discouraged.


Old story, back in 2004 I think Fred and I had something that could be delicately described as “disagreement” :slight_smile: on the old mailing list. But then we met face to face in Houston on FT conference few years later and quickly he found out that I am not that octopus from bad nightmare, and I found out that he is cool guy and we laughed for hours.

1 Like

In that case, I suggest setting-up AmiBroker Globetrotter Team whose responsibility would be meeting face to face with AB enthusiasts all over the world and spreading good word about AmiBroker among disbelievers :wink: :smile:

But seriously it would be great to get to know other users and of course you Tomasz in reality …

… and then you would find out (oh no!) that my brain is not filled with numbers but is truly empty :slight_smile: