Code for MT-3 RSI

 
What would the code be???? I can't figure out this code to add to my EA can someone help me please

RSI: buy when RSI is above 50

Stochastic: Osc Buy when Stoch is above 50


RSI: sell when RSI is below 50

Stochastic Osc; sell when Stochastic is below 50

Thank You
Mike
 
here is an example:

/*[[
	Name := StochRSI X
	Author := Copyright © 2002, MetaQuotes Software Corp.
	Link := http://www.metaquotes.ru
	Notes := 
	Lots := 1
	Stop Loss := 0
	Take Profit := 25
	Trailing Stop := 15
]]*/
defines: rsiperiod(14);
defines: KPeriod(8),Dperiod(3),Slowing(3);

var:     RSICurrent(0),RSIPrevious(0),StochCurrent(0),StochPrevious(0);
var:     cnt(0);

If Bars<200 or TakeProfit<10 then Exit;  // less than 200 bars on the chart

RSICurrent   =iRSI(rsiperiod,0);
RSIPrevious  =iRSI(rsiperiod,1);
StochCurrent =iSto(Kperiod,Dperiod,Slowing,MODE_LWMA,MODE_MAIN,0);
StochPrevious=iSto(Kperiod,Dperiod,Slowing,MODE_LWMA,MODE_MAIN,1);

If TotalTrades<1 then
  {
   If FreeMargin<1000 then Exit;  // no money - we exit   
// checking for the possibility of taking a long position (BUY)
  If StochCurrent>50 and StochPrevious<50 and RSICurrent>50 and
      RSIPrevious<50 then     
     {
      SetOrder(OP_BUY,Lots,Ask,3,0,Ask+TakeProfit*Point,RED); // executing
      Alert("Buy ",Symbol());
      Exit; // exiting, since after the execution of a trade             
            // there is a 10-second trading timeout
     };   
// checking for the possibility of taking a short position (SELL)
   If StochCurrent>50 and StochPrevious<50 and RSICurrent>50 and // checking for the possibility of taking a short position (SELL)
      RSIPrevious<50 then
     {
      SetOrder(OP_SELL,Lots,Bid,3,0,Bid-TakeProfit*Point,RED); // executing       
      Alert("Sell ",Symbol());
      Exit; // exiting
	 };
   Exit; 
  };

for cnt=1 to TotalTrades  
  {
   if OrderValue(cnt,VAL_TYPE)<=OP_SELL and   // is this an open position? OP_BUY or OP_SELL       
      OrderValue(cnt,VAL_SYMBOL)=Symbol then  // does the instrument match?     
     {
      If OrderValue(cnt,VAL_TYPE)=OP_BUY then // long position opened         
        {         
         // we check - maybe, it's already time to close it?         
         If StochCurrent<75 and StochPrevious>75 then           
           {
            CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_LOTS),Bid,3,Violet);             
            Exit; // exiting           
           };

         // we check - maybe, we already may or it's already time to set a trailing stop?         
         If TrailingStop>0 then  // the user has put a trailing stop in his settings           
           {                     // so, we set out to check it            
            If(Bid-OrderValue(cnt,VAL_OPENPRICE))>(Point*TrailingStop) then              
              {               
               If OrderValue(cnt,VAL_STOPLOSS)<(Bid-Point*TrailingStop) then                 
                 {
                  ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE),
                              Bid-Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROFIT),Red);
                  Exit;                 
                 };              
              };           
           };
        }
      else // otherwise it is a short position
        {
         // we check - maybe, it's already time to close it?         
         If StochCurrent>25 and StochPrevious<25 then            
           {
            CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_LOTS),Ask,3,Violet);             
            Exit; // exiting            
           };
         
         // we check - maybe, we already may or it's already time to set a trailing stop?         
         If TrailingStop>0 then  // the user has put a trailing stop in his settings             
           {
            // so, we set out to check it             
            If(OrderValue(cnt,VAL_OPENPRICE)-Ask)>(Point*TrailingStop) then             
              {
               If OrderValue(cnt,VAL_STOPLOSS)=0 or 
                  OrderValue(cnt,VAL_STOPLOSS)>(Ask+Point*TrailingStop) then
                 {
                  ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE),
                              Ask+Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROFIT),Red);
                  Exit;
                 };
              };
           };
        };
     };
  };
// the end.
 
Ok tahnk you but what I do not understand is where these codes will go in my script???
/*[[
	Name := Turbo Trader
	Author := Mike Mckeough
	Link := Coded_by_FXFisherman_ZeroCode_@www.fxfisherman.com
	Lots := 1
	Stop Loss := 10
	Take Profit := 10
	Trailing Stop := 10
]]*/
defines: Slippage(3);
defines: ; 
var: cnt(0),IsBuying(False),IsSelling(False),IsClosing(False),RealTP(0),RealSL(0);
var: rsi3_1(0),rsi3_0(0),stoc4d_1(0),stoc4d_0(0),stoc4k_1(0),stoc4k_0(0),ma1_1(0),ma1_0(0),ma2_1(0),ma2_0(0);

