Experts: RSI MA EA

 

RSI MA EA:

What I have is an EA working from 2000, but it is not optimized.

The EA works by Moving Average trend and RSI signals at overbought & oversold areas. It doesn't have targets but instead closes with soonest profits, so it's purpose is to always win.

V1 is tested and working on the following pairs & timeframes from 2000.01.01 - 2018.06.30 with tick data suite and 500.00:

  • EURUSD: D1 - H4 - H1 - M30 - M5 (spread of 4)
  • GBPUSD: H1 - M30 - M5 (spread of 6)
  • USDCHF: D1 - H1 (spread of 6)
  • USDJPY: H4 - M30 - M15 (spread of 6)
  • AUDUSD: H4 - M30 (spread of 5)
  • USDCAD: D1, H4 - H1 - M30 (spread of 5)
  • NZDUSD: D1 - H4 - M30 - M15 - M5 (spread of 6)
  • GBPJPY: D1 - H4 - H1 - M30 - M15 - M5 - M1 (spread of 8)
  • USDSGD: D1 - H4 - M15 (spread of 8)
  • AUDCAD: D1 - H1 - M30 - M15 (spread of 8)
  • Possibly more ..

V1 tends to have trades open for extended periods of time and on higher timeframes especially.

RSI MA EA

V2 manages volume and uses lots of margin so it means you need a high leverage to minimize drawdown.

Be sure to use low spread & commission and test with the best data as always.

The inputs include money management and indicator settings; the signals occur when the RSI is in overbought or oversold and price has moved above or below moving average price.

Author: Brian Lillard

 

Hello,

looks good. Is the EA already in a real account?

 
Hello Brian. Thank you so much for the EA. I will be very grateful if you will please look into the warnings that are showing when you compile the EA in Meta Editor and resolve them. I am attaching an image of the warnings below. 
Files:
 
Yes, but not as problematic as not having a max spread variable but could use a retry count and error debug to be on the safe side.
 
Billrhys #:
Hello Brian. Thank you so much for the EA. I will be very grateful if you will please look into the warnings that are showing when you compile the EA in Meta Editor and resolve them. I am attaching an image of the warnings below. 

//HERE =>



//+------------------------------------------------------------------+

#property copyright "Copyright © 2018, Brian Lillard"

#property link "https://www.mql5.com/en/users/subgenius/seller"

#property version   "1.00"

#property strict





enum OptLot{Fixed=0,/*Fixed Lot*/Equity=1,/*% Equity*/Balance=2/*% Balance*/};

//+------------------------------------------------------------------+

input OptLot              LotOption         = Fixed;                     //Lot Value Mode

input double              LotSize           = 0.01;                      //*Fixed Lot

input double              PercentOfBalance  = 0.02;                      //*Percentage of Balance

input double              PercentOfEquity   = 0.03;                      //*Percentage of Equity

//+------------------------------------------------------------------+

input int                 FastMAperiod      = 4;                         //MA Period

input int                 FastMAshift       = 0;                         //MA Shift

input ENUM_MA_METHOD      FastMAmethod      = MODE_LWMA;                 //MA Method

input ENUM_APPLIED_PRICE  FastMAprice       = PRICE_OPEN;                //MA Price

//+------------------------------------------------------------------+

input int                 RSIperiod         = 4;

input ENUM_APPLIED_PRICE  RSIprice          = PRICE_OPEN;

input int                 RSIoverbought     = 80;

input int                 RSIoversold       = 20;

//+------------------------------------------------------------------+

input int                 Magic=1;

//+------------------------------------------------------------------+

int intSellsOpen,intBuysOpen; double CumulativePL;

//+------------------------------------------------------------------+

double dRSI(){return(iRSI(NULL,0,RSIperiod,RSIprice,0));}

double dMA(){return(iMA(NULL,0,FastMAperiod,0,FastMAmethod,FastMAprice,0));}

bool newCandle(){ static datetime nCandle; if(nCandle==Time[0]) return(false); nCandle=Time[0]; return(true); }





//+------------------------------------------------------------------+

