hugh, the crossUnder/crossOver enters when the EMAs cross. Why do you also have the 3rd & 4th conditions? Those say "if EMA5 is above/below EMA8 in this bar & previous bar, go long/short." One or the other of those tests will be true on almost every bar -- basically every bar where the crossOver/crossUnder test isn't true! So unless I'm misunderstanding something, that code will trigger an entry on every single bar!?