GeniusTrader/TradeFilters/LongOnly.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 23 CC 2 SCAR 12.8
CC
2
Cov
0%
accept_trade
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.6
1 package Finance::GeniusTrader::TradeFilters::LongOnly;
2  
3 # Copyright 2000-2002 Raphaƫl Hertzog, Fabien Fulhaber
4 # This file is distributed under the terms of the General Public License
5 # version 2 or (at your option) any later version.
6  
7 # Standards-Version: 1.0
8  
9 use strict;
10 use vars qw(@NAMES @ISA @DEFAULT_ARGS);
11  
12 use Finance::GeniusTrader::TradeFilters;
13  
14 @NAMES = ("LongOnly");
15 @ISA = qw(Finance::GeniusTrader::TradeFilters);
16 @DEFAULT_ARGS = ();
17  
18 =head1 NAME
19  
20 Finance::GeniusTrader::TradeFilters::LongOnly - Only allow long trades
21  
22 =head1 DESCRIPTION
23  
24 This filter allows only long trades and reject short ones. This is
25 especially usefull for people who don't want to short the market.
26 Moreover, this filter is a must to find if a system perform better as a long
27 only system than either a short only or a long and short trading system.
28  
29 =cut
30  
31 sub accept_trade {
32 my ($self, $order, $i, $calc, $portfolio) = @_;
33
34 if ($order->is_buy_order) {
35 return 1;
36 } else {
37 return 0;
38 }
39 }
40  
41 1;