PureBytes Links
Trading Reference Links
|
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 <wadebullock@xxxxxxxxx> 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
>
>
>
>
>
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.13.27/517 - Release Date: 11/3/2006
|