[R-SIG-Finance] quantstrat spread parameter sweep problem
Brian G. Peterson
brian at braverock.com
Sat Apr 20 16:53:50 CEST 2013
On 04/20/2013 09:29 AM, Rob Schmidt wrote:
> I am stuck on making a parameter sweep of a spread and have attached
> the version that gets the farthest before failing. This has driven me
> to extreme measures like reading the documentation and trying to upgrade
> my debugging skills.
>
> The code gets through the basic calculations and makes a chart so the
> spread definitions seem ok. But it fails in applyParameter. The variable
> values are reasonable as far as I can tell until %dopar% in the foreach()
> command in parameters.R. Then the debugger takes the rest of the
> command in {} as a big chunk and my modest debug skills fail. This
> sweep code works when I use a single contract rather than a spread.
> Here is the error. The traceback points to the chunk of code after
> %dopar% so I won't repeat that.
%dopar% is running in parallel. Obviously you can't get a debugger down
into the child processes (debugging for parallel computing is an even
darker art than R coding).
You may be able to debug into your problem by calling registerDoSEQ()
before running your script, to force foreach into single threaded mode
so that you can debug into the foreach loop.
> Error in { (from spread-sweep05.R#193) : task 1 failed - "argument is of
This is saying the error is on line 193 of your script, but I suspect
that you're going to come back and say that is the applyParameters line.
Now that I've said all that, we've moved all our development attention
on parameter code to apply.paramsets instead of applyParameters. The
old code wasn't extensible enough, and we've basically abandoned it in
favor of a more flexible apporoach, and a refactored code base.
You can see all the documentation, and you should be able to find the
code in the paramsets.R file in the source. One of the luxor demos uses
the paramsets code, so you shjould be able to find example code to start
from as well in modifying your parameter specification.
Regards,
Brian
--
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock
More information about the R-SIG-Finance
mailing list