Foreign investors have net sold over $18 billion of local stocks over the year so far, on track to be the worst yearly outflow on record.