Bistrader Thanks for this. I've had trouble stepping through DateTime() in CBT and using _Trace to follow what's what. This simple code helps with understanding. Thanks! Dave
----- Original Message ----- From: bistrader To: [email protected] Sent: Monday, September 14, 2009 8:42 AM Subject: [amibroker] Re: problem with position and GetBacktesterObject(); About open positions? SetOption("UseCustomBacktestProc", True ); barDates = DateTime(); if( Status("action") == actionPortfolio ) { bo = GetBacktesterObject(); bo.PreProcess(); for( bar = 0; bar < BarCount; bar++ ) { barDate = barDates[bar]; OpenPos = ""; OpenPosCnt = 0; for( pos = bo.GetFirstOpenPos(); pos; pos = bo.GetNextOpenPos() ) { OpenPos += pos.Symbol + ","; OpenPosCnt++; } _TRACE( NumToStr(barDate, formatDateTime) + " OpenPos( " + OpenPosCnt + " ):" + OpenPos ); bo.ProcessTradeSignals( bar ); } bo.PostProcess(); } --- In [email protected], "raskoks" <rask...@...> wrote: > > Hi, > I wonder how to use > bo = GetBacktesterObject(); > and maybe loop like this: > > for( trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade() ) > { > // trade variable now holds Trade object > > } > > Too find information about current bactester position. > I need to know for every bar information about position (long,short) because some signals shoud be use only when i have long and some for shorts. > Maybe someone can help mi with this kind of problem. > > Best regards > raskoks >
