Thanks.
--- In [email protected], Tomasz Janeczko <gro...@...> wrote:
>
> Hello,
>
> I agree and I have added this to internal to-do.
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
>
> On 2010-07-27 16:42, rise_t575 wrote:
> >
> > Hello,
> >
> > Of course I have to use PositionScore in the end - but it has been my
> > experience so far that it often is necessary (or at least extremely
> > helpful) to understand what AB is doing internally in order to make things
> > work as intended. Hence my question.
> >
> > Sorry if this has been posted in the past already - but I can only go so
> > far when searching the Yahoo group as there are no dedicated categories as
> > with conventional forum software. If one isn't lucky enough to search for
> > the exactly correct keywords, it sometimes resembles looking for the
> > proverbial needle in a haystack.
> >
> > I certainly understand that it must be frustrating to answer the same
> > questions again and again - and of course I do thank you for explaining
> > this another time - but with all due respect, such things should be put
> > somewhere where they are not too difficult to find, i. e. in AB's user
> > manual, in which I haven't found how exactly AB is processing this (i. e.
> > what happens when PositionScore is missing).
> >
> > So thanks again for your patience& explanation.
> >
> > --- In [email protected], Tomasz Janeczko<groups@> wrote:
> >> Hello,
> >>
> >> It was explained a couple of times already in the past.
> >>
> >> As written in the manual, you should use
> >> PositionScore to define desired ordering/ranking.
> >>
> >> When PositionScore is missing / not defined, AmiBroker will prefer
> >> LARGER POSITION SIZE first
> >>
> >> When position score is missing and pos sizes are equal (or missing)
> >> then it will use alphabetical order
> >>
> >> When position score is missing and pos sizes are equal and symbol is also
> >> equal (i.e. there are both long and short signals on same symbol at same
> >> time)
> >> it will prefer long entry.
> >>
> >> Best regards,
> >> Tomasz Janeczko
> >> amibroker.com
> >>
> >> On 2010-07-27 15:19, rise_t575 wrote:
> >>> Bump.
> >>>
> >>> --- In [email protected], "rise_t575"<rise_t@> wrote:
> >>>>
> >>>> Tomasz,
> >>>>
> >>>> Let me say this another way:
> >>>>
> >>>> I haven't ranked the stocks at all in both codes (yet).
> >>>>
> >>>> But still, using SetPositionSize results in entry signals in Z to A
> >>>> order, while the CBT code results in signals in A to Z order (as
> >>>> expected when using GetFirstSignal, GetNextSignal).
> >>>>
> >>>> Why do I get the signals in Z to A order with SetPositionSize?
> >>>>
> >>>> Thanks.
> >>>>
> >>>> --- In [email protected], Tomasz Janeczko<groups@> wrote:
> >>>>> Hello,
> >>>>>
> >>>>> You have mistake in your code/thinking. Ranking/sorting occurs in FIRST
> >>>>> phase of backtest.
> >>>>>
> >>>>> Assigning different scores after ranking/sorting is done (in second
> >>>>> phase / cbt) does not change the ordering,
> >>>>> that's why in case b) you have alphabetical ordering.
> >>>>>
> >>>>> If you want to change the order of trades in CBT you need to do it
> >>>>> yourself (EnterTrade/ExitTrade/ScaleTrade)
> >>>>>
> >>>>> Best regards,
> >>>>> Tomasz Janeczko
> >>>>> amibroker.com
> >>>>>
> >>>>> On 2010-07-20 23:10, rise_t575 wrote:
> >>>>>> 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<groups@> 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<groups@<mailto:groups@>>
> >>>>>>>>
> >>>>>>>> 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
> >>>>>>>> >
> >>>>>>>> >
> >>>>>>>> >
> >>>>>>>> >
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>>> ------------------------------------
> >>>>>>
> >>>>>> **** 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
> >>>>>>
> >>>>>> 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
> >>>
> >>> 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
> >
> > 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
> >
> >
> >
> >
>