Get weekly aux1 from daily timeframe


I need to get the weekly aux2 value from daily timeframe. I have tried according to the example but the value is wrong. Please help.

The weekly value is 35,047,698,432 as seen on image above.

The code:


aux2 is net buy sell stock , so weekly value is sum from each daily value.


  1. Your thread subject mentions aux1
  2. Your post content mentions aux2 all of the sudden
  3. Your chart already shows weekly timeframe so you do not need timeframe functions as time timeframe functions work from shorter interval to longer interval but not vice versa.
  4. The code is incorrect.
  5. You do not need timeframe code to call weekly interval if your chart shows weekly already. Simply set Aux aggregation mode to Sum in File - Database settings - Intraday settings.

Since your post is not rock solid clear and if you mean to say that you want to call aggregated Aux data of weekly interval in daily chart (despite your chart does show weekly) then read here


tmfrm = inWeekly;
Aux2Weekly = TimeFrameCompress(Aux2, tmfrm, compressVolume);// cumulative Aux data
TE = TimeFrameExpand(Aux2Weekly, tmfrm, expandLast);

And set chart interval to daily interval.

@stanleycia, your code constantly re-defines your TE value.

Why not give them independent names and TRACE them all to see what is happening.

Or, you could put the independent names in an Exploration to see them as well.

Ah sorry for the confussion. The code is correct, aux2 is the value that I worked on.
I show you the weekly chart just to make clear of the value, but I work primarily on daily timeframe, so I dont want to keep changing timeframe just to access the weekly data.

_TRACE(Name()+" TE="+NumToStr(te)+" T2="+NumToStr(T2)+" T3="+NumToStr(T3));

The trace:

INCO TE=65,008,840,704.000 T2=-64,337,506,304.000 T3=-64,337,506,304.000

As you can see from the trace, the result te or t2 or t3 is different from the value show on weekly interval.

You do not need to do such non sense.

Did you actually read upper post??

Thank you for your help.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.