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

Re: [amibroker] Using Equity to Compute Position Size



PureBytes Links

Trading Reference Links

Using Equity() or foreign(~~~EQUITY...) to change trade size during a
backtest is useless and should never be done in portfolio backtest
Equity() is only the value for single symbol over the entire history
and not feasible in a portfolio backtest simple because it is not the
equity size for a portfolio backtest, and it assumes every trade entry
signal is taken.
~~~EQUITY is composite symbol produced after a backtest has been
completed. The moment a positionsize is changed using this symbol then
the ~~~EQUITY symbol values are wrong because the equity will change
due to the altered trade results for the change trade sizes.

You can only alter the positionsize based on backtest results, ie
equity size, by using the Custom Backtest code.
There are examples of this in the various web sites devoted to code help.

Go to the help manual and read up a bit more on Portfolio Backtesting
and in particular the Portfolio Backtester Interface Reference Guide.

-- 
Cheers
Graham Kav
AFL Writing Service
http://www.aflwriting.com




2009/5/29 Corey Saxe <cesaxe@xxxxxxx>:
>
>
> Hi Keith,
>
> Yeah, I saw that too and will try it out in some code, but my main
> malfunction is
> finding a reliable Equity for determining the position size. when the EQUITY
> is used
> prior to the PositionSize, It becomes bizzare. After it is OK. Problem is, I
> need to access it before,
> or at least within the PositionSize line for the calculation.
> Like here:
>
> MinContracts=2;//Optimize("Min Contracts",1,1,5,1);
> MaxContracts=10;//Optimize("Max Contracts",20,5,25,1);
> Margin=MarginDeposit;
> PctEq=PctEq/100;
> PositionSize = Min( MaxContracts * Margin , Max( PctEq * Equity() ,
> MinContracts * Margin ));
> The old positionsize statement works fine, but I'll probably convert to the
> new one.
> Who knows, maybe some internal register for the Equity will work better with
> the new SetPositionSize.
>
> After trying all the variations of Equity I could think of to work, I
> figured that I'll have to code
> my own routine to keep track of the Equity for use in the PositionSize
> determination.
>
> Thanks,
> -CS
>
>
>
> ----- Original Message -----
> From: Keith McCombs
> To: amibroker@xxxxxxxxxxxxxxx
> Sent: Thursday, May 28, 2009 10:15 AM
> Subject: Re: [amibroker] Using Equity to Compute Position Size
>
> After reading Ed's post below, I searched the User's Guide for
> positionsize.  There is a function SetPositionSize(array, method) which
> returns an array.  I've never used the function, and don't really understand
> how it works.  However, perhaps you can somehow use it.  Maybe you can even
> modify the input array on the fly to achieve your desired result.
>
> Perhaps you can write a loop which calculates mypositionsize and myequity
> arrays.  Then, after the loop, use SetPositionSize(mypositionsize,
> spsShares).
>
> If above works, I don't think that CBT would be necessary.
>
> Just a thought, no guarantees.
> -- Keith
>
> .
>
>
> 


------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/