The crossOver/Under bug is likely to come up when you're dealing with discrete variables. For example, a newcomer might expect the following to work:
Code:
function run() {
  StartDate = 20140715;
  EndDate = 20140716;
  BarPeriod = 15;
  asset("EUR/USD");
  // This won't do what you want. Don't do this!
  if (crossOver(series(hour()), 12.0)) {
    printf("\n%d Hour 13 struck!", Bar);
  }
}


Someone unfamiliar with this bug might expect that this strategy would print a line (or perform some action) once per day upon encountering the first bar in hour 13. But, it doesn't. The condition is never true because hour() is discrete. It spends some time (4 bars) at 12 before advancing to 13.

There are other discrete built-ins. NumRiseFall, MinMaxIndex, etc.

Last edited by GPEngine; 08/13/14 16:38.