TimeFrameGetPrice
|
Time Frame functions |
SYNTAX | TimeFrameGetPrice( pricefield, interval, shift = 0, mode = expandFirst ) |
RETURNS | ARRAY |
FUNCTION | The TimeFrameGetPrice - retrieves OHLCV fields from other time frames. This works immediatelly without need to call TimeFrameSet at all.
First parameter - pricefield - is one of the following: "O", "H", "L", "C", "V", "I" (open interest). Interval is bar interval in seconds. You can use pre-defined interval constants: in1Minute, in5Minute, in15Minute, inHourly, inDaily, inWeekly, inMonthly. Or integer multiples like (3*in1Minute) for 3 minute bars shift allows to reference past (negative values) and future (positive values) data in higher time frame. For example -1 gives previous bar's data (like in Ref function but this works in higher time frame). mode - one of available modes:
Note these functions work like these 3 nested functions:
therefore, if shift = 0 compressed data may look into the future ( weekly high can be known on monday ). If you want to write a trading system using this function please make sure to reference PAST data by using negative shift value. The only difference is that TimeFrameGetPrice is 2x faster than nested Expand/Compress. For more information check Tutorial: Multiple time frame support |
EXAMPLE | // Example 1. get previous
week Open price |
SEE ALSO | TimeFrameSet() function |
The TimeFrameGetPrice function is used in the following formulas in AFL on-line library:
See updated/extended version on-line.