Limiting Number of trades in a day in pf of stocks in intraday scenario

I want to implement limiting number of total trades in a day in Portfolio of 500 stocks for intraday scenario. I have gone through links such as and Knowledge Base link covers option of limiting for single security only , whereas @Aron example is of limiting number of trades per bar, whereas i am looking to limit number of trades per day.

I have limit on open positions in amibroker, but i also want to limit max trades in a trading day
I guess i have to use CBT , any guidance or approach to take ?

Actually figured this out by using variable for new day and resetting count signal every new day to zero in CBT.


if( Status( "action" ) == actionPortfolio )
    bo = GetBacktesterObject();	//  Get backtester object
    bo.PreProcess();	//  Do pre-processing (always required)

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

        for( sig = bo.GetFirstSignal( i ); sig; sig = bo.GetNextSignal( i ) )
            if( sig.IsEntry())
                if( count< 2 )
                    count ++;
                    sig.Price = -1 ; // ignore entry signal

        bo.ProcessTradeSignals( i );	//  Process trades at bar (always required)

    bo.PostProcess();	//  Do post-processing (always required)

@mradtke Any inputs ?


You are the hero. thanks bro.

Worked perfect the 1st try. Thanks