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

Re: [amibroker] TJ: Margin Requirement



PureBytes Links

Trading Reference Links

Hello,

For futures use MARGINDEPOSIT variable.


BTW: There is a typo in one page of the manual.
"
Simple cases

Points-only test

Points only test is equivalent to trading just one contract. This can be easily accomplished using Futures mode of the backtester
and adding the following one line to your formula:

  PositionSize = MarginRequirement = 1;

Trading 'n' contracts

In a similar way you can setup your formula so it always trades say 7 contracts. All you need to do is to add the following to your
formula:

  NumContracts = 7;
  PositionSize = NumContracts * MarginRequirement;

  "

  >>> It should read MARGINDEPOSIT <<<



Margin deposit

The margin is the amount of money required to open single contract position. You can specify per-symbol margin in the
Symbol-Information page (picture above). Positive values describe margin value in dollars, while negative express margin value as
percentage of contract price. Magin value of zero is used for stocks (no margin). Margin can be also specified in the formula by
using MarginDeposit reserved variable:

  MarginDeposit = 675;

In the Futures mode margin setting is used to determine how many contacts can be purchased. Let's suppose that your initial equity
is set to $50000 and you want to invest upto 20% of equity in single trade and the margin deposit is $675. In that case your
"desired" position size is 50'000 * 0.2 = 10'000. Provided that you have set round lot size to 1, the backtester will "buy"
10000/675 = (integer)14.8148 = 14 contracts, and true positon value will be $9450 (18.9% of the initial equity).

To simulate this in AmiBroker you would need to enter 50000 in the Initial Equity field in the backtester, switch on futures mode,
and setup remaining parameters in your formula:

  PositionSize = -20; // use 20% of equity
  MarginDeposit = 675; // this you can set also in the Symbol-Information page
  RoundLotSize = 1; // this you can set also in the Settings page

All further trades will use the same logic but position will be sized according to current cumulated equity instead of initial
equity level, unless you specify fixed position size in your formula ( PositionSize = 10000 for example).



Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "netbull2000" <netbull2000@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Thursday, June 05, 2003 8:38 AM
Subject: [amibroker] TJ: Margin Requirement


> Tomasz,
>
> I have noticed that the margin requirement has no effect on futures
> backtesting that is no matter whether it is 1 or 100 I get the same
> results. Yet, when the same is done for stocks the results can vary
> very drastically and for 1 this can be simply unintelligeable. The
> standard value seems to be 100 when no margin is permitted. I must
> say that I feel rather uncomfortable not knowing how this thing is
> supposed to be used properly, so I would appreciate if you could
> comment on this or if you could point me to some detailed reference
> in the AB help. I did not find anything in the help that would answer
> my question.
>
> Here are the results when the margin requirement is set to 1 for some
> simple system applied to BORL with 10,000 of initial equity:
>
> Total net profit:-242953972.35 Total commissions paid:33.60
>       Return on account:-2429539.72 %  Open position gain/loss0.00
>       Buy&Hold profit:542765.73 Bars (avg. days) in test:600 (876)
>       Buy&Hold % return:5427.66% System to Buy&Hold index:-44862.22%
>
>       Annual system % return:N/A  Annual B&H % return:432.18%
>
>       System drawdown:-252951730.55 B&H drawdown:-78170.79
>       Max. system drawdown:-414904383.59 B&H max. drawdown:-1758104.58
>       Max. system % drawdown:-2099.72% B&H max. % drawdown:-6478.23%
>       Max. trade drawdown:-414904383.59
>       Max. trade % drawdown:-2099.72%
>       Trade drawdown:-274936655.05
>
> TIA,
> Wally
>
>
>
>
>
>
> Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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