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!?
Hi, yes, that is correct. The idea is that on long trends you will make significant money and on the whipsaws you will lose small. As I said this isn't intended to be a system that I would trade myself but more a way to develop my coding skills.