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 http://www.amibroker.com/kb/2015/09/26/limit-number-of-trades-per-day-in-a-backtest/ and https://forum.amibroker.com/t/limit-number-of-new-positions-for-a-single-day/2862/4. 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( count< 2 )
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