Hi,
The choice of colours for that sensor are very misleading.
An industry standard is RED = Positive Supply, BLUE = GND Supply, BLACK = Negative Supply, WHITE or YELLOW = Signal.
In this case see below.
And as suggested, use a pullup resistor.
Tom..