Optimal f

Share:

Description

Find optimal f for a set of trades

Usage

1
2
  optimalf(lsp, constrFun=NULL, constrVal=NULL,
    margin=NULL, equity=NULL, upper, lower, ...)

Arguments

lsp

A lsp object.

constrFun

A string naming the constraint function.

constrVal

The value of the constraint function that should not be exceeded.

margin

A vector of inital margin values for each event series.

equity

Current account equity.

upper

Upper f-value bounds (recycled, if necessary).

lower

Lower f-value bounds (recycled, if necessary).

...

Parameters to be passed to constrFun.

Value

f

Optimal f

G

GHPR at the optimal f

Author(s)

Joshua Ulrich

References

Vince, Ralph (2007) The Handbook of Portfolio Mathematics. New York: John Wiley & Sons, Inc.
Vince, Ralph (2009) The Leverage Space Trading Model. New York: John Wiley & Sons, Inc.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  data(port)
  
  # DEoptim parameters (see ?DEoptim)
  DEctrl <- list(NP=30, itermax=100)

  # Unconstrainted Optimal f
  res <- optimalf(port, control=DEctrl)

  # Margin-constrainted Optimal f
  resMargin <- optimalf(port, control=DEctrl,
    equity=1e5, margin=-port$maxLoss*2)

 ## Not run: 
  # Ruin-constrained Optimal f
  resRuin <- optimalf(port, probRuin, 0.1, DD=0.2,
    horizon=4, control=DEctrl)

  # Drawdown-constrained Optimal f
  resDrawdown <- optimalf(port, probDrawdown, 0.1, DD=0.2,
    horizon=4, control=DEctrl)

  # Create snow socket cluster for two cores
  library(snow)
  clust <- makeSOCKcluster(2)

  # Drawdown-constrained Optimal f using two cores
  resSnow <- optimalf(port, probDrawdown, 0.1, DD=0.2,
    horizon=4, snow=clust, control=DEctrl)
 
## End(Not run)