TimeFrameCompress
- compress single array to given time frame

Time Frame functions
(AmiBroker 4.50)


SYNTAX TimeFrameCompress( array, interval, mode = compressLast )
RETURNS ARRAY
FUNCTION The TimeFrameCompress function compresses single array to given interval using given compression mode available modes:
  • compressLast - last (close) value of the array within interval
  • compressOpen - open value of the array within interval
  • compressHigh - highest value of the array within interval
  • compressLow - lowest value of the array within interval
  • compressVolume - sum of values of the array within interval

To expand compressed array you should use the TimeFrameExpand function.

The TimeFrameCompress function is provided for completeness and it can be used when you want to compress single array without affecting built-in OHLC,V arrays. If you call TimeFrameCompress it does not affect results of other functions (opposite to TimeFrameSet).

For more information check Tutorial: Multiple time frame support

EXAMPLE wc = TimeFrameCompress( Close, inWeekly );

/* now the time frame is still unchanged (say daily) and our MA will operate on daily data */
dailyma =
MA( C, 14 );

/* but if we call MA on compressed array, it will give MA from other time frame */
weeklyma =
MA( wc, 14 ); // note that argument is time-compressed array

Plot( dailyma, "DailyMA", colorRed );

weeklyma =
TimeFrameExpand( weeklyma, inWeekly ); // expand for display

Plot( weeklyma, "WeeklyMA", colorBlue );
SEE ALSO TimeFrameExpand() function

References:

The TimeFrameCompress function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.