The ADX (Average Directional Movement Index) is an indicator of how much the market is trending, either up or down: the higher the ADX line, the more the market is trending and the more suitable it becomes for a trend-following system.
BUY : When RSI crossed above 53 line and ADX greater than 25.
SELL : When RSI crossed above 80 line and ADX greater than 25.
BUY{ set rs = RSI(CLOSE,17); set ad = ADX(14); CROSSOVER(rs,53) and ad>25;} LONGEXIT{ set rs = RSI(CLOSE,17); set ad = ADX(14); crossover(rs,80) and ad>25;}