Hi guys,
I only recently started to use Zorro for backtesting my trading idea's but I've fallen in love with it immediately
. However, I'm having trouble with using EMA, while other indicators don't cause any problems. However, if I use the following code snippet, it doesn't matter whether I use 'EMA50 > EMA200' or 'EMA50 < EMA200', backtest result is the same. Yet, if I look at the chart there are trades both when EMA50 is higher and when it's lower dan EMA200.
vars Price = series(priceClose());
vars EMA50 = series(EMA(Price, 50));
vars EMA200 = series(EMA(Price, 200));
vars Macd = series(MACD(Price, 12, 26, 9));
var *MacdHist = series(rMACDHist);
if (!TradeIsOpen && EMA50 > EMA200 && crossOver(MacdHist, 0)){
enterLong();
}
else if (TradeIsOpen && crossOver(MacdHist, 0)){
exitLong();
}
So I'm certainly making a mistake with using EMA indicator (Zorro doesn't give any error messages). Does anybody know what I'm doing wrong? Thanks in advance!