Skip to content
Prev 7298 / 15274 Next

quantstrat

On 01/10/2011 11:19 PM, Stephen Choularton wrote:
Thanks for reading the manual.
Yes, being able to go short is a pretty 'common sort of action'.  I do 
it every day across multiple instrument classes, currencies, and 
millions of dollars of net portfolio position (after converting back to 
USD).

Note that the bbands demo *as written* initiates short positions without 
any problem.  See attached pdf. That would likely suggest to anyone 
writing code that modified the working demo that the problem was likely 
in their code, not the package...

Do you not understand the documentation?

First flatten your position (get to zero) then initiate a short 
position.  stop. then reverse.

So, in the bbands demo, you would set up:

- a long entry entry at the lower band
- a long exit at the mid or upper band
- a short entry at the upper band
- a short exit at the mid or the lower band

The demo does that with three rules and using the orderside=NULL 
convenience, but I could easily have left only the mid-cross rule as 
orderside NULL and the other appropriate rules as 'long' and 'short'.

In a non-toy strategy, you'd probably also want to do something like 
addPosLimit to set how many signals you'll respond to.  Try one long and 
one short to start.
See above.

   - Brian