Lets take a look at your address that you were using:
https://blockchain.info/address/17cvnT6acns72gZcHb625KrbpF6BnGbeYT
Most recent transactions are on top, older ones on the bottom. Green Arrow means you RECEIVED BTC and Red arrow means you SPENT it.
First, notice this address received bitcoins from 8 different transactions, scroll down to the bottom and notice the amounts shown to be send to YOUR address (not others)
0.01
0.15846456
0.21902931
4.1
0.1
4.3
0.11972378
1.7
These 8 transactions sent you a total of 10.70721765 BTC
Ok, so now we have your balance. Now let's look at the money you SPENT!
----------------------------
The first law of bitcoin: You don't spend bitcoins, you spend (invalidate) transactions to create new transactions. Meaning if I have 1.0001 BTC and I send you 0.1 BTC with a 0.0001 BTC miners fee, I MUST send 0.9 BTC back to myself, otherwise the BTC will disappear into nothing. (actually, miner fees are the gap between the sum of inputs and the sum of outputs, so they would disappear into miner fees)
That rule is hard to grasp, so let's see it in action with your transactions.
Starting from the 3rd transaction from the top (the most bottom Red Arrow)
Left side (Inputs) shows your address 4 times with 4 amounts. Notice the 4 amounts correspond with values in the amounts you received above in order. (the first 4 amounts you received were added up until they reached more than what you wanted to send: 0.70711765 BTC.
(0.01 BTC - Output)
(0.15846456 BTC - Output)
(0.21902931 BTC - Output)
(4.1 BTC - Output)
Now look at the right, You send 0.70711765 BTC to 1MP9yRbd... and because you used up 4 outputs that add up to way more than that, you must send the change back to yourself.
Electrum automatically chooses an address within your "Change" tab (closed by default) and sends your change to that address. For you, it was 1GimW3XB... We can also tell that 1GimW3XB... is YOUR address, because in a later transaction you send bitcoins FROM it... (so it must obviously be yours)
The next send you performed was for 1 more BTC to 1MP9yRbd6... There were two outputs used as inputs.
(0.1 BTC - Output)
(4.3 BTC - Output)
Notice these are the amounts of the 5th and 6th transactions you RECEIVED. These are used up to send 1 BTC to 1MP9yRbd6... and the change must be sent back to yourself... so Electrum looks at the 2nd Change address (since the 1st Change address already has bitcoins in it) which is 1AzM7CBUFnVF... and sent it back to you.
Then let's look at the final transaction.
This sends the remainder to your 12NKg8... address. (I assume your Coinbase account deposit address)
Look at the outputs it used as inputs:
17cvnT6acns72gZcHb625KrbpF6BnGbeYT (0.11972378 BTC - Output)
17cvnT6acns72gZcHb625KrbpF6BnGbeYT (1.7 BTC - Output)
1GimW3XBE1xtdRET5Dvqdvbz3Y2EEACy27 (3.78027622 BTC - Output)
1AzM7CBUFnVFMP97QcNvHSSBuQ6PWvTVnR (3.4 BTC - Output)
Notice how the first two are the last 2 transactions you received to your original address... AND THEN it used the BTC you sent to the first two Change Addresses in your wallet. (you know they are yours, because if they weren't yours, you wouldn't be able to sign this transaction with their bitcoins. (which it is a confirmed transaction, so obviously, you signed it)
-------------------------
The best way to think of BTC is not a "Balance." but rather think of each BTC transaction you RECEIVE is like a dollar bill in the amount that you received.
If I buy a 2 dollar candy with a 5 dollar bill, the store gives me back 3 dollars, but with bitcoin, I make my own change and send it back to myself after I split up the transactions I've received.
-------------------------
As far as BTC leaving your Coinbase address is concerned, this is not a problem.
Once you give coinbase BTC. They control it for you. So they move the BTC into cold storage almost immediately to prevent hacking. Then they show you a pretty number on your login screen.
Once you give Coinbase BTC, you can no longer trace it on the blockchain, Coinbase owns your coins.
Hi dabura667, Thanks very much for the detailed explanation. I was unnecessarily worried . Now I know how the transactions work. I plan to create a electrum cold storage and will move my coins from coinbase once that is in place.