My script normally runs for 7-10 seconds on a single symbol with 450000 bars.
After I've used custom backtester it runs for 30 seconds. This is what has been
added:
SetOption("UseCustomBacktestProc", 1);
if (Status("action") == actionPortfolio)
{
bo = GetBacktesterObject();
bo.preProcess();
for (nBar = 0; nBar < BarCount; nBar++ )
{
for (sig = bo.GetFirstSignal(nBar); sig && sig.isEntry(); sig =
bo.GetNextSignal(nBar))
{
//_TRACE("" + sig.posSize);
if (-sig.posSize / 100 * bo.equity >
fMaxCapitalForTrade)
sig.posSize = -fMaxCapitalForTrade / bo.equity
* 100;
}
bo.ProcessTradeSignals(nBar);
}
bo.postProcess();
}
No matter how many trades produced - looks like that
SetOption("UseCustomBacktestProc", 1); is the main reason.
Are there any ways to make it faster ?