The first sentence is OK, but if you want to locate it in the past, sou should try 'had been able to', rather than 'could have spoken', whihc exists in some regional varieties, but is generally considered non-standard.
If I could speak good English, I could have lived in America.
The sentence is grammatically correct but it doesn't make much sense to me because it is neither a necessity nor an obligation for anybody to speak good English in order to live in America. In any case, not all Americans speak good English, including the ones born there. It sounds like the statement below :-
"If I could breathe in water, I could have lived like a fish in the bottom of the ocean." (The ability to breathe in water is a necessity in order to live underwater like a fish)
I think the original sentence should be written as :- "If I could speak good English, I would have lived in/stayed in/immigrated to/ etc. America." (I believe this is what the writer wishes to express in his sentence.)