PureBytes Links
Trading Reference Links
|
Hi there,
I'm also having trouble with this. So far what works it this:
SetPositionSize( 100/PosQty, spsPercentOfEquity );//original position
buy = ( buyconditions ) * sigscalein;
sell = sellconditions;
However, as is, this will use the original positionsize formula. I
want to change that, so I've tried using the SetPositionSize function
to scale in every time I get a buy condition true. Here's what I've
tried.
SetPositionSize( 50, IIf( Buy == sigScaleIn, spsPercentOfPosition,
spsNoChange ) );
SetPositionSize( 50, spsPercentOfPosition * ( Buy == sigScaleIn ) );
Both of these of course have been changed to sigscalein from
sigscaleout. I read in message # 103762 that sigscaleout only
applies to buy. Does that mean sigscalein only applies to sell? I
want to increase my position for every time I get a buy signal not
scale out.
Any help here will be greatly appreciated.
Thanks!
Wade
--- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxx> wrote:
>
> supistarde
>
> maxopenpositions limits the number of stocks that can have trades
open
> duiring a backtest
>
> scaling into trades is not affected this setting
> How you define the scaling depends on what you wnat to do
>
> eg to scale in every time you get a buy condtion true you can
simply write
>
> buy = ( buyconditions ) * sigscalein;
> sell = sellconditions;
>
> alternatively something like this could be used
>
> buy = buyconditions;
> sell = sellconditions;
> inTrade = flip(buy,sell);
> buy = buy and iif( intrade, sigscalein, 1);
>
> to change the positionsixze for the scalein then you use
setpositionsize
> function, see examples in help for this
>
> there are a number of methods to achieve the scaling and what you
use
> depends on the conditions for the buys and sells. sometimes straight
> condition statements are enough, other times you may nbeed to place
them
> into a for loop, or in extreme cases when the scaling is dependant
on the
> results of the first pass backtest then the custom backtest code is
needed
> (as you are a beginner in AFL I suggest you stay with the simpler
methods
> and build your knowledges of AB and the aFL)
>
> Look through the help files and also search on the archives of this
group
> for information on writing AFL.
>
> --
> Cheers
> Graham
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
> http://www.aflwriting.com
>
> On 16/11/06, Mark H <amibroker@xxx> wrote:
> >
> > You would need to use the custom backtester (CBT) to do the
position
> > sizing. See amibroker knowledge base for some examples.
> >
> >
> > ----- Original Message -----
> > *From:* supistarde <supistarde@xxx>
> > *To:* amibroker@xxxxxxxxxxxxxxx
> > *Sent:* Wednesday, November 15, 2006 1:22 PM
> > *Subject:* [amibroker] Re: Pyramiding: buy a 2nd time if buy
cryteria is
> > reached,
> >
> > does it not work at amibroker?
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "supistarde" <supistarde@>
wrote:
> > >
> > > Hello community,
> > >
> > > I know how to minimize open positions:
> > > SetOption("maxopenpositions",2);
> > >
> > > but how does this sigScaleIn work?
> > > I want to buy further stocks if my buy conditions are met a
second
> > > time. The second position should have half the size of the first
> > > position.
> > > How do I do this?
> > >
> > > Buy = Buy + sigScaleIn * DoScaleIn
> > > How do I link sigscalein to my buy signal?
> > >
> > > Regards,
> > >
> >
> >
> >
>
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.18/586 - Release Date: 12/13/2006 6:13 PM
|