So for the backtesting , is it necessary to make an adjustment for the last day of the current contract and the first day of the next far contract? Even if there's is a gap, that's the actual price, u can't avoid the roll yield.
Yes, you do need. Back-testing without contract rolling will result in artificial profits or loss that are not realizable in live trading.
Suppose a particular market is in backwardation, a positive roll yield is therefore expected. To roll into the longer out contract upon expiration, you expect a lower price to establish the new position. So in live trading, you will unwind the current contract before expiration at the prevailing rate, and take the same position in the next contract. This process is called rolling, and you will realize no gains or loss, assuming transaction cost is negligible.
To simulate this process in back-testing, you will make the continuous price series, so the artificial price gap in the rolling day is filled. Otherwise, assuming you have a long position upon expiration that you will hold overnight, the back-testing will show an artificial gain in portfolio values if the market is in backwadation, or an artificial loss if the market is in cantango.