I written a program for automated trading and use this below indicator logic as a condition to put the trade. It used to work fine till last week but from today onwards its not working. In other words, it is not returning 1 when the last ten candles close price consistently above EMA20.
When i tested it further, until i check last four candles(including the current one) it works perfectly but when i increase it to last five candles it is giving abnormal results.. attached some screenshots related to this.
Lost quite a bit of money because of abnormal trades system put in. So, Any insight into this will be much appreciated.