Are you trying to size the trades based on current backtest Equity, instead of starting equity, with 2% risk and the stoploss?

positionsize = -2 * buyprice/IPS;

or if based on 7000 starting capital only

positionsize = 0.02 * Capital * buyprice/IPS;

--
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://www.aflwriting.com


On 02/11/06, wadebullock <[EMAIL PROTECTED]> wrote:
Hi there!
I'm trying to develop a daytrading system(daily bars only) that buys
on the open and sells on the close and also uses a modified variation
of Tharps ATR position sizing technique..

So far I've been unable to figure out what I need to do
in order for the backtester to update my "Capital" after a trade. As
is, each trade, as the code would indicate only, uses only the $7000.

I've spent a lot of time trying to figure out what I need to do and
have tried a lot of differnt things but can't seem to get it (not
much of a coder here). I'm guessing I need to use a loop of some
sort??? Any push in the right direction would be greatly
appreaciated.

Wade


Filter = ...

Cond1 = Open < (Ref (Close, -2) - X);
BuyStop = Open;
Buy = Cond1 AND Ref( Filter, -1) AND High > BuyStop;
BuyPrice = Max(BuyStop, Open);

SellStop = Open - (ATR (10) * 0.3);
Sell = Low < SellStop OR Close;
SellPrice = Max( SellStop, Close );

SetOption("MaxOpenPositions", 1 );
SetOption("InitialEquity", 7000 );
SetOption("AllowPositionShrinking", False );

IPS = ATR (10) * 0.3; //initial protective stop
Capital = 7000;
BuyingPower = Capital * 2;
Risk = 0.02 * Capital;
PositionSize = Min ((Risk/IPS)*BuyPrice, (BuyingPower/BuyStop)
*BuyPrice);




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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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/

<*> 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:[EMAIL PROTECTED]
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/





__._,_.___

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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Investment property software Investment software
Investment tracking software Return on investment software

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

__,_._,___

Reply via email to