The loss for B can be used to write off the gain for A. You will fill out a schedule 3 with cost base and proceeds of disposition. This will give you a $0 capital gain for the year and an amount of $5 (50% of the $10 loss) you can carry forward to offset future capital gains. You can also file a T1-a and carry the losses back up to 3 years if you're so inclined. It can't be used to offset other income (unless you die).
Your C and D trades can't be on income account except for very unusual circumstances. It's not generally acceptable to the CRA for you to use 2 separate accounting methods. There are some intricacies but you should probably just use capital gains.
There is one caveat that if you do short sales of Canadian listed securities, they will be on income account unless you fill out form T-123 and elect to have them all treated as capital gains.
I just remembered one wrinkle in carrying forward capital losses. They don't reduce your capital gains anymore, but they reduce your taxable income. This means your net income won't be reduced and any benefits that are calculated from that (line 236), will not get an increase.