Amibroker-OLE-Interface
view release on metacpan or search on metacpan
lib/Amibroker/OLE/APXCreator.pm view on Meta::CPAN
=item B<range_type>
Range in Amibroker analysis refers to
'All Quotes' = 0
'1 recent bar(s)' = 1
'1 recent day(s)' = 2
'From-To-dates' = 3
So provide range number accordingly
=item B<apply_to>
Apply the settings to
'*All Symbols' = 0
'*Current' = 1
'*Filter' = 2
=back
=head2 OPTIONAL PARAMETERS
=over 1
=item B<periodicity>
This module assumes that there is no change in the amibroker custom time interval settings.
i.e Amibroker -> Tools -> Preferences -> Intraday Tab -> Custom Time Intervals.
Amibroker assigns a value to every intervals
Eg: (Below are the default Amibroker intervals provided and their default values)
yearly = -4
quarterly = -3
monthly = -2
weekly = -1
daily = 0
day/night = 1
hourly = 2
15-minute = 3
5-minute = 4
1-minute = 5
3-minute = 10
7-minute = 11
10-minute = 12
12-minute = 13
20-minute = 14
If you happen to change the custom time intervals, then the amibroker default values may change.
In that case you have to find out the actual value of the custom interval and pass as the parameter.
Eg:
periodicity => -5
(you can find this out by manually saving the apx file and checking the periodicity field)
How to create apx file manually:
=over 3
=item * Open Amibroker -> Analysis window -> Settings
=item * Edit settings as per your requirement
=item * Menu-> File-> Save_AS -> select (.apx extenstion)
=back
For more infor on apx file, check this forum : L<http://amibrokerforum.proboards.com/thread/57/analysis-project-files-apx>
=back
=cut
#
# Create the apx file that goes as input to the amibroker engine
#
my %periods = (
'yearly' => -4,
'quarterly' => -3,
'monthly' => -2,
'weekly' => -1,
'daily' => 0,
'day/night' => 1,
'hourly' => 2,
'15-minute' => 3,
'5-minute' => 4,
'1-minute' => 5,
'3-minute' => 10,
'7-minute' => 11,
'10-minute' => 12,
'12-minute' => 13,
'20-minute' => 14
);
sub create_apx_file {
my @list = @_;
my $args = _check_valid_args(@list);
if ( !$args->{timeframe} ) {
croak( '[ERROR}: No timeframe passed (Required parameter) : ' . "\n" );
}
if ( !$args->{periodicity} ) {
$args->{periodicity} = lc( $args->{timeframe} );
}
if ( !$args->{periodicity} ) {
croak( '[ERROR}: No periodicity found for given timeframe '
. $args->{timeframe}
. "\n" );
}
if ( !-e $args->{afl_file} ) {
croak( '[ERROR}: AFL file not present at:' . $args->{afl_file} . "\n" );
}
if ( !$args->{symbol} ) {
croak( '[ERROR}: Symbol name not passed (Required parameter):' . "\n" );
}
if ( !$args->{from} ) {
croak(
'[ERROR}: from date is not passed (Required parameter):' . "\n" );
}
if ( !$args->{to} ) {
croak( '[ERROR}: to date is not passed (Required parameter):' . "\n" );
}
if ( !$args->{apx_file} ) {
print
'[WARN]: apx_file is not passed, by default your apx file name will be : C:/'
( run in 1.189 second using v1.01-cache-2.11-cpan-39bf76dae61 )