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

Re: [amibroker] Problem with volatile position sizing



PureBytes Links

Trading Reference Links

Would you use:
 
MarginDeposit = Valuewhen(buy,atr(20)) * PointValue:
 
 
----- Original Message -----
Sent: Saturday, December 27, 2008 11:54 AM
Subject: [amibroker] Problem with volatile position sizing

Hello,

I have got a problem with the following piece of code:

Capital = 50000;
PositionSize = -5;
RoundLotSize = 1;
PointValue = 10;
TickSize = 1;
MarginDeposit = Ref(ATR(20), -1) * PointValue;

The problem is that MarginDeposit is using always the latest value of
ATR(20), not the one from the past, when position was opened. I wanted
to implement position sizing for futures based on volatility model, i.e:
* ATR(20) is 50 points and each point means 10 dollars or whatever
* we are going to allow volatility to be maximum of 5% of our equity
(i.e. $2500)
* $2500 / (50 * 10) = 5 --> it gives us 5 contracts which we can buy/sell

How can I force AmiBroker to use ATR(20) value for the time period
when the position is being opened? Many thanks for your help.



No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.176 / Virus Database: 270.10.0/1865 - Release Date: 12/26/2008 1:01 PM
__._,_.___

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL 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

*********************************




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

__,_._,___