void LABEL(string sName,string sText,string sFont,int iFontSize,color cFontColor,int iCorner,int iX,int iY)

  {

   if(ObjectFind(sName)==-1){ ObjectCreate(sName,OBJ_LABEL,0,0,0); }

   else{ if(!IsTesting()){ ObjectDelete(sName);ObjectCreate(sName,OBJ_LABEL,0,0,0); }  }

   ObjectSetText(sName,sText,iFontSize,sFont,cFontColor);

   ObjectSet(sName,OBJPROP_CORNER,iCorner);

   ObjectSet(sName,OBJPROP_XDISTANCE,iX);

   ObjectSet(sName,OBJPROP_YDISTANCE,iY);

  }

//+------------------------------------------------------------------+

int OnInit(){ return(INIT_SUCCEEDED); }

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

  {

   HideTestIndicators(true);

   ObjectDelete("LABEL1");

   ObjectDelete("LABEL2");

   ObjectDelete("LABEL3");

  }

//+------------------------------------------------------------------+

bool OpenOrdersFound()

  {

   intSellsOpen=0; intBuysOpen=0; CumulativePL=0;

   int OrdersOT=OrdersTotal();

   for(int X=0; X<OrdersOT; X++)

     {

      if(!OrderSelect(X,SELECT_BY_POS,MODE_TRADES) || OrderMagicNumber()!=1){continue;}

      if(OrderType()==OP_SELL){ intSellsOpen++; }else if(OrderType()==OP_BUY){ intBuysOpen++; }

      CumulativePL+=OrderProfit()+OrderCommission()+OrderSwap();

     }

   if(intSellsOpen+intBuysOpen>0){ return(true); }

   return(false);

  }

//+------------------------------------------------------------------+

double dNextLot()

  {

   double Lot=LotSize;

   if(LotOption==Equity){ Lot=PercentOfEquity*AccountEquity()/10000; }

   if(LotOption==Balance){ Lot=PercentOfBalance*AccountBalance()/10000; }

   if( Lot<NormalizeDouble(MarketInfo(NULL,MODE_MINLOT),2) ){ Lot=NormalizeDouble(MarketInfo(NULL,MODE_MINLOT),2); }

   if( Lot>NormalizeDouble(MarketInfo(NULL,MODE_MAXLOT),2) ){ Lot=NormalizeDouble(MarketInfo(NULL,MODE_MAXLOT),2); }

   return(Lot);

  }

//+------------------------------------------------------------------+





void OnTick()

  {

   if(!newCandle()){return;}

   OpenOrdersFound();

   if(CumulativePL>0){ CloseAll(); }

   if(dRSI()>=RSIoverbought && Open[0]<dMA())

     {

      if (!OrderSend(NULL,OP_SELL,dNextLot(),NormalizeDouble(Ask,Digits),100,0,0,NULL,Magic,0,clrNONE))

      {

      Print("BUY ORDER FAILED!");

      }

     }

   else

     {

      if(dRSI()<=RSIoversold && Open[0]>dMA())

        {

         if (!OrderSend(NULL,OP_BUY,dNextLot(),NormalizeDouble(Bid,Digits),100,0,0,NULL,Magic,0,clrNONE))

         {

         Print("SELL ORDER FAILED!");

         }

        }

     }

   LABEL("LABEL1","PROFIT & LOSS: "+DoubleToString(CumulativePL,2),"Arial",12,Orange,3,5,35);

   LABEL("LABEL2","EQUITY: "+DoubleToString(AccountEquity(),2),"Arial",12,Orange,3,5,20);

   LABEL("LABEL9","BALANCE: "+DoubleToString(AccountBalance(),2),"Arial",12,Orange,3,5,5);

  }

  

  

  

//+------------------------------------------------------------------+

void CloseAll()

  {

   for(int OrdersOT=OrdersTotal()-1; OrdersOT>=0; OrdersOT--)

     {

      if(!OrderSelect(OrdersOT,SELECT_BY_POS,MODE_TRADES) || OrderMagicNumber()!=1){continue;}

      if (!OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),Magic,clrNONE))

      {

      Print("CLOSE ORDER FAILED");

      }

     }

  }

//+------------------------------------------------------------------+