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

[amibroker] Re: PositionSize for equal investments (ref. Msg 78740; Ed/Herman)



PureBytes Links

Trading Reference Links

Thanks Tomasz,

If it is not too much to ask, could you perhaps provide some code on 
how to achieve this, i.e. how to rebalance at each bar in order to 
maintain an equal amount of, say 5%, for the MaxLong = 10, and 
MaxShort = 10 positions?

Can I use, for example, using Ed's code

1) RelW = openpos.GetPositionvalue/bo.Equity; MaxW = 5;

2)the AddScaleIn/-Out functions of your message 2275 (AB-beta group), 
and insert these in Ed's code below the part of . . . 

for (sig = boGetFirstSignal(i); . . . )
. . . 
if (RelW>MaxW) AddScaleOut(i,3,(RelW/MaxW-1),C)
. . . .

Would this work??

Thanks,

Patrick

--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx> 
wrote:
> Hello,
> 
> >Correct me if I'm wrong,
> 
> Yes you are wrong.
> 
> Portfolio backtester interface allows
> to retrieve information after backtest but also allows to construct
> more sophisticated backtest as well.
> And I have shown in the past how such things should be done.
> Example: low-level backtest implementing multiple positions on the 
same stock
> without averaging:
> http://finance.groups.yahoo.com/group/amibroker/message/80939
> 
> And yes it is possible to re-balance portfolio using custom 
backtester interface
> (low level)
> (you can check size of each open position and scale in/out 
accordingly)
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "emp62" <emp62@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Tuesday, August 02, 2005 1:44 PM
> Subject: Re: [amibroker] PositionSize for equal investments (ref. 
Msg 78740; Ed/Herman)
> 
> 
> > hi,
> >
> > I won't be of much help with this. In my opinion the Portfolio 
Backtester
> > Interface is a nice feature of Amibroker but it is primarily 
useful to
> > retrieve information from a backtest already done. Maybe my 
understanding is
> > insufficient but it seems to me that this interface is not useful 
to create
> > a more sophisticated portfolio backtester. Since that would be too
> > complicated because you need to run your original "simple" 
portfolio
> > backtest and then adjust it to become a more sophisticated 
portfolio
> > backtest. This approach is just too complicated in my opinion.
> >
> > I also would like to test a more complicated setups (like my 
redundant
> > signal problem I mentioned several times) but I think Amibroker 
needs to
> > have a separate Portfolio Backtester to be able to do this. This 
should be a
> > low level backtester like the current interface where one can for 
instance
> > feed it all the raw signals. Or where you can tell the backtester 
which buy
> > signal belongs to which sell signal.
> >
> > Same with your problem. In my opinion the only way to do it is to 
adjust the
> > outcome of your basic system. For each bar you need to look at 
the positions
> > your system takes. Then if you for instance have 7 Long positions 
and 3
> > Short Positions you need to remove 2 of the long positions and 
add 2 short
> > positions. This you could do with the Interface. It just seems to 
me this is
> > a rather complicated way to build a system. Correct me if I'm 
wrong,
> >
> > rgds, Ed
> >
> >
> >
> >
> > ----- Original Message ----- 
> > From: "vlanschot" <ecbu@xxxx>
> > To: <amibroker@xxxxxxxxxxxxxxx>
> > Sent: Tuesday, August 02, 2005 10:32 AM
> > Subject: [amibroker] PositionSize for equal investments (ref. Msg 
78740;
> > Ed/Herman)
> >
> >
> >> Morning,
> >>
> >> In message 78740 Ed and Herman "completed" their discussion on 
ways
> >> to limit the long-short positions via the low-level backtest
> >> functionality. A related message was 78732. (Feb/March 2005)
> >>
> >> I was wondering whether Herman's original question was ever 
answered:
> >> How can you maintain an equal investment in Longs/Shorts via the
> >> PositionScore/PositionSize.
> >>
> >> It seems to me that the way to do this is to use ScaleIn/-Out
> >> triggered at the signal-level in low-level backtester, but 
perhaps
> >> this can also be achieved via EnableRotationalTrading.
> >>
> >> In any case, I have been unable to program a fairly standard rule
> >> like:
> >>
> >> "Every month, buy the top 10% of stocks of WatchList1 and short 
the
> >> bottom 10%. Use equal/marketcap/x weights. Rebalance every 
month, not
> >> only the constituents of the top/bottom 10% BUT ALSO the actual
> >> weights."
> >>
> >> This means that even if a stock remains in the top 10%, I may 
have to
> >> sell part of the position because its weight has exceeded my 
limit.
> >> That limit, by the way, could be determined by an external time
> >> series, like relative mcap versus a benchmark.
> >>
> >> Any help appreciated (Ed/Herman?),
> >>
> >> Thanks,
> >>
> >> Patrick
> >>
> >>
> >>
> >>
> >>
> >> 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 other support material please check also:
> >> http://www.amibroker.com/support.html
> >>
> >>
> >> Yahoo! Groups Links
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
> >
> > 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 other support material please check also:
> > http://www.amibroker.com/support.html
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >




------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12h97le4b/M=362343.6886682.7839641.1493532/D=groups/S=1705632198:TM/Y=YAHOO/EXP=1122997977/A=2894352/R=0/SIG=11fdoufgv/*http://www.globalgiving.com/cb/cidi/tsun.html";>Help tsunami villages rebuild at GlobalGiving. The real work starts now</a>.</font>
--------------------------------------------------------------------~-> 

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 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/

<*> 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/