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

[amibroker] Re: Calculating Position Size Based on a % of Current Equity



PureBytes Links

Trading Reference Links

Hi again,

Does anyone know how it's done then ??

Is there any documentation anywhere ??

Thanks,

Geoff

--- In amibroker@xxxxxxxxxxxxxxx, "Paul Ho" <paultsho@xxx> wrote:
>
> the example was to illustrate how expectancy is to be calculated 
when risk
> is set to 0.01 of equity. it doesnt say how 0.01 is to be achieved, 
whether
> it is via position sizing or stoploss or both.
>  
> 
>   _____  
> 
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] 
On Behalf
> Of Geoff Mulhall
> Sent: Monday, 13 March 2006 3:34 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Calculating Position Size Based on a % of 
Current
> Equity
> 
> 
> Hi,
> 
> In the example provided by Tomasz below I do't see how the risk 
> relates to the position size.
> 
> When I enter a trade my position size in number of shares is 
> calculated as  $ to Risk /(entry price - stop price) 
> and I want my $ to risk on the trade to be a % of my currect equity.
> 
> I was expecting to see the SetPositionSize used in the example 
below 
> but it does not appear - so I'm wondering how the Risk value in the 
> example below is used to set the position size in the trade.
> 
> Any help appreciated.
> 
> Geoff 
> 
> Example follows ->
> 
> SetCustomBacktestProc(""); 
> MaxLossPointStop = 2*ATR(10); // dynamic volatility stoploss, 1st 
> modification 
> 
> function FindEquityAtDateTime( eq, dt, Value ) 
> { 
>    found = -1; 
>    for( i = 0; i < BarCount AND found == -1; i++ ) 
>    { 
>       if( dt[ i ] == Value ) found = i; 
>    } 
>    return IIf( found != -1, eq[ found  - 1 ], Null ); 
> } 
> if( Status("action") == actionPortfolio ) 
> { 
>     bo = GetBacktesterObject(); 
>     bo.Backtest(1); // run default backtest procedure 
>     SumProfitPerRisk = 0; 
>     NumTrades = 0; 
>     dt = DateTime(); 
>     eq = Foreign("~~~EQUITY", "C" ); 
> 
>    for( trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade
> () ) 
>    { 
>       EquityAtEntry = FindEquityAtDateTime( eq, dt, 
> trade.EntryDateTime ); 
> 
>       Risk = 0.01 * EquityAtEntry ; //risk is defined as a constant 
> 1% of current equity. 
> 
>       RiskAsPecentOfCurrentEquity = 100 * Risk / EquityAtEntry; 
>       RMultiple = trade.GetProfit()/Risk; 
>       trade.AddCustomMetric("Initial risk $", Risk  );         
>       trade.AddCustomMetric("Equity at entry", EquityAtEntry ); 
>       trade.AddCustomMetric("Risk as % of Eq.", 
> RiskAsPecentOfCurrentEquity ); 
> 
>       trade.AddCustomMetric("R-Multiple", RMultiple  ); 
>       SumProfitPerRisk = SumProfitPerRisk + RMultiple; 
>       NumTrades++; 
>    } 
>     Expectancy3 = SumProfitPerRisk / NumTrades; 
>     bo.AddCustomMetric( "Expectancy (per risk)", Expectancy3 ); 
>     bo.ListTrades(); 
> } 
> // your trading system here 
> 
> ApplyStop( stopTypeLoss, stopModePoint, MaxLossPointStop ); 
> 
> 
> 
> 
> 
> 
> 
> 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
> 
> 
> 
> 
> 
> 
> SPONSORED LINKS 
> Investment
> <http://groups.yahoo.com/gads?
t=ms&k=Investment+management+software&w1=Inves
> 
tment+management+software&w2=Real+estate+investment+software&w3=Invest
ment+p
> 
roperty+software&w4=Software+support&w5=Real+estate+investment+analysi
s+soft
> ware&w6=Investment+software&c=6&s=200&.sig=_XXUzbE9l5lGlZNcMu4KNQ>
> management software 	Real
> <http://groups.yahoo.com/gads?
t=ms&k=Real+estate+investment+software&w1=Inve
> 
stment+management+software&w2=Real+estate+investment+software&w3=Inves
tment+
> 
property+software&w4=Software+support&w5=Real+estate+investment+analys
is+sof
> tware&w6=Investment+software&c=6&s=200&.sig=5_sgDczz3ArKGMtJ9tFSJA> 
estate
> investment software 	Investment
> <http://groups.yahoo.com/gads?
t=ms&k=Investment+property+software&w1=Investm
> 
ent+management+software&w2=Real+estate+investment+software&w3=Investme
nt+pro
> 
perty+software&w4=Software+support&w5=Real+estate+investment+analysis+
softwa
> re&w6=Investment+software&c=6&s=200&.sig=_N6zcwefgp4eg5n6oX5WZw> 
property
> software 	
> Software
> <http://groups.yahoo.com/gads?
t=ms&k=Software+support&w1=Investment+manageme
> 
nt+software&w2=Real+estate+investment+software&w3=Investment+property+
softwa
> 
re&w4=Software+support&w5=Real+estate+investment+analysis+software&w6=
Invest
> ment+software&c=6&s=200&.sig=MJ2jP31F3n64RDZkDadU8w> support 	Real
> <http://groups.yahoo.com/gads?
t=ms&k=Real+estate+investment+analysis+softwar
> 
e&w1=Investment+management+software&w2=Real+estate+investment+software
&w3=In
> 
vestment+property+software&w4=Software+support&w5=Real+estate+investme
nt+ana
> 
lysis+software&w6=Investment+software&c=6&s=200&.sig=GmF8PlAJASx0wrSaX
5-Zlw>
> estate investment analysis software 	Investment
> <http://groups.yahoo.com/gads?
t=ms&k=Investment+software&w1=Investment+manag
> 
ement+software&w2=Real+estate+investment+software&w3=Investment+proper
ty+sof
> 
tware&w4=Software+support&w5=Real+estate+investment+analysis+software&
w6=Inv
> estment+software&c=6&s=200&.sig=aMgGsKT4w29dMAYUzQUKzg> software 
	
> 
>   _____  
> 
> YAHOO! GROUPS LINKS 
> 
> 
> 	
> *	 Visit your group "amibroker
> <http://groups.yahoo.com/group/amibroker> " on the web.
>   
> 
> *	 To unsubscribe from this group, send an email to:
>  amibroker-unsubscribe@xxxxxxxxxxxxxxx
> <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe> 
>   
> 
> *	 Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service
> <http://docs.yahoo.com/info/terms/> . 
> 
> 
>   _____
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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/