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

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


  • To: <amibroker@xxxxxxxxxxxxxxx>
  • Subject: Re: [amibroker] Another try (was: PositionSize for equal investments (ref. Msg 78740; Ed/Herman)
  • From: "Tomasz Janeczko" <amibroker@xxxxxx>
  • Date: Tue, 2 Aug 2005 17:56:44 +0200

PureBytes Links

Trading Reference Links

Hello,

Yes something along these lines.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "vlanschot" <ecbu@xxxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, August 02, 2005 5:50 PM
Subject: [amibroker] Another try (was: PositionSize for equal investments (ref. Msg 78740; Ed/Herman)


> Would it be something like:
>
> #include <TJ's functions of message nr. 2275)// Your AddScaleIn, etc.
>
> .... (see Ed's code, message 78740)
>
>
> for (openpos = bo.GetFirstOpenPos(); ...)
>
> //Add Required rel weight
>
> if (openpos.IsOpen AND..)
> {
> cntLonOpen = cntLongOpen + 1;
> CurrRelWeight = openpos.GetPositionValue/bo.Equity;
> ... same for shorts
>
> ReqRelW = 5;
>
> for (sig = boGetFirstSignal(i); ...etc.)
> {
> if (sig.IsEntry() AND sig.IsLong())
> {
> if (cntLongOpen >= maxLong) sig.PosSize=0;
> else
> {
> if (CurRelWeight>ReqRelW0) AddScaleOut(i,3,CurRelWeight/MaxRelW,C);
> else if (CurRelWeight<MReqRelW0) AddScaleIn
> (i,3,CurRelWeight/MaxRelW,C);
> }
>
> cntLongOpen=cntLongOpen +1;
> }
>
> ... same for shorts
>
> Am I on the right track here?
>
> 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
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>
>
>
>
>
> 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=12hlkccfr/M=362343.6886682.7839641.1493532/D=groups/S=1705632198:TM/Y=YAHOO/EXP=1123005413/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/