// Check for invalid bars and takeprofit
If Bars<200 then Exit;

// Calculate indicators' value
rsi3_1 = iRSI(20,1);
rsi3_0 = iRSI(20,0);
stoc4d_1 = iSTO(21,6,6,MODE_SMA,MODE_SIGNAL,1);
stoc4d_0 = iSTO(21,6,6,MODE_SMA,MODE_SIGNAL,0);
stoc4k_1 = iSTO(21,6,6,MODE_SMA,MODE_MAIN,1);
stoc4k_0 = iSTO(21,6,6,MODE_SMA,MODE_MAIN,0);
ma1_1 = iMAEx(10,MODE_LWMA,0,PRICE_CLOSE,1);
ma1_0 = iMAEx(10,MODE_LWMA,0,PRICE_CLOSE,0);
ma2_1 = iMAEx(10,MODE_SMA,0,PRICE_CLOSE,1);
ma2_0 = iMAEx(10,MODE_SMA,0,PRICE_CLOSE,0);


// Check for BUY, SELL, and CLOSE signal
IsBuying = (ma1_1 <= ma2_1)
 and (ma1_0 > ma2_0);
IsSelling = (ma1_1 >= ma2_1)
 and (ma1_1 < ma2_0);
IsClosing = False;

// Control open trades
for cnt=1 to TotalTrades
  {
   // Control only market trades not entry order
   if OrderValue(cnt,VAL_TYPE)<=OP_SELL and
      OrderValue(cnt,VAL_SYMBOL)=Symbol then
     {
     
      // Check for close signal for bought trade
      If OrderValue(cnt,VAL_TYPE)=OP_BUY then
  		{
                  
         If IsSelling or IsClosing then
     	   {
     	    // Close bought trade
            CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_LOTS),Bid,3,Violet);
            Alert("Turbo Trader: Closing BUY order.");
     	   };
         
         // Check trailing stop
         If TrailingStop>0 then
		   {                   
            If (Bid-OrderValue(cnt,VAL_OPENPRICE))>(Point*TrailingStop) then
        	  {
               If OrderValue(cnt,VAL_STOPLOSS)<(Bid-Point*TrailingStop) then
           	     {
           	      // Modify trailing stop
                  ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE),
                              Bid-Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROFIT),Red);        
           		 };
           	  };
           };
  		}
  	  else
  	  	{
         
         // Check sold trade for close signal
         If IsBuying or IsClosing then
     	   {
            CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_LOTS),Ask,3,Violet); 
            Alert("Turbo Trader: Closing SELL order.");
     	   };
         
         // Control trailing stop
         If TrailingStop>0 then
     	   {
            If (OrderValue(cnt,VAL_OPENPRICE)-Ask)>(Point*TrailingStop) then
        	  {
               If OrderValue(cnt,VAL_STOPLOSS)=0 or 
                  OrderValue(cnt,VAL_STOPLOSS)>(Ask+Point*TrailingStop) then
           	     {
                  ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE),
                              Ask+Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROFIT),Red);
           		 };
        	  };
     	   };
     	};
  	 };
  };
  
  
// If there is no open trade
If TotalTrades<1 then
  {
   // If we have enough money for 1 lot
   If FreeMargin<1000 then Exit;  

   // Check for BUY entry signal
   If IsBuying and IsSelling=False and IsClosing=False then
     {
      // Buy
      If StopLoss>0 then
      {
      	RealSL=Ask-StopLoss*Point;
      }   
      If TakeProfit>0 then
      {
      	RealTP=Ask+TakeProfit*Point;
      }        
      SetOrder(OP_BUY,Lots,Ask, Slippage,RealSL,RealTP,RED);
      Alert("Turbo Trader: Buying"); 
     };
   
   // Check for SELL entry signal
   If IsSelling and IsBuying=False and IsClosing=False then
     {
      // Sell
	  If StopLoss>0 then
      {
      	RealSL=Bid+StopLoss*Point;
      }   
      If TakeProfit>0 then
      {
      	RealTP=Bid-TakeProfit*Point;
      }    
      SetOrder(OP_SELL,Lots,Bid,Slippage,RealSL,RealTP,RED);
      Alert("Turbo Trader: Selling");
     };
  };
  
  
//-------------- Coded by FXFisherman ZeroCode v1.0.2014.30845
 
something like this:

/*[[
	Name := Turbo Trader
	Author := Mike Mckeough
	Link := Coded_by_FXFisherman_ZeroCode_@www.fxfisherman.com
	Lots := 1
	Stop Loss := 10
	Take Profit := 10
	Trailing Stop := 10
]]*/
defines: Slippage(3);
defines: ; 
var: cnt(0),IsBuying(False),IsSelling(False),IsClosing(False),RealTP(0),RealSL(0);
var: rsi3_1(0),rsi3_0(0),stoc4d_1(0),stoc4d_0(0),stoc4k_1(0),stoc4k_0(0),ma1_1(0),ma1_0(0),ma2_1(0),ma2_0(0);

