It's been a while since I looked at this, and I'm going from imperfect memory. However, if your strategy includes the use of stops, then the placement of the call to "handleStops" makes a difference. Depending on a combination of factors, including the option named "ActivateStopsImmediately", you may have to move the call earlier in the loop.
Mike --- In [email protected], "engineering_returns" <trade2live4e...@...> wrote: > > Hello, > i tried to simulate the exact same system results running a very simple > strategy using low level CBT vs no CBT at all. The code bellow worked > well in a single symbol mode, meaning i got the same results no matter > if i used the low level CBT or not. > Running the same code in a portfolio mode (meaning having multiple > symbols) i do get a different result. The result differs specifically in > the number of trades where low level CBT version produces fewer trades. > Where does this distinct behavior come from? Your feedback is > appreciated - Thanks > Frank > > --------------------------------------------------------------------- > SetCustomBacktestProc(""); > if ( Status( "action" ) == actionPortfolio){ bo = > GetBacktesterObject(); bo.PreProcess(); > for (i=0; i<BarCount;i++) { for (sig=bo.getfirstsignal(i); > sig; sig=bo.getnextsignal(i)) { if (sig.IsEntry()) > { bo.EnterTrade(i, sig.Symbol, sig.islong(), sig.Price, > sig.possize); } > if (sig.isexit()) { bo.ExitTrade(i, > sig.symbol,sig.price); } } bo.handlestops(i); > bo.updatestats(i,1); bo.updatestats(i,2); } bo.postprocess;} >
