Hi Mark, Thank you for your very prompt reply. I will study your code shortly.
I personally do not use limit shares by % of one bar's volume, because when I backtest for a long period of time (more than 10 years) my equity grows so big so fast that, the volume limit makes recent years not accounted for. For instance, suppose I start out with $30000 and I have 10% limit on the bar of trade. At the beginning, the 10% limit is no issue because I don't have much money to begin with. But later on, I might have like 4 million dollars and that's when things get problematic; with that amount of money, the trades I'm making is so small to my cash position that, I would see situations where my system is hardly working yet I maintain high Cumulative Annual Return because bad trades don't hurt my cash position. When designing a system, this is a big issue; you don't want to have a non-working system disguised like working. Your approach of using EMA as a limit is very interesting however. I will see how I can incorporate it into my system. Thank you, intermilan04 --- In [email protected], "Mark H" <[EMAIL PROTECTED]> wrote: > > Limit shares by % of one bar's volume is one of the worst practices in backtesting. > I am always a bit puzzled by why everybody is concerned about "looking into the future" but few people pay attention to this practice. > It is "looking into the future" in terms of volume! When you place an order in the morning, do you know today's volume? > And position sizing has great impact on system performance. > > Anyway, to use 1% EMA(V,50) of today as limit for tomorrow's entry, you may need to use CBT to do backtest. > Here is what I do: (normal position size is 10% of equity) > > ...... > SetPositionSize(EMA(V,50) * 0.01 * BuyPrice, spsValue ); > > ...... > > if( Status("action") == actionPortfolio ) > > { > > bo = GetBacktesterObject(); > > .......... > > for ( sig=bo.GetFirstSignal(bar); sig; sig=bo.GetNextSignal(bar)) > > { > > // Only one position per symbol > > if (sig.isEntry() AND sig.Price != -1 AND IsNull( bo.FindOpenPos( sig.Symbol ))) > > { > > // sig.PosSize is passed from Phase I. It is %1 of EMA(V, 50). > > ps = Min(sig.PosSize, bo.Equity * 0.10); > > // long only > > bo.EnterTrade(bar, sig.symbol, True, sig.Price, ps, sig.PosScore,sig.RoundLotSize); > > } > > } > > > > ----- Original Message ----- > From: intermilan04 > To: [email protected] > Sent: Tuesday, August 15, 2006 11:37 PM > Subject: [amibroker] Re: Buying at open -- In Real Life > > > Hi Mark, > > Very interesting approach. How do you limit the volume like how you > do? I am aware you can limit by % of one bar's volume, but not sure > if you could do like 1% of 50 period EMA of volume. > > Regards, > > intermilan04 > > --- In [email protected], "Mark H" <amibroker@> wrote: > > > > Yes. My system buys/sells at open since I still have a day job. The > results have been very close to those of backtest. > > I think it contribute to two factors: I use IB which in most cases > can get you the exact open prices; my system limits the shares to buy > to 1% of 50 period EMA of volume. > > > > ----- Original Message ----- > > From: intermilan04 > > To: [email protected] > > Sent: Tuesday, August 15, 2006 2:30 AM > > Subject: [amibroker] Buying at open -- In Real Life > > > > > > Hi all, > > > > I'm just curious if anyone here are buying and selling securities at > > the open with market orders, i.e. orders are placed BEFORE MARKET OPEN > > and they get executed as soon as the market opens. > > > > I have noticed that buying at the open might help you get cheap > > shares, but the reverse is also true...you might sell your shares at > > really bad bids. > > > > The reason why I'm bringing it up is, my system on Amibroker is > > designed to trade at the open. And strangely enough, my system isn't > > doing too well ever since I started using it...perhaps it's because > > I'm getting bad bids and asks by placing market orders overnight? > > > > I'm not quite sure how the first trade occurs, in theory I sell to the > > highest bidder but with low liquidity of pre-market trading, what if > > the highest bid is absurdly low? > > > > Any thoughts on this is greatly appreciated. > > > > Regards, > > > > intermilan04 > > > Please note that this group is for discussion between users only. To get support from AmiBroker please send an e-mail directly to SUPPORT {at} amibroker.com For other support material please check also: http://www.amibroker.com/support.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: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