// Check for invalid bars and takeprofit
If Bars<200 then Exit;

// Calculate indicators' value
rsi3_1 = iRSI(20,1);
rsi3_0 = iRSI(20,0);
stoc4d_1 = iSTO(21,6,6,MODE_SMA,MODE_SIGNAL,1);
stoc4d_0 = iSTO(21,6,6,MODE_SMA,MODE_SIGNAL,0);
stoc4k_1 = iSTO(21,6,6,MODE_SMA,MODE_MAIN,1);
stoc4k_0 = iSTO(21,6,6,MODE_SMA,MODE_MAIN,0);
ma1_1 = iMAEx(10,MODE_LWMA,0,PRICE_CLOSE,1);
ma1_0 = iMAEx(10,MODE_LWMA,0,PRICE_CLOSE,0);
ma2_1 = iMAEx(10,MODE_SMA,0,PRICE_CLOSE,1);
ma2_0 = iMAEx(10,MODE_SMA,0,PRICE_CLOSE,0);


// Check for BUY, SELL, and CLOSE signal
IsBuying = (ma1_1 <= ma2_1) and (ma1_0 > ma2_0) and (stoc4k_0 > 50) and (stoc4k_1 < stoc4k_0) and 
(rsi3_0 > 50) and (rsi3_1 < rsi3_0);
IsSelling = (ma1_1 >= ma2_1) and (ma1_1 < ma2_0) and (stoc4k_0 < 50) and (stoc4k_1 > stoc4k_0) and 
(rsi3_0 < 50) and (rsi3_1 > rsi3_0);
IsClosing = False;

// Control open trades
for cnt=1 to TotalTrades
  {
   // Control only market trades not entry order
   if OrderValue(cnt,VAL_TYPE)<=OP_SELL and
      OrderValue(cnt,VAL_SYMBOL)=Symbol then
     {
     
      // Check for close signal for bought trade
      If OrderValue(cnt,VAL_TYPE)=OP_BUY then
  		{
                  
         If IsSelling or IsClosing then
     	   {
     	    // Close bought trade
            CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_LOTS),Bid,3,Violet);
            Alert("Turbo Trader: Closing BUY order.");
     	   };
         
         // Check trailing stop
         If TrailingStop>0 then
		   {                   
            If (Bid-OrderValue(cnt,VAL_OPENPRICE))>(Point*TrailingStop) then
        	  {
               If OrderValue(cnt,VAL_STOPLOSS)<(Bid-Point*TrailingStop) then
           	     {
           	      // Modify trailing stop
                  ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE),
                              Bid-Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROFIT),Red);        
           		 };
           	  };
           };
  		}
  	  else
  	  	{
         
         // Check sold trade for close signal
         If IsBuying or IsClosing then
     	   {
            CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_LOTS),Ask,3,Violet); 
            Alert("Turbo Trader: Closing SELL order.");
     	   };
         
         // Control trailing stop
         If TrailingStop>0 then
     	   {
            If (OrderValue(cnt,VAL_OPENPRICE)-Ask)>(Point*TrailingStop) then
        	  {
               If OrderValue(cnt,VAL_STOPLOSS)=0 or 
                  OrderValue(cnt,VAL_STOPLOSS)>(Ask+Point*TrailingStop) then
           	     {
                  ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE),
                              Ask+Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROFIT),Red);
           		 };
        	  };
     	   };
     	};
  	 };
  };
  
  
// If there is no open trade
If TotalTrades<1 then
  {
   // If we have enough money for 1 lot
   If FreeMargin<1000 then Exit;  

   // Check for BUY entry signal
   If IsBuying and IsSelling=False and IsClosing=False then
     {
      // Buy
      If StopLoss>0 then
      {
      	RealSL=Ask-StopLoss*Point;
      }   
      If TakeProfit>0 then
      {
      	RealTP=Ask+TakeProfit*Point;
      }        
      SetOrder(OP_BUY,Lots,Ask, Slippage,RealSL,RealTP,RED);
      Alert("Turbo Trader: Buying"); 
     };
   
   // Check for SELL entry signal
   If IsSelling and IsBuying=False and IsClosing=False then
     {
      // Sell
	  If StopLoss>0 then
      {
      	RealSL=Bid+StopLoss*Point;
      }   
      If TakeProfit>0 then
      {
      	RealTP=Bid-TakeProfit*Point;
      }    
      SetOrder(OP_SELL,Lots,Bid,Slippage,RealSL,RealTP,RED);
      Alert("Turbo Trader: Selling");
     };
  };
  
  
//-------------- Coded by FXFisherman ZeroCode v1.0.2014.30845
 
Yes This is exactly what I am looking to do.
Thank You Very, Much I appreciate your help

Mike