Thanks for the tips Mike. I checked and did have "Allow same bar exit selected." I also tired your suggestion of setting the buyprice, sellprice and trade delay in the code rather than through the GUI. I ended up getting the same results, so I'm still working the problem.
I did notice the problem only occurs when I try to enter at the open the day after I get a buy signal and exit on the close the day of a sell signal. I don't think the problem is strictly related to the exit logic since when I enter on the close the day a buy is generated AND exit on the close the day a sell signal is generated there is no problem (everything works as anticipated). Likewise, if I wait until the following open for both entries and exits - no problem. Unfortunately, neither of these approaches is exactly what I'm after.... Waiting until the open would be easier to implement and I think should result in better results. Again, thanks for your help! Greg --- In [email protected], "Mike" <[EMAIL PROTECTED]> wrote: > > Do you also have Sell Price = Open and Sell Delay = 1 in the trades > tab? Sounds like you should, since your exit logic requires the Close > in order to execute. Thus, it cannot execute until the open of the > next day at the earliest. > > Personally, I find it less error prone to do this in code such that > any changes to the settings have no impact on already tested code. > > e.g. > > BuyPrice = Open; > SellPrice = Open, > SetTradeDelays(1, 1, 1, 1); > > Also, you may want to verify that the "Allow same bar exit" is > checked and see if that makes a difference. > > Just a couple of shots in the dark :( > > Mike > > --- In [email protected], "bean_pi314" <gkjw@> wrote: > > > > I have encountered a strange exit problem while using the portfolio > > backtester and trading at the open the day after a signal. The > > strategy I am testing is a 2-5 day mean reversion system. > > > > Settings: > > In the trades tab, I set buy = Open, Delay = 1. > > Sell = C > MA(C, 5); > > > > I have noticed that I occasionally have two positions in the same > stock > > (triggered by sequential buy signals) that exit on different days > (the > > exit signal should be valid for both positions). This occurs when > the > > second position is entered the morning (i.e. at open) the day that > the > > exit signal occurs. However, when I only have a single position in > a > > stock, entry (at open) and exit (at close) occur as anticipated, > even > > when holding period is only one bar. Any thoughts or suggestions > about > > what might be wrong would be appreciated. > > > > Many thanks, > > Greg > > >
