danielkrizian / strategery

Quant Strategy Specification, Backtesting, Optimization And Statistical Analysis Workflow
10 stars 21 forks source link

Execution of orders doesn't take into account position rules/limits #12

Closed danielkrizian closed 10 years ago

danielkrizian commented 10 years ago

In this example of long-only strategy,

beforeFOMC <- 3

FOMC <- indicator( FomcDay(Date, before=beforeFOMC), input=cal)

Long <- (FOMC==TRUE) %position% shares(1)
Neutral <- (FOMC!=TRUE) %position% shares(0)

initial sell order is incorrectly implemented as short sale

image

image

Inspect also why Portfolio$calcPL() transforms this to -1 positions only

image

and moreover, why plot(Account$new(portfolios=list(btportfolio))$performance()) gets plotted as if it was pos = 1, not -1 (see buy-hold SPX shape of plot):

image