Yes, that should also work in this case. One thing to consider though, no matter how you remove redundant buy signals, is that removing them can affect the results of a portfolio backtest. They may not be redundant at all, as the "first" buy signal may not be taken during the backtest due to lack of available funds, but if the "redundant" ones were still there, there may be sufficient funds at that time to enter on one of them. Consequently, a trade may be taken when the supposedly redundant signals are still present, while it wouldn't be if they had been removed.
I think to allow for this, the CBT would be needed to implement the stop as it would not be possible to know beforehand, looking at the one stock alone, whether any buy signal would ultimately be taken in the portfolio backtester. GP --- In [email protected], Grant Noble <[EMAIL PROTECTED]> wrote: > > ExRemSpan(Buy, #holdbars) for Buy signals with ExRem(Sell, Buy) for Sell signals might get around > the Catch-22. > GRANT > > gp_sydney wrote: > > Due to the way array maths works, you can't normally use operations of > > the form: > > > > <exitCondition> = BarsSince(<entryCondition>); > > > > This is because the entry array will likely have more signals than > > will ultimately be used once the exit array is defined (ie. there will > > likely be entry signals ignored because there's already a trade in > > progress), and BarsSince() will always be from the most-recent entry > > signal, even if it's one that's ultimately ignored. The first thought > > is usually to remove the excess entries with ExRem(), but you can't do > > that until after the exit array has been defined, so you have a > > Catch-22 situation. > > > > For iterative operations like this, you need to use a loop and work > > through the arrays bar by bar, so that you can both create the exit > > array and remove excess entry signals at the same time. > > > > So you don't need to use the CBT, just a loop. > > > > GP > > > > > > --- In [email protected], "trustdnb" <trustdnb@> wrote: > >> Is there a way to exit unprofitable trades after a certain number of > >> bars without using the CBT? Essentially what I want is an Nbar stop > >> that only triggers on unprofitable trades, without stopping winners. > >> > >> My weak attempt did not work: > >> > >> Short = /*short fomula */; > >> ShortExit = BarsSince(Short) > 12 AND C >= ValueWhen(Short, C); > >> Cover = ShortExit; > >> > > > > > > > > ------------------------------------ > > > > Please note that this group is for discussion between users only. > > > > To get support from AmiBroker please send an e-mail directly to > > SUPPORT {at} amibroker.com > > > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > > http://www.amibroker.com/devlog/ > > > > For other support material please check also: > > http://www.amibroker.com/support.html > > Yahoo! Groups Links > > > > > > > > > > No virus found in this incoming message. > > Checked by AVG - http://www.avg.com > > Version: 8.0.138 / Virus Database: 270.6.6/1621 - Release Date: 8/19/2008 6:53 PM > > > > > > >
