[R-SIG-Finance] Entry + exit on the same bar? allowMagicalThinking?

Mike m|ke9 @end|ng |rom po@teo@n|
Wed Jun 22 00:06:55 CEST 2022


I like to backtest this strategy on EOD data:
1. If a long/short signal occurs on day 0 (signal day) then
  enter long/short on day 1 if the price exeeds signal day's high
  (long) or drops below signal day's low (short).
2. On execution of the entry order issue 2 exit orders combined by
  OCO:
  a. Stop loss at x% of entry price
  b. MOC of entry day (later I also like to backtest longer periods)
So the basic strategy holds the stock/asset for one day only (=one
bar).

Is there a way to exit on the entry bar anyway?
How would I to this by setting allowMagicalThinking=T?

Or can I trigger entry and the 2 exit orders by the same sigcol?
Would I have to make the entry rule non-path-dependent to have it
executed before the exit rule?

Mike



More information about the R-SIG-Finance mailing list