What is wrong with this statement?

I know that there are a lot of similar questions but I just cannot figure it out…

$((#Dk#)>7||(#Dk#)<19)&&((#Dsm#-#Ds#)>=0&&(#Dsm#-#Ds#)<0.08)?100:0$…

It is supposed to show an image out of a series of images between 8 pm and 7am (animation). The eventual goal is to have 2 different animations during day and night hours.

Each of the parts work by themselves:

$(#Dk#)<7||(#Dk#)>19?100:0$ and
$(#Dsm#-#Ds#)>=0&&(#Dsm#-#Ds#)<0.08?100:0$

If I combine those 2 with or without brackets it is not working…

You can’t have more than 2 questions in one condition.

Also for checking day/night, I suggest using #DISDAYTIME# tag.