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

Re: [amibroker] Re: Position size based on equity



PureBytes Links

Trading Reference Links

Hello,

Quick answer to:
>> How do I set my position size (positionsize) based on current 
>> portfoliio equity ?
is: USE negative position size to refer to percentage of current equity.


As to:
> On any bar, isn't Equity() equal to the current portfolio equity ?  

Of course it is not current portfolio equity.

Equity() gives single-security equity value and it was there
BEFORE portfolio-level backtester was implemented and works exactly
as it was working in pre-4.50 versions (backward compatibility)

Portfolio-level equity is stored in ~~~EQUITY artificial ticker
in "Close" price field.

PortfolioEquity = Foreign("~~~EQUITY", "C"); 

To perform portfolio-level backtest AmiBroker first
scans all symbols for signals (when your formula is executed
for each symbol) (stage 1 )and after that it performs portfolio-level
backtest which produces ~~~EQUITY (i.e. portfolio level equity) (stage 2).
So portfolio-level equity is available AFTER backtest.

Currently there is only one way to use "current portfolio equity"
to do position sizing from your formula, i.e. using negative position size
that refer to PERCENTAGE of current portfolio 
equity.

PositionSize = -25; // use 25% of CURRENT PORTFOLIO EQUITY

This is possible because of the fact that AmiBroker interprets
negative position sizes at stage 2 of the backtest when it knows
what portfolio equity is.

Future versions of AmiBroker will provide control over stage 2
but right now I do not provide any further details.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "hmab1" <hbahlool@xxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Thursday, January 13, 2005 9:40 PM
Subject: [amibroker] Re: Position size based on equity


> 
> 
> 
> On any bar, isn't Equity() equal to the current portfolio equity ?  
> If not, then that would explain everything.
> 
> Otherwise, after another day of trying to figure this out, I'm still 
> stumped !
> 
> HB
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "hmab1" <hbahlool@xxxx> wrote:
>> 
>> Hello,
>> 
>> How do I set my position size (positionsize) based on current 
>> portfoliio equity ?
>> 
>> I've tried the following but it doesn't seem to work. 
>> 
>> PositionSize = IIf(Equity()< x, possize1 ,possize2)
>> 
>> For some reason, it keeps using possize1 even after portfolio 
> equity 
>> goes above x.
>> 
>> Thanks
>> HB
> 
> 
> 
> 
> 
> 
> Check AmiBroker web page at:
> http://www.amibroker.com/
> 
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 
>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/