In this line:
$filename = "pricealerts.csv\";
The backslash is escaping the quotation mark, so php doesn't think that quoted string is closed until it reaches the first quotation mark in this line:
$string_to_add = "$wpusername,$symbol,$type,$alert,$trigger,$price,\n";
At which point, it sees $wpusername as an unexplained variable.