Hello
I have a system that buy shares in portfolio mode, 3 shares 
maxpositions, in EOD signals
But if the stoploss sell a share within a day, the system in backtest 
show that would have bought another share in open time, which is not 
possible cause it don't know that one share is going to be sold within 
that day

To prevent it, I have tried the custom backtest procedure, but it 
doesn't work. Someone know how to make this possible?

This is the code I have tried and that don't change any trade in my 
backtest results..:
SetOption("UseCustomBacktestProc", True );

if( Status("action") == actionPortfolio )//phase Custom Backtest 
Interface
{
        bo = GetBacktesterObject();
        bo.PreProcess();
        Cnt = 0;
        for( openpos = bo.GetFirstOpenPos(); openpos; openpos = 
bo.GetNextOpenPos() )
        {
                Cnt++;
        }
        for( bar = 0; bar < BarCount; bar++ )
        {
                for( sig = bo.GetFirstSignal( bar ); sig; sig = 
bo.GetNextSignal( bar ) )
                {
                        if( Cnt >=3 ) sig.Price = -1; // exclude        
                }
                bo.ProcessTradeSignals( bar );
        }
        bo.PostProcess();
}

Any suggestions?




Reply via email to