When does a crypto exchange write to a blockchain? From my understanding, when dealing with an exchange you first transfer your currency to the exchange's address. The exchange then pools the currency of its participants.

When transactions then take place across the exchange, the exchange doesn't write to the underlying blockchain, but records all these transaction by changing their records of ownership in their own internal database. 

When you withdraw your funds, you then retrieve your currency back to your own wallet. 

Does this mean an exchange will only write to the blockchain when you transfer currency to or withdraw money from the exchange?
Yes and No, depending on the exchange. You can confirm this by watching the deposit transaction on the blockchain. For example using blockchain.info.

Some exchanges write to the blockchain once you deposit by immediately transfering your deposit to their cold wallet.

Others, like bitkonan will keep your funds on your deposit address for quite a while until you either trade or attempt a withdrawal.

So depends on the Exchange architecture, but for sure they all write to the blockchain when you make a withdrawal. 

The unfeasible alternative of making a real transaction whenever anyone trades would lead to too many transactions on the real blockchain and trades would have to wait to be mined so as to be completed.