Finance::GeniusTrader::CloseStrategy - Manages opened positions
A CloseStrategy is more really a position manager. Once a system has opened a position, it's managed by a CloseStrategy. Managing means updating the stop and deciding when to close the position.
$cs->get_indicative_stop($calc, $i, $order, $pf_man, $sys_man)
$cs->get_indicative_long_stop($calc, $i, $order, $pf_man, $sys_man)
$cs->get_indicative_short_stop($calc, $i, $order, $pf_man, $sys_man)
This function returns an indicative stop level that should be set for the indicated day. It is used before a position is opened to evaluate a stop level that may be used by a MoneyManagement rule.
$cs->position_opened($calc, $i, $position, $pf_man, $sys_man)
$cs->short_position_opened($calc, $i, $position, $pf_man, $sys_man)
$cs->long_position_opened($calc, $i, $position, $pf_man, $sys_man)
Those functions are callback that are launched when a position has been opened. It can be used to place order on a target that will be valid until they are executed (ie no_discard=1). $cs->position_opened will call the right callback depending on the the position (short or long). It can also be used to set an initial stop level.
$cs->manage_position($calc, $i, $position, $pf_man, $sys_man)
$cs->manage_short_position($calc, $i, $position, $pf_man, $sys_man)
$cs->manage_long_position($calc, $i, $position, $pf_man, $sys_man)
Manage an open position of the corresponding type. The position may be augmented or reduced by sending new orders modified by $manager->set_order_partial(...). The stop may be updated with $position->set_stop(...).
$system->precalculate_all($calc)
$system->precalculate_interval($calc, $first, $last)
If you run a system on a long period of time you may want to precalculate all the indicators in order to benefit of possible optimizations. This is the role of those 2 functions.
Finance::GeniusTrader::CloseStrategy::get_registered_object($name); Finance::GeniusTrader::CloseStrategy::register_object($name, $object); Finance::GeniusTrader::CloseStrategy::get_or_register_object($name, $object); Finance::GeniusTrader::CloseStrategy::manage_object(\@NAMES, $object, $class, $args, $key);
To install Finance::GeniusTrader, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Finance::GeniusTrader
CPAN shell
perl -MCPAN -e shell install Finance::GeniusTrader
For more information on module installation, please visit the detailed CPAN module installation guide.