Another question regarding taking signals / the signal score:
As an exercise, I've coded two 100% identical position sizing algorithms, a) in normal AFL (SetPositionSize) and b) with mid-level CBT. After fixing all the obvious bugs in my CBT code, I've noticed that the results still differ. A couple of frustrating hours of later, going through the trades manually, I've noticed that (a = SetPositionSize) and (b = CBT code) are sometimes trading different signals. In the AA's Results list for the same bar, I'm getting the following Entry Signals for (a) and (b): (a) Entry signals(score):SANM=Buy(1), CIEN=Buy(1), AMCC=Buy(1) (b) Entry signals(score):AMCC=Buy(1), CIEN=Buy(1), SANM=Buy(1) While the signals are the same, the order is reversed. Which comes into play when the signal score is the same while there are insufficient funds. If there's only cash available for one more trade, (a) will enter a position in SANM, (b) will enter a position in AMCC, and this is where the difference in the end results for the backtests comes from. Is working SetPositionSize backwards through the signals? Thanks in advance for clarification. --- In [email protected], Tomasz Janeczko <gro...@...> wrote: > > Hello, > > You can either > a) turn ON "Allow position shrinking" - that will allow to open highest > ranked position albeit with adjusted size to fit available funds > b) use custom backtest to detect such circumstance and assign -1 to price. > > Best regards, > Tomasz Janeczko > amibroker.com > > On 2010-07-20 18:24, Tavan Taban wrote: > > > > > > Hello, > > > > Thank you Tomasz, for your clear and wise comments. > > > > By the way, I remember more about the problem I experienced earlier. A > > fictive description of the problem is as follows. > > > > Initial equity: 10000 (default) > > Position Size: 5% > > Highest ranked stock's price: 600 > > Assume 40 more signals. > > > > Result: > > Backtester rejects the highest ranked signal indicating insufficient funds > > and takes no trades. > > The problem continues as this signal continues in raw mode backtest. > > > > At that time, I passed off the subject by simply increasing the initial > > equity. > > Walking towards perfection, perhaps you may consider handling different > > "insufficient funds" differently. > > > > Best regards, > > IK > > > > > > > > > > > > > > 2010/7/20 Tomasz Janeczko <gro...@... <mailto:gro...@...>> > > > > Hello, > > > > > > > > "While I have no idea what exactly does happen when I set sig.Price to > > -1 and why this works " > > > > It works because I coded it so. The internal code uses -1 as special > > marker to skip a signal. > > > > > > Best regards, > > Tomasz Janeczko > > amibroker.com <http://amibroker.com> > > > > On 2010-07-20 17:36, rise_t575 wrote: > > > > > > > > > > > > > > > Tomasz, > > > > > > While I have no idea what exactly does happen when I set sig.Price to > > -1 and why this works, I can happily report that it *does* work - so thanks > > for > > the help! > > > > > > --- In [email protected] > > <mailto:amibroker%40yahoogroups.com>, Tomasz Janeczko<groups@> wrote: > > >> Hello, > > >> > > >> It is simple. By default AmiBroker opens positions in RANKED order > > (more preferred trades first). > > >> If at some point of going through the ranking it finds the trade > > that it can not open (for example > > >> due to insufficient funds) it will NOT open LOWER ranked trades > > because it is undesirable to have > > >> better candidates replaced by worse candidates when you run out of > > funds. > > >> When requested position size is non-zero and position size shrinking > > is ON AmiBroker will attempt > > >> to adjust pos size to lower value within user-defined constraints > > ("MinShares", Round lot size). > > >> It will go down as far as constraints allow, but if it reaches the > > barrier or zero it will reject the trade > > >> and all lower-ranked signals. > > >> Setting signal's pos size to zero in the beginning effectively means > > the same condition. > > >> > > >> You should NOT set position size to zero if you want to reject > > single trade BUT continue to handle lower-ranked signals. > > >> > > >> If you want to SKIP one signal, without affecting others, you should > > set Price property of that signal to -1 (minus one). > > >> > > >> Best regards, > > >> Tomasz Janeczko > > >> amibroker.com <http://amibroker.com> > > >> > > >> On 2010-07-20 12:42, rise_t575 wrote: > > >>> Thanks a lot - I will try your solution. > > >>> Do you have an idea *why* this is happening? > > >>> > > >>> --- In [email protected] > > <mailto:amibroker%40yahoogroups.com>, Tavan Taban<tavantaban@> wrote: > > >>>> I remember experiencing the same problem earlier. As far as I > > remember, it > > >>>> is something like, if it cancels one, cancels also the rest which > > are not > > >>>> coded to be rejected. I can dig more if it helps. > > >>>> > > >>>> Anyway, one solution alternative may be the following. > > >>>> > > >>>> for( sig = bo.GetFirstSignal( bar ); sig; sig = bo.GetNextSignal( > > bar ) ) > > >>>> { > > >>>> if (IDontLikeThisSignal) sig.Type = 7; > > >>>> } // end if exit > > >>>> > > >>>> > > >>>> 2010/7/17 rise_t575<rise_t@> > > >>>> > > >>>>> Hello, > > >>>>> > > >>>>> I've noticed using mid-level CBT that when I set the position > > size to zero > > >>>>> for the signal in question (the reason for setting it to zero is > > slightly > > >>>>> complicated& not that important here - some data needed for a > > subsequent > > >>>>> calculation is {empty}), the trade is marked as "rejected" in > > AA's results > > >>>>> list (which is perfectly ok). > > >>>>> What is not "perfectly ok" is the fact that the backtester > > rejects the > > >>>>> following signals at the same bar as well (there's enough cash > > available and > > >>>>> position size is> 0). > > >>>>> > > >>>>> How can I prevent this? > > >>>>> > > >>>>> > > >>>>> > > >>> > > >>> > > >>> ------------------------------------ > > >>> > > >>> **** IMPORTANT PLEASE READ **** > > >>> This group is for the discussion between users only. > > >>> This is *NOT* technical support channel. > > >>> > > >>> TO GET TECHNICAL SUPPORT send an e-mail directly to > > >>> SUPPORT {at} amibroker.com <http://amibroker.com> > > >>> > > >>> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at > > >>> http://www.amibroker.com/feedback/ > > >>> (submissions sent via other channels won't be considered) > > >>> > > >>> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > > >>> http://www.amibroker.com/devlog/ > > >>> > > >>> Yahoo! Groups Links > > >>> > > >>> > > >>> > > >>> > > > > > > > > > > > > ------------------------------------ > > > > > > **** IMPORTANT PLEASE READ **** > > > This group is for the discussion between users only. > > > This is *NOT* technical support channel. > > > > > > TO GET TECHNICAL SUPPORT send an e-mail directly to > > > SUPPORT {at} amibroker.com <http://amibroker.com> > > > > > > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at > > > http://www.amibroker.com/feedback/ > > > (submissions sent via other channels won't be considered) > > > > > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > > > http://www.amibroker.com/devlog/ > > > > > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > > > > > > >
