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

[amibroker] Positionsize & How to update Capital?



PureBytes Links

Trading Reference Links

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);



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