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

Re: [amibroker] Problem with Positionsize and Equity



PureBytes Links

Trading Reference Links

Hi, what if you try 

Ref(Equity(),-1) for your equity

--- joachim1080 <joachim1080@xxxxxxxx> wrote:

> I have a little problem with equity function and
> positionsizing.
> Please help with the following AFL-Code which does
> not work 
> correctly:
> 
> Buy=...buyrule;
> Sell=0;
> Short=...shortrule;
> Cover = 0;
> 
> ApplyStop(stopTypeLoss, stopModePercent, 2,
> ExitAtStop = 1 ); 
> ApplyStop(stopTypeProfit, stopModePercent, 4,
> ExitAtStop = 1 ); 
> 
> SetOption( "InitialEquity" , 10000) ;
> SetOption( "AllowSameBarExit" , True ) ;
> SetOption( "AllowPositionShrinking" , True ) ;
> SetOption( "ReverseSignalForcesExit" , True ) ;
> SetOption( "FuturesMode" , True ) ;
> 
> 
> MarginDeposit = 1000;
> PointValue = 10;
> 
> e=Equity();
> PS=IIf(e>10000,2000,1000);
> PositionSize=ps;
> 
> In this code I tried to check if equity is bigger
> than InitialEquity 
> to buy one or two future-cantracts. But the result
> of this is 
> totally wrong. O.k., backtesting with this code the
> first trades 
> seem to be o.k. But at a certain point only one
> contract is bought 
> also if the equity is higher than 100000 $. Whats
> wrong with this???
> Thanks for help!
> 
> 
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a difference. Find and fund world-changing projects at GlobalGiving.
http://us.click.yahoo.com/PcNrnD/PbOLAA/cosFAA/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/