[R-SIG-Finance] setting quantstrat stoplimit threshold to a signal value

Brian G. Peterson brian at braverock.com
Thu Jun 30 12:04:51 CEST 2011


On Thu, 2011-06-30 at 01:15 -0700, bb01100100 wrote:
> I am testing a simple strategy in quantstrat, whereby I would like to
> set a 'stoplimit' order equal to 75% of the Donchian Channel range. 

Please provide a reproducible example, per the posting guide. (put
another way, I'm not going to write an entire strategy to figure out
your bug).

Now, some general advice for when you rework your strategy:

You could do what you want with sigFormula, but it will be slow, because
of its flexibility.

Instead, look at how the other demo scipts make use of indicators and
signals.

What you've described is 
- one indicator which is the Donchian Channel
- another indicator which is 75% of the Donchian Channel range
- a rule which enters limit orders at your second indicator, likely
adjusting the limits whenever the indicator changes

Also, take a look at how the demos and documentation use the quote()
function.

If you post a complete example, odds are someone here will help you sort
out the details; and wouldn't a Donchian Channel demo strategy be a nice
addition to the package? ;)

Regards,

   - Brian

-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock



More information about the R-SIG-Finance mailing list