New User - EMA Crossover

Posted By: rjcarey99

New User - EMA Crossover - 08/16/16 13:43

Hi all, I'm a new Zorro user and am currently learning the platform.
I'm an experienced trader but not such a great coder.

For a little fun I tried to implement an EMA Crossover strategy and wondered if you guys can spot any issue with my code as the results aren't what I would expect......

function run()
{
set(PARAMETERS);

var* Price = series(price());
var* EMASHORT = series(EMA(Price,5));
var* EMALONG = series(EMA(Price,10));

if(crossOver(EMASHORT,EMALONG))
enterLong();
else if(crossUnder(EMALONG,EMASHORT))
exitLong();


if(crossOver(EMALONG,EMASHORT))
enterShort();
else if(crossUnder(EMASHORT,EMALONG))
exitShort();
}

Many thanks
Richard
© 2023 lite-C Forums