iRSI doesn't work well

 

BuyPoint:20 and SellPoint:80 for EURCHF

 when the rsi touches the buypoint or sellpoint, order is opened. however, when this opened order is closed, although rsi doesn't touches the buypoint or sellpoint, immediately another order is opened for eurchf

how can i fix it

parameter 

   extern int       AppliedPrice=4;

 bar checks

   double RSInow=iRSI(NULL,0,RSIperiod,AppliedPrice,0);
   double RSIlast=iRSI(NULL,0,RSIperiod,AppliedPrice,1);
   double RSIprev=iRSI(NULL,0,RSIperiod,AppliedPrice,2);

 opening criteria

// Open buy
   if((RSInow>BuyPoint) && (RSIlast<BuyPoint) && (RSIprev<BuyPoint) && (halt1!=1) && (TradeTimeOk==1))
     {
      int openbuy=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,0,0,"RSI Trader Buy Order",MagicNumber1,0,Blue);
      if(CloseOnOpposite==true)closesell=1;
     }

// Open sell
   if((RSInow<SellPoint) && (RSIlast>SellPoint) && (RSIprev>SellPoint) && (halt2!=1) && (TradeTimeOk==1))
     {
      int opensell=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,0,0,"RSI Trader Sell Order",MagicNumber2,0,Green);
      if(CloseOnOpposite==true)closebuy=1;
     }
 
You can fix this by limiting the number of orders.
Check the number of orders that is opened.
 
Just additional suggestion. you should check different time frame RSI. at least 2 RSI settings.

e.g. RSI from 15 min and RSI from 1 HR. or RSI from 4HR
 
I think the RSIperiod is too fast, try biiger for RSIperiod.

or you can chnge like below


double RSInow=iRSI(NULL,0,RSIperiod,AppliedPrice,1);
   double RSIlast=iRSI(NULL,0,RSIperiod,AppliedPrice,2);
   double RSIprev=iRSI(NULL,0,RSIperiod,AppliedPrice,3);
 
Siti Latifah:
I think the RSIperiod is too fast, try biiger for RSIperiod.

or you can chnge like below


Yes, this might be solution I think.
Reason: