Re: [amibroker] Need help with PositionSize using an optimization for ATR

 

As a starting point is this what you are wanting to code?

Example:
R=risked amount (assume $1000)

PERIOD = ATR period (assume 10 day)
M= Multiple applied to ATR (assume 1)

C= Most recent closing price (assume $10.00)
ATR(10) = 10 day ATR (assume .5)

Number_of_shares = R/(M*ATR(10)) = $1000/(1*.5) = 2000
Position_size = Number_of_shares * C = 2000*10 = $20,000





On 2/22/2016 10:19 AM, steve@optimusadvisory.com [amibroker] wrote:
 

I run a strategy that uses 11 inverse funds.  I want to tweak it to adapt to each inverse funds' change in volatility (to increase or decrease my position sizes each buy).  I'm a novice at Amibroker afl and am trying to understand how to do this via ATR.  The trick is I am not scanning a list of symbols for candidates.  I have specific rules for each individual symbol I use.  Here is some sample code in my strategy.


if( n == "DXKSX" )

{

    //Strategy 3 US Gov Bear 10-Year 2X (Direxion)

>>>INDIVIDUAL RULES GO HERE<<<


PositionSize = -25;

}


if( n == "RRPIX" )

{

    //Strategy 8 ProFunds Rising Rates US Gov 30 Bond 1.25X// 

>>INDIVIDUAL RULES GO HERE<<<


PositionSize = -40;

}


How do I use ATR for position size?  Do I need to optimize each symbol individually and then insert that afl code into the above strategy?


Thanks so much.  As I said, I'm an idea person, not a programmer.  I just want to be able to optimize the best way to increase or decrease position size as each symbols' volatility changes.


You guys are the best!


Graphman.


__._,_.___

Posted by: Alan <alan@thenorthams.us>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)
**** 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/


.

__,_._,___


EmoticonEmoticon