Why this code does not work?

I want to generate buy signal at MACD crossover provided there is no reverse crossover in last 10 days. what is wrong with this code? It does not work.

CROSSOVER(MACD(12, 26, 7, EXPONENTIAL), MACDSignal(12, 26, 7, EXPONENTIAL)
and
LASTIF(CROSSOVER(MACDSignal(12, 26, 7, EXPONENTIAL), MACD(12, 26, 7, EXPONENTIAL)) > 10

if you want to use LASTIF  try the below modified code

CROSSOVER(MACD(12, 26, 7, EXPONENTIAL), MACDSignal(12, 26, 7, EXPONENTIAL)
AND
LASTIF( MACD(12, 26, 7, EXPONENTIAL)>MACDSignal(12, 26, 7, EXPONENTIAL)) > 10

Nope, Is there any other way to achieve the requirement?

what is your condition exactly? is lastif mandatory?

I wish to avoid whipsaws due to frequent crossovers during trading range. I want to trade on clean crossover signals… It may reduce the number of trades. So I want to check if there has been a recent crossover of MACDsignal over MACD, in which case I want to skip the trade. 10 day period is chosen as random number which need to be changed.
I tried using REF function like
REF(MACD(12, 26, 7, EXPONENTIAL),1) < REF(MACDSignal(12, 26, 7, EXPONENTIAL),1)
and
REF(MACD(12, 26, 7, EXPONENTIAL),2) < REF(MACDSignal(12, 26, 7, EXPONENTIAL),2)
and
REF(MACD(12, 26, 7, EXPONENTIAL),3) < REF(MACDSignal(12, 26, 7, EXPONENTIAL),3)
and
REF(MACD(12, 26, 7, EXPONENTIAL),4) < REF(MACDSignal(12, 26, 7, EXPONENTIAL),4)
etc, But this code seems to hang & I need to restart Pi.
Ofcourse LASTIF is not mandatory if this condition can be implemented in any other way.