How to get signal from indicator RSI for BUY or SELL by EA?

 
I have two indicators RSI(13) and RSI(42). if RSI(13)-RSI(42)>=10 is BUY...etc. How to code a EA do it. thanks a lots
 
 
akira.nguyen:
I have two indicators RSI(13) and RSI(42). if RSI(13)-RSI(42)>=10 is BUY...etc. How to code a EA do it. thanks a lots

How to code? Start here https://www.mql5.com/en/articles/1514

When you have digested this article, the following framework may be useful to you.

It is based on the principle of breaking up your code into numerous small functions.

When each function is proven to work, you forget about it and concentrate on the logic of your EA.

ALL of the functions mentioned in the framework have been discussed in this forum and are available for free.

But YOU have to do the legwork to track them down. Best wishes, Helmut

int start()
{
   if( IsTradeAllowed() != true ){
      return(0);
   }
   
   // first set the global variables your functions need to know, for example...
   RSI13 = iRSI(NULL,0,13,PRICE_CLOSE,0);
   RSI42 = iRSI(NULL,0,42,PRICE_CLOSE,0);
   
   count_positions(); // returns the number of open positions (you may have to search for "Open Positions" etc.)
   if( numPos > 0){
      CheckForClose(); // tests your conditions for exiting and calls closing functions
      SetTrailingStops(); // tests if stops should be adjusted for any open positions
   }
   else // prevents adding more positions (optional)
   {
      if( LastSignal != Time[0] && stoptrading == false ) 
      // reset extern "stoptrading" to true to keep the EA running without taking new positions
      {
         if( get_signal() == true ) // tests your entry conditions and sets Buy and/or Sell signals
         {
           SetStops();// sets stop-loss (sl) and take-profit (tp) levels
           Call_MM(sl);// sets Lots based on capital and risk tolerance
           if (Lots > 0)
           {
             if( Buy == true ) OpenLong(Lots);
             if( Sell == true ) OpenShort(Lots);
           }
           LastSignal = Time[0];
         }
      }
   }
   return(0);
}
 
WHRoeder:
iRSI

Well, no response from the OP (original poster).

We should have remembered Mathew 7:6 "neither cast ye your pearls before swine".

 
engcomp:

We should have remembered Mathew 7:6 "neither cast ye your pearls before swine".

How true indeed.
Reason: