need help following Janeczko's implementation of multiple time frame analysis
I tried asking this on another site and got no replies, so I thought I'd try here
.
I'm relatively new to Amibroker -- I'm currently evaluating the trial version -- and I'm trying (apparently unsuccessfully) to follow the instructions given by Tomasz Janeczko for implementing a "multiple time-frame MACD" at http://www.amibroker.com/docs/MTFIndicators.html. Specifically, he writes:
*******************
Formula 1. Multiple time-frame MACD. Note: in order to run this code and calculate multiple time-frame MACD, enter it into Automatic Analysis (AA) window, go to Settings window, make sure that Periodicity is set to 1-minute. Then press "Scan" button in the AA window.
Count = 0;
result = 0;
for( i = 10; i <= 300; i++ )
{
TimeFrameSet( i * in1Minute );
m = MACD(12, 26 );
TimeFrameRestore();
m = IIf( TimeFrameExpand( m, i * in1Minute ) > 0, 1, -1 );
result = result + m;
Count++;
}
AddToComposite( result / Count, "~MACD"+Name(), "X" );
Buy=1;
*****************
When you follow the instructions you're supposed to have your original price chart marked with buy and sell arrows, and to see a new pane that shows the composite indicator. In my case, there are no arrows on the original price chart, and the new pane that's supposed to contain the composite indicator is blank. Is there anything missing from his instructions I need to do? Or could it be that, because I'm evaluating the trial, something like this won't work? I've tried implementing a couple of other formulas, and they appear to work OK.
Here are the details, in case it helps:
I created a new database with a base period of 1 tick, and imported a month's worth of tick data (for a futures contract) using $TICKMODE 1; it imported without issue. I then generated a chart from this with 1-minute bars and clicked on it to activate it. I then copied the above code, clicked on Analysis->Formula Editor, pasted it there, saved it, changed the periodicity in "Backtester Settings" (I assume that's what he meant by "Settings") to 1 minute and hit "Scan."
Unfortunately, what I got was a table listing Buys only, one at the close of each and every minute (so clearly something isn't working here). When I click on the portfolio equity icon I get two panes: the upper one is the 1-minute bars of my data, but without any arrows marking trades. The lower one is blank and says, at the top:
"The formula 'Formulas\Drag-drop\_Portfolio_Equity.afl' is empty-no chart to display." When I click on the reports icon, I get a trade report which says there were 0 trades. Finally, when I click on "Charts" under the reports icon, it says, for each of the "Equity" boxes:
"Not enough data available. To plot any chart at least 3 data bars are needed, but there are only 0 bars in '~~ "
This of course doesn't make sense, since the main Analysis window lists the time and close of each and every minute bar -- so it does have the data.
I also repeated the above, this time importing minute data instead of tick data, and got the same result.
The only explanation I can offer of what's wrong is that it has something to do with the fact that I'm using the trial version:
Note that the trial version doesn't save databases. The message I get when the data is deleted is the same as that above ("...there are only 0 bars..."), suggesting that the problem is that the analysis isn't seeing any data (though this doesn't make sense, for the reason indicated above). So either I'm making a very basic mistake in implementing the above code (in which case I would greatly appreciate any assistance in correcting my error), OR the problems are a result of limitations inherent to the trial version (which would be unfortunate, since the trial is supposed to be fully-functional, to facilitate evaluation).
I tried asking this on another site and got no replies, so I thought I'd try here
I'm relatively new to Amibroker -- I'm currently evaluating the trial version -- and I'm trying (apparently unsuccessfully) to follow the instructions given by Tomasz Janeczko for implementing a "multiple time-frame MACD" at http://www.amibroker.com/docs/MTFIndicators.html. Specifically, he writes:
*******************
Formula 1. Multiple time-frame MACD. Note: in order to run this code and calculate multiple time-frame MACD, enter it into Automatic Analysis (AA) window, go to Settings window, make sure that Periodicity is set to 1-minute. Then press "Scan" button in the AA window.
Count = 0;
result = 0;
for( i = 10; i <= 300; i++ )
{
TimeFrameSet( i * in1Minute );
m = MACD(12, 26 );
TimeFrameRestore();
m = IIf( TimeFrameExpand( m, i * in1Minute ) > 0, 1, -1 );
result = result + m;
Count++;
}
AddToComposite( result / Count, "~MACD"+Name(), "X" );
Buy=1;
*****************
When you follow the instructions you're supposed to have your original price chart marked with buy and sell arrows, and to see a new pane that shows the composite indicator. In my case, there are no arrows on the original price chart, and the new pane that's supposed to contain the composite indicator is blank. Is there anything missing from his instructions I need to do? Or could it be that, because I'm evaluating the trial, something like this won't work? I've tried implementing a couple of other formulas, and they appear to work OK.
Here are the details, in case it helps:
I created a new database with a base period of 1 tick, and imported a month's worth of tick data (for a futures contract) using $TICKMODE 1; it imported without issue. I then generated a chart from this with 1-minute bars and clicked on it to activate it. I then copied the above code, clicked on Analysis->Formula Editor, pasted it there, saved it, changed the periodicity in "Backtester Settings" (I assume that's what he meant by "Settings") to 1 minute and hit "Scan."
Unfortunately, what I got was a table listing Buys only, one at the close of each and every minute (so clearly something isn't working here). When I click on the portfolio equity icon I get two panes: the upper one is the 1-minute bars of my data, but without any arrows marking trades. The lower one is blank and says, at the top:
"The formula 'Formulas\Drag-drop\_Portfolio_Equity.afl' is empty-no chart to display." When I click on the reports icon, I get a trade report which says there were 0 trades. Finally, when I click on "Charts" under the reports icon, it says, for each of the "Equity" boxes:
"Not enough data available. To plot any chart at least 3 data bars are needed, but there are only 0 bars in '~~ "
This of course doesn't make sense, since the main Analysis window lists the time and close of each and every minute bar -- so it does have the data.
I also repeated the above, this time importing minute data instead of tick data, and got the same result.
The only explanation I can offer of what's wrong is that it has something to do with the fact that I'm using the trial version:
Note that the trial version doesn't save databases. The message I get when the data is deleted is the same as that above ("...there are only 0 bars..."), suggesting that the problem is that the analysis isn't seeing any data (though this doesn't make sense, for the reason indicated above). So either I'm making a very basic mistake in implementing the above code (in which case I would greatly appreciate any assistance in correcting my error), OR the problems are a result of limitations inherent to the trial version (which would be unfortunate, since the trial is supposed to be fully-functional, to facilitate evaluation).
Last edited: