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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> *To:* [email protected] *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 [email protected], "supistarde" <[EMAIL PROTECTED]> 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, >
