CBT - Mid Level

I am trying to get some values from CBT mid level testing.
Number of Buy Signals, Number of Sell signals and Number of open positions, from the GetFirstSignal / GetNextSignal loop.

I have positioned the queries in 2 different locations as a test because I don’t know wher I should place them.

The Buy and Sell signal queries do not produce any data. Arrays in static variables are EMPTY
The Open position query has data, but the 2 queries for open position have different value. Don’t know which one is correct.

Thanks
Ara

if( Backtester == "CBI-Mid" )                                       // If not CBI, use normal backtest process
{
    SetOption( "UseCustomBacktestProc", True );

	BuySignals_1 = SellSignals_1 = OpenPositions_1 = 0;
	BuySignals_2 = SellSignals_2 = OpenPositions_2 = 0;
	//
    if( Status( "action" ) == actionPortfolio )
    {

        bo = GetBacktesterObject();										//  Get backtester object
        bo.PreProcess();												//  Do pre-processing

        for( i = 0; i < BarCount; i++ )								//  Loop through all bars
        {

            for( sig = bo.GetFirstSignal( i ); sig; sig = bo.GetNextSignal( i ) )
            {
                //
                BuySignals_1[i]		= bo.GetSignalQty( i,1 );									// Buy Signals
                SellSignals_1[i]	= bo.GetSignalQty( i,2 );  									// Sell Signals
                OpenPositions_1[i]	= bo.GetOpenPosQty();										// Open Positions
                //
            }	//  End of for loop over signals at this bar

            //
            //  Process trades at this bar
            bo.ProcessTradeSignals( i );
            //
			BuySignals_2[i]		= bo.GetSignalQty( i,1 );  										// Buy Signals
			BuySignals_2[i]		= bo.GetSignalQty( i,2 );  										// Sell Signals
            OpenPositions_2[i]	= bo.GetOpenPosQty();											// Open Positions
            //
		}
		bo.PostProcess();
			StaticVarSet("BuySignals_1",BuySignals_1);				// Value is EMPTY
			StaticVarSet("SellSignals_1",SellSignals_1);			// Value is EMPTY
			StaticVarSet("OpenPositions_1",OpenPositions_1);		// Values are present
			//
			StaticVarSet("BuySignals_2",BuySignals_2);				// Value is EMPTY
			StaticVarSet("SellSignals_2",SellSignals_2);			// Value is EMPTY
			StaticVarSet("OpenPositions_2",OpenPositions_2);		// Values are present - Different from above group
	} // end if status("action")
} // end if CBI-Mid