Hi There were a few threads recently on the topic of scaling in. Start with this one and see if it helps (p.s. do a search on sigScaleIn for more posts).
http://finance.groups.yahoo.com/group/amibroker/message/146956 Mike --- In amibroker@yahoogroups.com, Sidney Kaiser <skbi...@...> wrote: > > > Trying to code up Larry Connors TPS entry conditions. > > I finally have to figure out how to scale into a position. Reading though > the help files and old emails I thought I understood it, but....apparently > not. > I was thinking the first buy line would buy one lot and then the other buys > (currently commented out) would be used for subsequent buys...wrong. > > The first buy is scaling into several lots all on its own as can be seen in > the attached .csv file of a part of the detail log. The buy prices are not > what I want, see those commented buy statements for that. It looks > like SigScaleIn is buying successive bars after the initial conditions are > met for the first buy. > > So help me out here. How do I set up the scaling in where there can be as > many as 4 entries with them being larger by 2x, then 3x, then 4x as many > shares at individually specified entry price conditions. > > RSI2 = RSI( RSIp); > MA5 = MA( Close, MAfp ); > MA200 = MA( Close, MAsp ); > PositionSize = 1000; > MAV = ( Close > MA200 AND Volume > 50000 ); > > Buy = MAV*IIf( Ref(RSI2, -1) < blvl AND RSI2 < blvl, sigScaleIn, 0 ); // > initial buy > entry_price1 = ValueWhen( Buy, Close); > /* > Buy = MAV*IIf( Close < entry_price1, 2*sigScaleIn, 0); // 2nd buy > Buy = MAV*IIf( Close < 0.8*entry_price1, 3*sigScaleIn, 0); // 3rd buy > Buy = MAV*IIf( Close < 0.7*entry_price1, 4*sigScaleIn, 0); // 4th b > */ > Sell = Cross( RSI2, selvl ); > > Detail log: see attached .csv file > >