I need a rsi ea

hello all traders ,

I need a rsi ea and I need two different ones I think . I need the rsi just to exit the trade . When I am long I want ea exıt my trade when rsi (14 weıghted close)
crosses 70 and when I am short I want ea exit my trade when rsi crosses 30 . İs it possible to build something like thiss ??

Pretty simple … this code will close the first open trade it finds when the RSI hits the levels you requested. Put it on the time frame you want the RSI computed on, enable live trading, and if you don’t see a smiley face in the upper right hand corner you have something set wrong. If you have more than one trade open, it becomes a lot more complicated and is beyond the scope of a post to explain.

To build your EA, run the built in MetaEditor Wizard, tell it to make an EA, give it a name, copy this code from the start function over the blank start function, compile it (if you get errors you have done something wrong as it compiles fine for me), put it on the chart / timeframe you want after the trade is open. UNTESTED so you are on your own. Test on demo first.

int start()
{
bool result;
double price;
int cmd,error;

if(iRSI(NULL,0,14,PRICE_CLOSE,0)==30 || iRSI(NULL,0,14,PRICE_CLOSE,0)==70)

{

if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES))
{
cmd=OrderType();
//---- first order is buy or sell
if(cmd==OP_BUY || cmd==OP_SELL)
{
while(true)
{
if(cmd==OP_BUY) price=Bid;
else price=Ask;
result=OrderClose(OrderTicket(),OrderLots(),price,3,Red);
if(result!=TRUE) { error=GetLastError(); Print("LastError = ",error); }
else error=0;
if(error==135) RefreshRates();
else break;
}
}
}
else Print( "Error when order select ", GetLastError());
return(0);
}

return(0);

}