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

[amibroker] Re: Position Sizing



PureBytes Links

Trading Reference Links

Thanks for your help Graham!

Putting it all together:

//-------------------------------------------
//Position Sizing

MinTrade = equity() * 0.07;
MaxTrade = equity() * 0.10;
riskPS   = (Risk / TrailStopAmount) * BuyPrice;

Positionsize = Min(MaxTrade, riskPS);

Buy = BuyConditions and Positionsize > 0.07 * ref(Equity(),-1);
//-------------------------------------------

I think I wouldn't need the other bit of the Buy as you wrote because
it is taken care of in the Positionsize. What do you think?

One other thing, I guess I need also to put ref(,-1) on the MinTrade
and MaxTrade to get the correct equity value?

Thanks again. 
Regards, Rangar

--- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> wrote:
> sorry just read the post again
> to not take a trade you need to put the conditioninto your buy
statement
> 
> assuming you already calculated the positionsize
> Buy = buyconditions and positionsize>0.07*ref(Equity(),-1) and
> positionsize<0.1*ref(Equity(),-1);
> I use ref(equity(),-1) because on the bar the buy occurs the equity
> will be smaller by the amount of the buy
> 
> On 8/8/05, Graham <kavemanperth@xxxx> wrote:
> > to put some numbers against things
> > PositionSize = Min( Max( equity()*0.07,
> > (Risk/TrailStopAmount)*BuyPrice ), equity()*01 );
> > 
> > equity = 100
> > E*0.07 = 7
> > E*0.1 = 10
> > 
> > say your risk pos sizing is 9
> > Min( Max( 7, 9 ), 10 ); = min( 9, 10 ) = 9
> > now say 6
> > Min( Max( 7, 6 ), 10 ); = min( 7, 10 ) = 7
> > now say 12
> > Min( Max( 7, 12 ), 10 ); = min( 12, 10 ) = 10
> > 
> > does this make it clearer?
> > 
> > 
> > On 8/8/05, rangaroopa2000 <rangaroopa2000@xxxx> wrote:
> > > Thanks for your help Graham,
> > >
> > > Just been trying to get my head around the min and max and what
they
> > > are doing. I didn't know you could use Equity() in there either,
thanks.
> > >
> > > I've re-written the rules below so they are a bit clearer. The
reason
> > > is because I don't think the code would exclude the trade if the
risk
> > > based PS is below 7% of capital.
> > >
> > > a) if the risk based PS is > 10% then use a trade size of 10%.
> > > b) if the risk based PS is < 10% and > 7% then use risk based PS
> > > c) if the risk based PS is < 7% then do not take the trade.
> > >
> > > So if:
> > >
> > > MinTrade = equity() * 0.07;
> > > MaxTrade = equity() * 0.10;
> > > riskPS   = (Risk / TrailStopAmount) * BuyPrice;
> > >
> > > then:
> > >
> > > a = min( MaxTrade, riskPS)
> > > b = iif( riskPS < MaxTrade AND riskPS > MinTrade, riskPS)
> > > c = ???
> > >
> > > Regards, Rangar
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx>
wrote:
> > > > try this, it may even work
> > > > PositionSize = Min( Max( equity()*0.07,
> > > > (Risk/TrailStopAmount)*BuyPrice ), equity()*01 );
> > > >
> > > > Using the above, I would also like to have a maximum trade
size of 10%
> > > > of capital AND a minimum trade size of 7% of capital.
> > > >
> > > > On 8/8/05, rangaroopa2000 <rangaroopa2000@xxxx> wrote:
> > > > > Hi,
> > > > >
> > > > > Could someone help me out with position sizing please?
> > > > >
> > > > > I'm using ATR-based position sizing:
> > > > >
> > > > > Risk = 0.01*Capital;
> > > > > PositionSize = (Risk/TrailStopAmount)*BuyPrice;
> > > > >
> > > > > Using the above, I would also like to have a maximum trade
size of 10%
> > > > > of capital AND a minimum trade size of 7% of capital.
> > > > >
> > > > > For example:
> > > > >
> > > > > a) if the risk based PS is > 10% then use a trade size of
10%.
> > > > > b) if the risk based PS is < 7% then exclude the trade.
> > > > >
> > > > > Thanks, Rangar




------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hna1e39/M=362131.6882500.7825259.1493532/D=groups/S=1705632198:TM/Y=YAHOO/EXP=1123508979/A=2889190/R=0/SIG=10r90krvo/*http://www.thebeehive.org
">Put more honey in your pocket. (money matters made easy) Welcome to the Sweet Life - brought to you by One Economy</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/