Raster calculator is a wrong tool to do that because it is for map algebra. The mean(my.raster) or sd(my.raster) expressions return my_raster (not the constants that you are hoping). For this reason, your expression (my.raster-mean(my.raster))/sd(my.raster) will be evaluated to 0 for each pixel.
At the below image you can see that any "function" it will be "valid" and it will return the same raster.
As it was pointed out by Michael, you need to evaluate mean and standard deviation constants first by other methods. You can do that with GDAL-python, PyQGIS or R (with rgdal o raster libraries).
Next, one example with PyQGIS:
For the complete process, you need to adapt this solution:
Qgis raster calculator not giving output
Editing Note:
The complete solution is this:
from qgis.analysis import QgsRasterCalculator, QgsRasterCalculatorEntry
layer = iface.activeLayer()
entries = []
# Define band1
band1 = QgsRasterCalculatorEntry()
band1.ref = 'band@1'
band1.raster = layer
band1.bandNumber = 1
entries.append( band1 )
renderer = layer.renderer()
provider = layer.dataProvider()
extent = layer.extent()
stats = provider.bandStatistics(1, QgsRasterBandStats.All,extent, 0)
myMean = stats.mean
myStdDev = stats.stdDev
myFormula = '(band@1 -' + str(myMean) +')/' + str(myStdDev)
print "mean = ", myMean
print "stdev = ", myStdDev
# Process calculation with input extent and resolution
calc = QgsRasterCalculator( myFormula,
'/home/zeito/pyqgis_data/outputfile.tif',
'GTiff',
layer.extent(),
layer.width(),
layer.height(),
entries )
calc.processCalculation()
It works nicely.