I would be appreciative if a signal based on the below criteria could be coded:
Rules for a Long Trade
1) Look for currency pair to be trading below the 20-period EMA and MACD to be negative
2) Wait for price to cross above the 20-period EMA, make sure that MACD is either in the process of crossing from negative to positive or have crossed into positive territory no longer than 5 bars ago
3) Go long 10 pips above the 20-period EMA
Rules for a Short Trade
1) Look for currency pair to be trading above the 20-period EMA and MACD to be positive
2) Wait for price to cross below the 20-period EMA, make sure that MACD is either in the process of crossing from positive to negative or have crossed into negative territory no longer than 5 bars ago
3) Go short 10 pips below the 20-period EMA
Indicators used ; 20 EMA and MACD Histogram first EMA = 12, second EMA = 26, Signal EMA = 9