I am attempting to tweak a quantstrat based backtest but have run into an issue.

The maxPos limits are share based, and I would rather use a fixed dollar amount instead. So I've tried generating a max position based on a fixed dollar amt divided by the closing price:

MaxPos = 10000/Cl(OLN)

but this throws the following error:

Error in xts(cbind(maxpos, longlevels, minpos, shortlevels), order.by = as.POSIXct(timestamp)) : 
  NROW(x) must match length(order.by)

There is limited documentation on how to work with this package and I am really stuck on what would seem to have a simple solution.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.