Forex trading is a SPOT trading, which means that all trades are settled on the second business day after your position has been opened. SWAP operation is used to avoid the physical delivery of a currency. In essence, in the end of each trading day, all positions are closed and immediately re-opened at SWAP price.