"老" in "老外" does not mean "old", but a prefix. I think it is a word usually be used before a name, like that in "老李". "外国人" is not a name, but here people use it as a name, so "外" is like a surname, just like "社" and "资" in "姓社还是姓资"[To choose socialism(社会主义) or capitalism(资本主义)]. It is not unfriendly to foreigners. It is a slang using between Chinese. It is neither negative nor positive.
e.g. 看,那边街上有个老外。
It means the speaker feels strange about it, and his words are just statement.
"洋人" is totallymostly a negative word in modern time. It was used in the 19th century. At first it is neither positive nor negative. It means "a person who comes from overseas". "西洋人" means Westerners. "东洋人" means Japanese. There were lots of Westerners in China at thatWhen time flew, a lot of foreigners became the invader, then this word became more and Chinese hate them very much because they are soldiers who were invading Chinamore negative.("八国联军""英法联军"...). Another word is "洋鬼子", it is even more hostile.
e.g. 洋人进入了圆明园,开始凶暴地烧杀抢掠。