Skip to content
Prev 12889 / 15274 Next

quantstrat - trailingStop offsets?

On Mon, Oct 13, 2014 at 7:52 AM, Brian G. Peterson <brian at braverock.com> wrote:
If the entry is 'efficient' to the extent that the entry price within
3% of the low
before the market starts moving in my direction then, yes, you are right. There
wouldn't be any advantage.

On the other hand, if the entry is not efficient and I'm in too early
then I want
to give it more breathing room (5%) before it starts moving. In this example
I define 'moving' as 2% in my favor.

Granted, position size for a fixed dollar risk is smaller.
No, I think you do understand based on the last idea at the end.
OK, Joshua pointed me at order sets in luxor.5.strategy.ordersets.R so
I'm looking there.
Maybe I'm driven too much by TradeStation history but many traders
there look for some sort of a 'break even' exit if the trade doesn't meet
a profit target. I.e - I'm targeting a 5% win. I'l accept a 5% loss until I get
to a 3% profit at which time I will expect to break even worst case.

(That's different than what I proposed at the outset where I would accept a
1% loss if I make it to 2% gain max before it falls back, but I am pretty sure
you see the idea.)
So I'll need to figure out what you mean by 'cancel' but the wording
seems like what I'm looking for.

General code idea?

If (MaxGain < 2%){
   enable.rule('luxor','chain','StopLoss',enabled=TRUE)
   enable.rule('luxor','chain','StopTrailing',enabled=FALSE)
}else{
  enable.rule('luxor','chain','StopLoss',enabled=FALSE)
   enable.rule('luxor','chain','StopTrailing',enabled=TRUE)
}

Does quantstrat allow the state of a rule be dynamic like that?
Much thanks!

Cheers,
Mark