[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



Hi Corey,
 
you can use equity but indeed you need one level deeper inside the backtest code. What I do not understand is why MaxPositions does not seem to work on a higher level backtest. Will ask Marcin later.
 
I will maybe try to code using Equity in the custom backtester later.
 
But on a higher level in the backtester you need to use PositionSize for reasons Graham gave.
 
I use Equity on this higher level though. For instance I have written code that takes a profit per day at e.g. 500$, or per trade at e.g. 150$. What I do is that I let the code first calculate the equity without these restrictions and then feed the resulting equity into a procedure that takes the profits. So basicly within 1 AFL code the equity curve is calculated twice.
 
But I do not see you can use that for your question.
 
And yes if you use:
 
PositionSize = -10;
SetOption("MaxOpenPositions", 3);
RoundLotSize = 1;
MarginDeposit = 5000;
TickSize = 0.25;
PointValue = 50;
 
the equity curve should not be able to explode because the MaxOpenPositions is set to 3. But I also see it explode because it takes more than 3 positions as the equity increases. This seems to be wrong. I will ask marcin or TJ.
 
regards, Ed
 
 
 
 
----- Original Message -----
From: Corey Saxe
Sent: Thursday, May 28, 2009 11:13 AM
Subject: Re: [amibroker] Using Equity to Compute Position Size

Hi Ed,
 
That is the problem.
 
You can use almost any metric to adjust positionsize, and it works.
The problem occurs if you want to use equity in some form to calculate the positionsize.
 
I have used a more complicated form of the code below in Excel with considerable success:
 
MinContracts=1;//Optimize("Min Contracts",1,1,5,1);
MaxContracts=10;//Optimize("Max Contracts",20,5,25,1);

Margin=MarginDeposit
;
PctEq=PctEq/100
;
eq=Equity(
);

PS=Min( MaxContracts * Margin , Max
( PctEq * Eq , MinContracts * Margin ));
PositionSize
= PS;
But in AB, for a while, while it trades just one contract, it works just fine, then for some reason the equity blows up to the millions very quickly
and has nothing to do with reality. (Gee, it would be nice if blowing up to the millions was reality.)
 
-CS
 
----- Original Message -----
Sent: Thursday, May 28, 2009 1:04 AM
Subject: Re: [amibroker] Using Equity to Compute Position Size

Corey,
 
I believe your question is answered here:
 
 
under the paragraph "Margin deposit"
 
Just tested myself:
 
PositionSize = -10;
SetOption("MaxOpenPositions", 3);
 
setting inside Amibroker (Information Window) the Margin Deposit at 5000, Roundlotsize at 1 and initial equity at 100000. What I find is that it indeed increases the number of positions once enough equity is available, however it does not stick to the maximum open positions for some reason. Not sure why,
 
Ed
 
.



__._,_.___


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





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___