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

Re: [amibroker] Testing - # of contracts



PureBytes Links

Trading Reference Links

you must ahve something else wrong in the code, or your settings
PositionSize = MarginDeposit;
can only ever give you one contract per trade.


-- 
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://e-wire.net.au/~eb_kavan/ab_write.htm


On 21/06/06, PKJR <TradingIQ@xxxxxxxxx> wrote:
>
> Graham - I know I am one unlucky guy.. that did not work either.. I have
> submitted ticket to AB.. it works as planned on future contract, but for
> some reason if I switch to composite contract created from underlying future
> contracts I get between 5 and 20 contracts per position so it seems like
> with starting account size 50k and margin 9200 - the first position is 5
> contracts.. - has anyone backtested based on composite contract created with
> AddToComposite?
>
>
> On 6/20/06, Graham <kavemanperth@xxxxxxxxx> wrote:
> >
> >  PositionSize = MarginDeposit = 1; gives you a points only test result
> >
> > to buy only one contract you use
> > PositionSize = MarginDeposit;
> >
> > You need to define the margindeposit, pointsvalue, tickszie in the
> > symbol information (or for a single symbol you can just do it in the aFL)
> > Also make sure you tick the Futures in the AA settings window.
> >
> >
> >
> > --
> > Cheers
> > Graham
> > AB-Write >< Professional AFL Writing Service
> > Yes, I write AFL code to your requirements
> > http://e-wire.net.au/~eb_kavan/ab_write.htm<http://e-wire.net.au/%7Eeb_kavan/ab_write.htm>
> >
> >
> > On 21/06/06, Terry <MagicTH@xxxxxxxxxxx> wrote:
> > >
> > >   PK,
> > >
> > >
> > >
> > > Wow! Better guess right on Long or Short at 10,000:1 leverage!
> > >
> > >
> > >
> > > PositionSize, when positive, refers to a fixed dollar amount. You must
> > > trade AT LEAST the size of the MarginDeposit to get any trades.
> > >
> > >
> > >
> > > There are many options that can be set in code. Have you tried this
> > > one?
> > >
> > >
> > >
> > > SetOption( "FuturesMode" ,True); //Requires True or False //NOTE: This
> > > is insufficient. You must also check Futures mode in AA-Settings.
> > >
> > >
> > >
> > >
> > >
> > > Some info from the Help section:
> > >
> > > *Position sizing*
> > >
> > > This is a new feature in version 3.9. Position sizing in backtester is
> > > implemented by means of new reserved variable
> > >
> > > PositionSize = <size array>
> > >
> > > Now you can control dollar amount or percentage of portfolio that is
> > > invested into the trade
> > >
> > >    - positive number define (dollar) amount that is invested into
> > >    the trade for example:
> > >
> > >    PositionSize = 1000; // invest $1000 in every trade
> > >    - negative numbers -100..-1 define percentage:
> > >    -100 gives 100% of current portfolio size,
> > >    -33 gives 33% of available equity for example:
> > >
> > >    PositionSize = -50; /* always invest only half of the current
> > >    equity */
> > >    - dynamic sizing example:
> > >
> > >    PositionSize = - 100 + RSI();
> > >
> > >    as RSI varies from 0..100 this will result in position depending
> > >    on RSI values -> low values of RSI will result in higher percentage invested
> > >
> > >
> > > If less than 100% of available cash is invested then the remaining
> > > amount earns interest rate as defined in the settings.
> > >
> > > There is also a new checkbox in the AA settings window: "Allow
> > > position size shrinking" - this controls how backtester handles the
> > > situation when requested position size (via PositionSize variable)
> > > exceeds available cash: when this flag is checked the position is entered
> > > with size shinked to available cash if it is unchecked the position is not
> > > entered.
> > >
> > > --
> > >
> > > Terry
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: amibroker@xxxxxxxxxxxxxxx [mailto: amibroker@xxxxxxxxxxxxxxx] On
> > > Behalf Of PKJR
> > > Sent: Tuesday, June 20, 2006 14:39
> > >
> > > To: amibroker@xxxxxxxxxxxxxxx
> > > Subject: Re: [amibroker] Testing - # of contracts
> > >
> > >
> > >
> > > Tks for your help but the Point value is not up to me.. this Natural
> > >
> > > Gas contract - specs here:
> > >
> > > http://www.nymex.com/NG_spec.aspx
> > >
> > >
> > >
> > > I used PositionSize=1 (shown on my pic) - before but that did not work
> > >
> > > either.. the funny thing is that it works on just on underlying
> > >
> > > contract..but not on composite created from the contract..
> > >
> > >
> > >
> > >
> > >
> > > On 6/20/06, Terry <MagicTH@xxxxxxxxxxx > wrote:
> > >
> > > > Okay, I see what you want now. You need to use a fixed value for
> > >
> > > > PositionSize. AA automatically does compound testing and the number
> > > of
> > >
> > > > contracts is varying with the amount of equity you have.
> > >
> > > >
> > >
> > > > Try this in your code:
> > >
> > > >
> > >
> > > >
> > >
> > > > PositionSize = Param("Position Size",-100,-100,1000000,1);
> > >
> > > > //Adjustable in Parameters
> > >
> > > >
> > >
> > > > Or just
> > >
> > > >
> > >
> > > > PositionSize = 9200;
> > >
> > > > //Or a multiple thereof to trade more than 1 contract
> > >
> > > >
> > >
> > > > Maybe even this:
> > >
> > > >
> > >
> > > > numContracts = Param("Number of contracts to trade",1,1,100,1);
> > >
> > > > PositionSize = 9200 * numContracts;
> > >
> > > >
> > >
> > > > I also question your Point value. Do you really want 10,000:1
> > > leverage?
> > >
> > > > --
> > >
> > > > Terry
> > >
> >
> >
> >
> >
> 
>