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

[amibroker] Risk compounding with gains - problem



PureBytes Links

Trading Reference Links

Hi All,

 

Can anybody help me with this? I am trying to achieve a position sizing technique where half the current total profit (assuming there is a profit) is re-invested into risk. Problem is that it seems like equity(0) is always returning 250000 and the CurrentPL variable seems to always be 0.

 

StartCapital  = 250000;

CapitalNow    = equity(0);                            

CurrentPL     = ((CapitalNow-StartCapital)/StartCapital);

 

RiskPerTrade  = 0.001+(CurrentPL/2);           

PositionSize = ((CapitalNow*RiskPerTrade) / stopPoints) * BuyPrice;                    

 

What I am expecting this to do is: let us say at one point the equity goes up 2% from 250,000 to 255,000 – then:

 

Current PL         = 255000-250000/250000 = 0.02

RiskPerTrade     = 0.001+(0.02/2) = 0.011

Risk per trade now should go up from 0.001 to 0.011, but this isn’t happening.

 

I am aware I need to arrange this to handle losses, but I first would like to sort out this issue.

 

Should I in fact be using equity(0) to achieve this or should I be using some other function?

 

Thanks in advance for any help J

 

Claude

 

 



Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Yahoo! Groups Sponsor
ADVERTISEMENT


Yahoo! Groups Links