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

[amibroker] MM formula problem



PureBytes Links

Trading Reference Links



Hello everyone

Since I am a newbie to Amibroker, I still face problems with encoding my idea in AFL. Therefore I would like to ask for your help with the following issue. I want to compose a formula for so calles Fixed Ratio Position Sizing developed by Ryan Jones in "The trading game" 1999, which you can look up here: http://www.stator-afm.com/fixed-ratio-position-sizing.html. The general rule assume that we start with one contract/lot/microlot/etc and increase (or afterwards decrease) the position size according to Delta, which is used to estimate total net profit threshold that is required to add another contract.  Equistion looks as follows:

position=0,5*[(1+8*profit/delta)^0,5+1].

I prepered the formula:

capital=Equity();

capital[0]=a;//a is initial equity//

profit[0]=0;

for(i=0;i<Barcount;i++)

{profit[i]=capital[i]-capital[0];}

d=Optimize("delta",500,500,10000,500);

PositionSize=0.5*((1+8*profit/d)^0.5+1);

...and it doesn't work in the backtest (it always sets the same number of contracts for the whole backtest period that is 1 contract), since <profit> return no value but <0> (zero)... :( . Replacing PositionSize with SetPositionSize(0.5*((1+8*profit/d)^0.5+1), 1) doesn't work, too.

Can you give me some advice about this code? How to make <profit> work? What's wrong with this formula?

I will be very grateful for any advice.

Best regards

Tomasz



__._,_.___


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

__,_._,___