Help Needed in Rotational Trading: Entering New Positions Same Day as Exit

Dear All,

I am trying to code a simple rotational trading system and aiming to allocate available cash equally among the triggered buy signals. My approach involves a mid-level method for position sizing, and I am referring to this discussion:

Using Cash Only for Position Size

Maxpos = Param("Maxpos", 3, 1, 30, 1); //Maximum positions
RankHeld = Param("Worst Rank Held", 3, 1, 90, 1); //Worst rank held

SetBacktestMode( backtestRotational ); //Rotational backtest
score = C;
PositionScore = Score;

SetOption("MaxOpenPositions", Maxpos ); // This sets maximum number of open positions
SetOption("WorstRankHeld", RankHeld);
//SetOption("SettlementDelay", 0 );
SetOption("InitialEquity", 30000); 
SetCustomBacktestProc("");

dn = DateNum();

if (Status("action") == actionPortfolio) 
{
    bo = GetBacktesterObject();	//  Get backtester object
    bo.PreProcess();	//  Do pre-processing (always required)
	pos_size = 0;
	
    for (i = 0; i < BarCount; i++)	//  Loop through all bars
    {
        for (sig = bo.GetFirstSignal( i ); sig; sig = bo.GetNextSignal( i ) )
        {	
              // do your custom signal processing
              //sig.PosSize=bo.Equity / (Maxpos - bo.GetOpenPosQty());   //This is based on equity. Enters on the same day
              sig.PosSize=bo.Cash / (Maxpos - bo.GetOpenPosQty());   // Based on cash. It does not enter on the same day
              pos_size = sig.PosSize;
        
        }	
		
        bo.ProcessTradeSignals( i );	//  Process trades at bar (always required)
        
        _TRACE("dn[i]====> " + NumToStr(dn[i], 1) +" Maxpos===> " + NumToStr(Maxpos) + " bo.GetOpenPosQty()===> " + NumToStr(bo.GetOpenPosQty()) + "\n");
		_TRACE("dn[i]====> " + NumToStr(dn[i], 1) +" cash===> " + NumToStr(bo.cash)  + " pos_size ===>" + NumToStr(pos_size) +"\n");
		_TRACE("dn[i]====> " + NumToStr(dn[i], 1) +" Maxpos - bo.GetOpenPosQty()===> " + NumToStr(Maxpos - bo.GetOpenPosQty())  + "\n");        
    }	  
      
    bo.PostProcess();	//  Do post-processing (always required)
}

The challenge I face is as follows: When a position is exited, there is cash available, but the trades are not entered on the same day. The available cash is utilized only on the next day.

I would like to ensure that positions are entered on the same day the position is exited. Is it always that cash available from exit is available on the next day?

Please find the attached screenshots. also please note for testing, I manually edited the prices of LAXMIMACH. For simplicity I used closing prices for scores.

I feel like I might be overlooking a fundamental aspect here. Any guidance or pointers would be greatly appreciated!

Thanks is advance!

Best regards,
Vetri