Ma crossover code

 
Hi guys, I've found this video about how to code moving average crossover. I want to know why it needs the previous candle crossover (lastSlowMovingAv erage and lastFastMovingAverage variable in the video) to make the code works?
MQL4 Tutorial - Simple Moving Average Crossover Expert Advisor
MQL4 Tutorial - Simple Moving Average Crossover Expert Advisor
  • www.youtube.com
https://mql4tutorial.com With MQL4 for Metatrader you can program a Simple Moving Average Crossover Expert Advisor for automated trading. With a few lines of...
 
A cross is an X, four end points.
double aPrev = …, aCurr = …,
       bPrev = …, bCurr = …;
bool   wasUp = aPrev > bPrev,
        isUp = aCurr > bCurr,
       isCross = isUp != wasUp;
How would you test for a cross with two? Slow<Fast is considered an uptrend (one or many bars.) It isn't cross.
Reason: