Hello - trying to stop trading activity when portfolio equity is 
below maxEquity by some pct, and resume trading when "equity" rises 
above previous maxEquity (where "equity" is as if trading had not 
been suspended)

Using custom backttest as follows:

// first run to collect when to stop/resume trading
bo.PreProcess(); 
for( bar = 0; bar < BarCount; bar++ ) 
{
bo.ProcessTradeSignals(bar); 
...some algorithm collecting when to stop/start trading
}
bo.PostProcess(); 

// second run to do the actual trading with equity based stops/resumes
bo.PreProcess(); 
for( bar = 0; bar < BarCount; bar++ ) 
{
...algorithm to scaleout/in of trades according to previous collected 
info
bo.ProcessTradeSignals(bar); 
}
bo.PostProcess(); 

However, on the second call to bo.ProcessTradeSignals(bar) above, I 
get "COM method/function failed: Internal application error". Can I 
use custom backtest in this "reentrant" way? - or is there anothor 
way to stop/resume trading based on portfolio equity (of the 
underlying trading algorithm)...?

best regards
Jens Tiedemann


Reply via email to