Future Calendar Spread (Loss Making)

I am currently exploring a futures calendar spread strategy. While the strategy appears to be arbitrage-based and consistently profitable on paper, the impact of the bid-ask spread significantly affects its real-world profitability.

The challenge lies in the execution: both at entry and exit, there’s a difference between the bid and ask prices of the contracts, which introduces slippage.

For example, suppose we enter a trade based on the prevailing bid/ask prices. Later, even if the theoretical spread between contracts converges in our favor—indicating a profit—the actual bid/ask at the time of exit may still differ, making it hard to realize the expected gain.

In the image I uploaded, this is exactly what’s happening with Reliance July and August futures. The exit spread (next month ask - current month bid) is greater than the entry spread (next month bid - current month ask), which results in a loss.

This issue seems consistent across multiple stocks I’ve analyzed. What are some effective ways to tackle or mitigate this?

Change tracking considering worst case -

If - 
Entry Spread = (Next Month Bid) - (Current Month Ask)
Exit Spread = (Next Month Ask) - (Current Month Bid)
Then - 
Potential Profit = Entry Spread - Exit Spread - 2 × (Avg Bid-Ask Width)

And you will realise the opportunity is available NOT so often and the risk adjusted returns matches at best an arbitrage fund.

Could you please elaborate, I didn’t get what you are trying to explain