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

[amibroker] Re: Problem with volatile position sizing



PureBytes Links

Trading Reference Links

Tomasz, 

Thank you very much for your help. I bothered to read the mentioned
docs, however I'm pretty new in AmiBroker thus I wasn't able to notice
my mistake. Anyway, thanks again for your help and my apologies for
wasting your and other readers' time.

Now everything works fine and I'm really impressed how AmiBroker works
for me :-)

Kind regards,
Jacek

--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx> wrote:
>
> > The problem is that MarginDeposit is using always the latest value of
> 
> Wrong. It does not use "lastest" value.
> 
> MarginDeposit uses the value at the time when buy signal occurred.
> 
> Your mistake comes from the fact that you are using PointValue
> to specify margin deposit. That is wrong.
> 
> Position Sizing should NOT be done by varying margin deposit because
> margin deposit is set by EXCHANGE, not by you.
> Position Sizing should be set by (surprise ?) SetPositionSize !!!
> 
> Did you bother to read the docs ?
> http://www.amibroker.com/guide/h_backtest.html
> 
> It specifically gives an example of ATR based position sizing.
> Open the manual
> http://www.amibroker.com/guide/h_backtest.html
> 
> Scroll to "Position sizing" and read associated ATR-based example.
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "jacek.lempart" <jacek.lempart@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Saturday, December 27, 2008 5:54 PM
> 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. 
> > 
> > 
> > ------------------------------------
> > 
> > **** 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
> > 
> > *********************************
> > Yahoo! Groups Links
> > 
> > 
> >
>



------------------------------------

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

*********************************
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/