Hi
I am new to PI and trading altogether, so pardon me if there is something wrong in the query. So essentially I am backtesting a code on PI. The buy code is as below:
(
EMA(CLOSE,21)>EMA(CLOSE,9) AND
(REF(EMA(CLOSE,21),2) - REF(EMA(CLOSE,9),2)) > (REF(EMA(CLOSE,21),1) - REF(EMA(CLOSE,9),1)) AND
(REF(EMA(CLOSE,21),1) - REF(EMA(CLOSE,9),1)) > (EMA(CLOSE,21)-EMA(CLOSE,9)) AND
(REF(EMA(CLOSE,21),3) - REF(EMA(CLOSE,9),3)) > (REF(EMA(CLOSE,21),2) - REF(EMA(CLOSE,9),2)) AND
(EMA(CLOSE,21)-EMA(CLOSE,9)) < 0.5*(REF(EMA(CLOSE,21),3) - REF(EMA(CLOSE,9),3))
)
OR
CROSSOVER(EMA(CLOSE,9),EMA(CLOSE,21))
Leaving everything else apart, there is a crossover condition, which should get triggered at each crossover. I was testing this with ITC’s daily chart for the past 30 months bu the ‘LONG’ trades missed a crossover on May 17, 2017. Snapshot of the results:
So I wanted to know if there’s an error on my part or does this happen while backtesting a code?
Thanks in Advance.