I've posted this at both traderji.com and on the AmiBroker (AB) Yahoo message boards (http://finance.groups.yahoo.com/group/amibroker/message/171248), and no one has been able to give a working response (I got an oddly disconnected reply from the developer that bore no useful connection to my question), so I thought I'd try here .
AB is currently able to create composite indicators based on multiple time bar series
(multi timeframe: http://www.amibroker.com/docs/MTFIndicators.html). However, I'd like to test a strategy that uses a composite indicator built on multiple N-Range bar series. [MultiCharts reportedly has this capability, but I'd like to be sure it can't be done in AB before taking the time to evaluate MultiCharts.]
One can easily create N-Range bars in AB using either: (A) TimeFrame Set(-N); OR (B) TimeFrameMode(4);
TimeFrameSet(N);. However, to create a strategy that uses
indicators from multiple frames, they must ultimately be decompressed and then
aligned into a single common frame, as shown in the above link. For time bars, this
alignment can be easily done using TimeFrameExpand()
(http://www.amibroker.com/guide/afl/afl_view.php?id=244 : "TimeFrameExpand is
used to decompress array variables that were created in different time frame.
Decompressing is required to properly display the array created in different
time frame.").
However, I've tried using TimeFrameExpand with N-Range bars [e.g.,
TimeFrameExpand(something, -N)], and it doesn't work with them. Additionally,
AB support staff confirmed that this approach will not work with N-Range bars
("No, that won't really work with range bars, i.e. you won't be able to align
the data back to the original position.").
I've also tried using TimeFrameMode(4), and then TimeFrameExpand(something, N) (i.e., passing a
positive integer N to TimeFrameExpand() in order to expand from an N-Range bar
frame), and that did not work either.
So clearly this alignment cannot be accomplished with AB's built-in functionality.... But I wonder if anyone might be able to think of some clever non-standard way to approach this problem.
It seems AB could do it in theory. After all, AB knows, to the second (based on
the tick data I give it), the timestamp for the close of each range bar. It
could, in principle, use that to align multiple range bar sets in
TimeFrameExpand. Yes, there might be an issue if, for example, more than one
10-tick range bar formed in a second, and a 15-tick range bar also formed during
that same second. In that case, Amibroker might not know how to order them
within that second (10,10,15 vs. 10,15,10, etc.). But for my data that's rare
and, besides, that might only create localized errors within that second.
[And hypothetically, if AB could append microsecond timestamping to keep exact
track of tick sequencing on imported data (they'd not be actual microseconds,
but just a counter), the simultaneity problem could be eliminated; but let's
worry about that for now...]
To combine 10-tick and 15-tick range bar frames, one approach might be:
TimeFrameMode(4);
TimeFrameSet(10);
//Do stuff
TimeFrameRestore;
TimeFrameSet(15);
//Do stuff
TimeFrameRestore;
But then I would need to figure out a way to use the time stamps to align them
myself, since TimeFrameExpand can't expand range bars. And then in the
Backtester settings, I would need to know how to set the periodicity (perhaps 1
second, if I'm aligning them based on second timestamps).
Any ideas?
AB is currently able to create composite indicators based on multiple time bar series
(multi timeframe: http://www.amibroker.com/docs/MTFIndicators.html). However, I'd like to test a strategy that uses a composite indicator built on multiple N-Range bar series. [MultiCharts reportedly has this capability, but I'd like to be sure it can't be done in AB before taking the time to evaluate MultiCharts.]
One can easily create N-Range bars in AB using either: (A) TimeFrame Set(-N); OR (B) TimeFrameMode(4);
TimeFrameSet(N);. However, to create a strategy that uses
indicators from multiple frames, they must ultimately be decompressed and then
aligned into a single common frame, as shown in the above link. For time bars, this
alignment can be easily done using TimeFrameExpand()
(http://www.amibroker.com/guide/afl/afl_view.php?id=244 : "TimeFrameExpand is
used to decompress array variables that were created in different time frame.
Decompressing is required to properly display the array created in different
time frame.").
However, I've tried using TimeFrameExpand with N-Range bars [e.g.,
TimeFrameExpand(something, -N)], and it doesn't work with them. Additionally,
AB support staff confirmed that this approach will not work with N-Range bars
("No, that won't really work with range bars, i.e. you won't be able to align
the data back to the original position.").
I've also tried using TimeFrameMode(4), and then TimeFrameExpand(something, N) (i.e., passing a
positive integer N to TimeFrameExpand() in order to expand from an N-Range bar
frame), and that did not work either.
So clearly this alignment cannot be accomplished with AB's built-in functionality.... But I wonder if anyone might be able to think of some clever non-standard way to approach this problem.
It seems AB could do it in theory. After all, AB knows, to the second (based on
the tick data I give it), the timestamp for the close of each range bar. It
could, in principle, use that to align multiple range bar sets in
TimeFrameExpand. Yes, there might be an issue if, for example, more than one
10-tick range bar formed in a second, and a 15-tick range bar also formed during
that same second. In that case, Amibroker might not know how to order them
within that second (10,10,15 vs. 10,15,10, etc.). But for my data that's rare
and, besides, that might only create localized errors within that second.
[And hypothetically, if AB could append microsecond timestamping to keep exact
track of tick sequencing on imported data (they'd not be actual microseconds,
but just a counter), the simultaneity problem could be eliminated; but let's
worry about that for now...]
To combine 10-tick and 15-tick range bar frames, one approach might be:
TimeFrameMode(4);
TimeFrameSet(10);
//Do stuff
TimeFrameRestore;
TimeFrameSet(15);
//Do stuff
TimeFrameRestore;
But then I would need to figure out a way to use the time stamps to align them
myself, since TimeFrameExpand can't expand range bars. And then in the
Backtester settings, I would need to know how to set the periodicity (perhaps 1
second, if I'm aligning them based on second timestamps).
Any ideas?