- switch time frame compression mode
Time Frame functions
|| TimeFrameMode( mode )
|| Switches time frame functions to different operating modes. Where mode is one of 0, 1, 2, 3, or 4.
Note: N-volume bars are very different from time-based bars(compression of data to N-volume bar may actually deliver MORE output bars - for example if one tick is 1000 shares and you have specified 100V bars then single tick will be expanded to TEN 100V bars - ten times original size)
- TimeFrameMode( 0 );
- switches time frame functions to time-based operation (the default)
TimeFrameMode( 1 );
- switches time frame functions to N-tick operation (positive values passed to TimeFrameSet are treated now as N-tick)
TimeFrameMode( 2 );
- switches time frame functions to N-volume bar operation (positive values passed to TimeFrameSet are treated nowas N-volme bars)
TimeFrameMode( 3 );
- switches time frame functions to N-Range bar operation (positive values passed to TimeFrameSet are treated now as N-range bars) where N is expressed in DOLLARS
(This mode is left in 5.14 and above for backward compatiblity only, see next)
TimeFrameMode( 4 );
- switches time frame functions to N-Range bar operation (positive values passed to TimeFrameSet are treated now as N-range bars) where N is expressed in TickSize units (this is default mode of operation
of range bars in 5.14 and above).
TimeFrame functions are protected against array overrun and will not decompress beyond original array size (you will get an "Error 47. N-volume bar compressed data longer than base time frame").
Also switching main time frame to some weird N-volume bar value will result in limiting the output to maximum twice original data size(without error message).
You should keep that in mind and avoid using too small N-volume bar intervals that could lead to such condition.
Also due to the nature of N-volume bars the only TimeFrameSet() function will yield correct N-volume bar values, TimeFrameGetPrice() may give slightly distorted results.
It is also possible to use n-volume bars in TimeFrame functions without calling TimeFrameMode() - it is then necessary to specify n-volume bars as negative number offset by -1000000 (minus one million):
TimeFrameSet( -1000000 - 2000 );
TimeFrameMode( 2 );
TimeFrameSet( 50000 ); //
50'000 share bars..
//...do something ...
|| TimeFrameSet() function , TimeFrameRestore() function
The TimeFrameMode function is used in the following formulas
in AFL on-line library:
Updated on-line reference