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

RE: [amibroker] any ideas to reduce runtime for the price RS ranking code?



PureBytes Links

Trading Reference Links

Ok Tomasz, I have never heard of this type of margin account. 


Cheers,
Graham
http://e-wire.net.au/~eb_kavan/

-----Original Message-----
From: Tomasz Janeczko [mailto:amibroker@xxxxxx] 
Sent: Sunday, August 01, 2004 7:48 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Varying Margin

German,

There are TWO different kinds of margins.

1. MarginRequirement that is applied on ACCOUNT level
http://www.amibroker.com/guide/w_settings.html
Margin requirement
This setting defines percentage margin requirement for entire account. The
default value of Margin requirement is 100. This means
that you have to provide 100% funds to enter the trade, and this is the way
how backtester worked in previous versions. But now you
can simulate a margin account. When you buy on margin you are simply
borrowing money from your broker to buy stock. With current
regulations you can put up 50% of the purchase price of the stock you wish
to buy and borrow the other half from your broker. To
simulate this just enter 50 in the Margin requirement field (see pic. 1) .
If your intial equity is set to 10000 your buying power
will be then 20000 and you will be able to enter bigger positions. Please
note that this settings sets the margin for entire account
and it is NOT related to futures trading at all. In other words you can
trade stocks on margin account.


2.
MarginDeposit
(for trading FUTURES)
http://www.amibroker.com/guide/h_futbacktest.html

Latter could be changed on PER SYMBOL basis.

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. Margin 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
PS. If you received other information from Marcin, please forward
me his response, because in that case I would need to educate him more.

----- Original Message ----- 
From: "Graham" <gkavanagh@xxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Sunday, August 01, 2004 1:28 PM
Subject: RE: [amibroker] Varying Margin


> That would work on a symbol by symbol basis for the old style back
testing,
> but does it work correctly for portfolio testing. My understanding from
> emails to support that the margin is applied to your total capital
allowing
> for additional trades to the margin amount. It allows for larger capital
> overall only eg your capital $100k, margin at 50% allows to have total
open
> trades to purchase of $150k. It does not apply to a single trade as you
> would in real margin situation. eg you provide 60% and margin 40% for a
> trade.
>
> Cheers,
> Graham
> http://e-wire.net.au/~eb_kavan/
>
> -----Original Message-----
> From: Tomasz Janeczko [mailto:amibroker@xxxxxx]
> Sent: Sunday, August 01, 2004 7:09 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: Re: [amibroker] Varying Margin
>
> Hello,
>
> Right now margindeposit must be constant for one symbol
> (it may vary on symbol-by-symbol basis, but not on bar-by-bar basis).
>
> So right now you should use higher of the two:
> MarginDeposit = 18750;
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "billtex2003" <billtex2003@xxxxxxxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Sunday, August 01, 2004 12:55 PM
> Subject: [amibroker] Varying Margin
>
>
> > I'm trying to test a NASDAQ trading system.
> >
> > If long, the trade is held over until the next day and the margin
> > requirement is $18750 per contract.
> >
> > If short the trade is closed the same day and the margin is half -
> > $9375.
> >
> > I tried this code:
> > margindeposit = iif(Buy,18750,9375);
> >
> > It won't work. It takes the 9375 in every case.
> >
> > Any help is appreciated.
> > Thank you.
> >
> >
> >
> >
> >
> > Check AmiBroker web page at:
> > http://www.amibroker.com/
> >
> > Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> Yahoo! Groups Links
>
>
>
>
>
>




Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links



 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

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

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