Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Hi All,
I'm trying to use TimeFrameCompress & TimeFrameExpand in my AFL.
I looked on couple of examples in AB support zone and code exmaples and from some reason i cannot make this work.
1. I've loaded Tick by Tick Data to AB database and set my basic working time frame to 1Min bars.
2. I want to calc AvgDailyVolume and DailyHHV/LLV using TimeFrameCompress and in my logic to get the last value from each one of them during each 1 min bar closes.
The code looks like -
DVC = TimeFrameCompress(Volume, inDaily);
DailyVolumeAvg = MA(DVC, 30); //calculate on daily time frame
//calculate on basic 1 min time frame
dailyAvgVolume = TimeFrameExpand(DailyVolumeAvg ,inDaily);
Plot( dailyAvgVolume , "dailyAvgVolume", colorYellow, styleOwnScale);
The problem is when i'm examing dailyAvgVolume on the chart with 1Min timeframe i see different results of then in daily timeframe. and the correct value is indeed when setting the chart to daily timeframe.
any idea's what's is wrong with this code?
Can you help answer these questions from other members on NexusFi?
It outputs wrong result because it contains incorrect code. You haven't read the entire article of the AmiBroker help file. Since it is Volume array you have to use compressVolume. compressLast is default one if nothing is specified.
Hi Prouser,
Your reply was very informative and helped me to get some progress.
I've read the entire article but my assumption that 'compressVolume' mode will sum up my volumes and since i needed to calc MA i just got confused and decided to use the default.
I've tried your approach and i still not able so see using Plot() the same values for AvgVol & HHV & LLV when i switch the chart between 1MinBars and DailyBars.
as you can see i'm using expandLast and not expandFirst you used in your answer. i changed it because when working with expandFirst i saw specific area's i should get a signal but the system did not found it as such. and i switched to expandLast i got the expected signal.
Having said that, i'd appreciate if you can exaplain the difference between those two modes.
Basically expandFirst gives the same results as expandLast if using Ref with one bar delay more compared to expandLast (i.e. expandFirst 1 bar delay and expandLast zero delay).
Same here. Same results if using expandfirst and zero delay.
As for your signals. I don't know your entire code so can't know what you are doing wrong there.