Metrics for same signal Is there a metric in tensorflow.keras.metrics that counts how many time the predicted output and the real output have the same signal?

For example, if the y_pred = [-0.1, 0.3, -0.22, -1] and y_val = [-1.3, 1.2, 0.5, -2], then the output should be 0.75.

I am working on a project that takes as input, along with other features, a column of real values around 0, and should predicted if the next elements of this column should be negative or positive (regardless of their absolute value). As it's only logical, I am using tanh as the activation function, but if I use as metrics accuracy or binary_accuracy, the output is always zero.
It is better to formulate this problem in terms of classification, not regression. For example, you can apply sign transformation on your labels (e.g. $y = numpy.sign(y)$) before training the model, then fit the model with classification loss (like binary cross-entropy), and then you can use accuracy for measuring the performance. Using accuracy with regression setup outputs zero because comparing real numbers usually outputs False (like 1.2 != 1.19).