[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Question about using SetPositionSize (and Equity)



PureBytes Links

Trading Reference Links

Joe,

The role of percentages is that you never need to know the trade size 
in terms of shares. If your rule is "not more than 10 positions, each 
at 10% of equity", then what do you care what the equity is? The 
trade size is 10%, period. Number of shares has no meaning in this 
context. The rule will fire, AmiBroker will do the math, the 
backtest results will confirm or refute the confidence of the rule.

Because AFL calculates all bars at the same time (i.e. array 
operations), our scripts might be described as a rubber stamp. There 
is no earlier state information from which to self reference. First 
there is blank paper, then there is a completed image, there are no 
intermediary steps (except by the backtester). In other words, 
AmiBroker cannot expose equity because equity does not exist at the 
time of exercising (stamping) your logic.

This is contrary to an iterative looping approach (i.e. bar by bar)  
which might more closely be described as a "connect the dots" image, 
from which self referencing measurements could be made on the way to 
each new dot.

Before commiting to AmiBroker, I evaluated many competitors. Most 
were disqualified due to lack of portfolio support (e.g. AmiBroker's 
watchlists) or lack of support for foreign symbol reference (e.g. 
AmiBroker's Foreign() function).

Of those that remained, many were the bar by bar iterative model. Of 
these:

- All of them brought the machine to its knees in terms of memory 
demands.
- None of them, even after leaving run overnight, were able to 
complete a simple exploration that took AmiBroker 12 minutes to 
complete.
- Most of them simply crashed due to out of memory errors.
- The rest just hung in a state of seemingly infiniate hardware 
thrashing.

Even after contacting customer support, communicating directly with 
the code authors (as a professional software developer myself), and 
posting in the forums, the bar by bar model simply could not scale to 
handle larger portfolios (thousands of symbols in my case).

So, why not expose portfolio equity? Because it doesn't scale! The 
time to do the calculations is unworkable and the machine resource 
demands can be enormous depending on the underlying architecture of 
the program.

By using array manipulations, yet still granting access to bar by bar 
results of those manipulations after the fact, AmiBroker has provided 
you everything. So, yes, you can have everything ;) And I agree, AB 
is the most incredible of its kind.

As a last comment;

The equity curve of a single stock cares only about the rules as 
applied to that one stock, with no concern for signal mitigation.

The equity curve of a portfolio, formed of signals coming from an 
8000 symbol watchlist, must apply the formula accross all 8000 
symbols, bar by bar, while ranking and sorting along the way to 
resolve signal prioritization. This in addition to obeying any other 
symbol by symbol constraints in place.

Portfolio equity is orders of magnitude more complicated than single
symbol equity. That is why so many vendors simply do not support 
portfolio functionality.

P.S. The other thing about the bar by bar model is that virtually 
every script must be thought of in terms of a loop. Based on the 
confessions of some of posters on this forum, that would be a 
hardship for a segment of the AB user base.

Mike

--- In amibroker@xxxxxxxxxxxxxxx, "Joe" <j0etr4der@xxx> wrote:
>
> Thanks, Mike.  It's what I suspected, but wanted confirmation.
> 
> -----------------------------------------------------------
> This is one of those situations in AB that just leaves me scratching
> my head.  Why provide spsPercentOfEquity if you cannot determine the
> trade size without resorting to custom back test code?  Or note in 
the
> documentation that it cannot and give an example on how to use it 
with
> custom back test code?
> 
> But more generally, why not expose portfolio equity so it can be 
used
> for optimization and exploration without writing custom back tester
> code?  The majority of users are never going to learn object 
oriented
> programming.  How does portfolio equity differ from single security
> equity such that portfolio equity cannot be accessed?
> 
> Oh, well, you can't have everything.  Certainly cannot understand
> everything.  AB is still the most incredible product of its kind.
> 
> All the best,
> 
> Joe
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@> wrote:
> >
> > You can't. You must write a custom backtest loop and apply the 
value,
> > as a percentage and corrected for sign, against the bar by bar 
equity
> > property of the backtester object.
> > 
> > http://www.amibroker.com/guide/a_custombacktest.html
> > 
> > Mike
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "Joe" <j0etr4der@> wrote:
> > >
> > > Hello,
> > > 
> > > When using SetPositionSize like this:
> > > 
> > > SetPositionSize ( 20, spsPercentOfEquity );
> > > 
> > > how do you determine what the position size is in the formula 
since
> > > real-time portfolio equity is not accessible?
> > > 
> > > 
> > > PosSize = PositionSize;
> > > 
> > > returns -20 in this case.
> > > 
> > > 
> > > Thanks,
> > > 
> > > Joe
> > >
> >
>



------------------------------------

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL 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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/