Why do I get the error in a Scan?

Can someone explain why I get an error message in a scan when the code works in a show bar?

The code is:
// 6R 2
CLOSE(Week(PERIODAMOUNT=1))>MA(Week(PERIODAMOUNT=1), BARS=12, STYLE=Exponential);
and
// 6R 1
// MACD Osc > MACD Average
// Indicates when the MACD Osc is above the MACD Average
MACD() IsUp
and
// 6R 3
STOCH(TYPE=Slow) IsUp and STOCH(TYPE=Slow) > STOCH(DEFAULT=%D, TYPE=Slow);

The error message is in the attachment:

Error-Message.jpg

Your scans are including each criteria to be true. You need to make each criteria change for a signal. Rewrite to MACD cross above and Stoch cross above for a signal. You could use “Signalafter” script as well.