Okay Tomasz Point taken.
I consciously excluded all but the CBT code to avoid "unnecessary" clutter. I will re-post. Graham --- In [email protected], "Tomasz Janeczko" <[EMAIL PROTECTED]> wrote: > > Again someone posting incomplete formula and being "surprised" > not to get reply. If you want reply provide FULL Formula. > No-one is going to spend time filling missing pieces and guessing what > remaining part of the formula was. > > If you want help, you must provide the formula that can > be copy-pasted to AA and run directly without adding anything extra. > > The starting point to receving help is providing everything needed > to reproduce your problem. > > And as to the problem: most probably you did not define > short signals (in the "remaining" part of the formula that is missing > from your post). > > Best regards, > Tomasz Janeczko > amibroker.com > ----- Original Message ----- > From: "Graham Johnson" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Wednesday, May 21, 2008 2:13 PM > Subject: [amibroker] Re: CBT problem with Short System > > > > I'm surprised that I haven't had a response. Whilst I haven't been > > able to resolve it, I would have expected that it wasnn't a difficult > > problem. > > > > Graham > >> > >> Just starting to get my hands dirty in the Custom Backtester and > > have > >> read everything I can find. > >> > >> Some time ago I found some code on this forum for a custom metric > > for > >> Max Open Positions - it has worked fine on Long systems but when I > >> try it on a Short system, it returns O max Open Trades. Have I > >> missed something? > >> > >> Code follows. > >> > >> Graham > >> > >> SetOption("UseCustomBacktestProc", True); > >> SetCustomBacktestProc(""); > >> > >> //================== Open Position Count ================== > >> vCounts = Cum( 0 ); > >> vMaxCount = 0; > >> > >> if ( Status( "action" ) == actionPortfolio ) > >> { > >> vBO = GetBacktesterObject(); > >> vBO.PreProcess(); > >> > >> for ( vBar = 0; vBar < BarCount; vBar++ ) > >> { > >> vBO.ProcessTradeSignals( vBar ); > >> vCnt = 0; > >> > >> for ( vPos = vBO.getFirstOpenPos(); vPos; vPos = > >> vBO.getNextOpenPos() ) > >> { > >> vCnt++; > >> _TRACE( "Count: " + vCnt ); > >> } > >> > >> vCounts[vBar] = vCnt; > >> > >> if ( vCnt > vMaxCount ) > >> { > >> vMaxCount = vCnt; > >> } > >> } > >> > >> vBO.PostProcess(); > >> > >> vBO.addCustomMetric( "Max Open Posn", vMaxCount ); > >> > >> AddToComposite( vCounts, "~OpenPosCount", "V", atcFlagDefaults > > | > >> atcFlagEnableInBacktest | atcFlagEnableInPortfolio ); > >> } > >> > > > > > > > > ------------------------------------ > > > > 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > > http://www.amibroker.com/devlog/ > > > > For other support material please check also: > > http://www.amibroker.com/support.html > > Yahoo! Groups Links > > > > > > >
