Hi, I need someone who can create an EA that trades by RSI divergence (Zigzag included preferred)

Trabajo finalizado

Plazo de ejecución 10 días
Comentario del Cliente
Hooman is a great programmer, he is patient and professional, will work with him again in the future.
Comentario del Ejecutor
He is so responsible and I had a good job I hope to work with you in another job.

Tarea técnica

Hi, I am trying to create an EA that trades by RSI divergence, I tried coding it as below but when I run it in backtest, the backtest ends in less than a second. I would like a functional EA based on this code that all I need was to change the numerical parameters to make it work for me. My trade logic is simple, I would like to be able to trend when the latest PeakPrice > last PeakPrice (note: latest doesn't have to be current, but last means the one before the latest) && rsi(latest_peak)<rsi(last_peak) and when the latest TroughPrice< last TroughPrice && rsi(latest_trough)>rsi(last_trough). It would be great if you can include Zigzag in finding the Peak and Trough. Attached is the technical indicators I would like my EA to base on (it didn't include a Zigzag though).

//+------------------------------------------------------------------+
//|                                                       RSI EA.mq4 |
//|                        Copyright 2015, MetaQuotes Software Corp. |
//|                           http://free-bonus-deposit.blogspot.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, dXerof"
#property link      "http://free-bonus-deposit.blogspot.com"
#property version   "1.00"
#property strict

#define arrowsDisplacement 0.0003

input bool   OpenBUY=True;
input bool   OpenSELL=True;
input bool   CloseBySignal=True;
input double StopLoss=0;
input double TakeProfit=0;
input double TrailingStop=0;
input int    RSIperiod=14;
input double BuyLevel=30;
input double SellLevel=70;
input bool   AutoLot=True;
input double Risk=1;
input double ManualLots=0.1;
input int    MagicNumber=123;
input string Koment="RSIea";
input int    Slippage=10;

input ENUM_APPLIED_PRICE    RSI_applied_price                = 0;

//---- buffers

double rsi[];


//----

//---
int OrderBuy,OrderSell;
int ticket;
int LotDigits;

double Trail,iTrailingStop;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {

   double stoplevel=MarketInfo(Symbol(),MODE_STOPLEVEL);
   OrderBuy=0;
   OrderSell=0;
   for(int cnt=0; cnt<OrdersTotal(); cnt++)
     {
      if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES))
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber && OrderComment()==Koment)
           {
            if(OrderType()==OP_BUY) OrderBuy++;
            if(OrderType()==OP_SELL) OrderSell++;
            if(TrailingStop>0)
              {
               iTrailingStop=TrailingStop;
               if(TrailingStop<stoplevel) iTrailingStop=stoplevel;
               Trail=iTrailingStop*Point;
               double tsbuy=NormalizeDouble(Bid-Trail,Digits);
               double tssell=NormalizeDouble(Ask+Trail,Digits);
               if(OrderType()==OP_BUY && Bid-OrderOpenPrice()>Trail && Bid-OrderStopLoss()>Trail)
                 {
                  ticket=OrderModify(OrderTicket(),OrderOpenPrice(),tsbuy,OrderTakeProfit(),0,Blue);
                 }
               if(OrderType()==OP_SELL && OrderOpenPrice()-Ask>Trail && (OrderStopLoss()-Ask>Trail || OrderStopLoss()==0))
                 {
                  ticket=OrderModify(OrderTicket(),OrderOpenPrice(),tssell,OrderTakeProfit(),0,Blue);
                 }
              }
           }
     }
   double rsim1=iRSI(Symbol(),1,RSIperiod,PRICE_CLOSE,1);
   double rsim5=iRSI(Symbol(),5,RSIperiod,PRICE_CLOSE,1);
   double rsim15=iRSI(Symbol(),15,RSIperiod,PRICE_CLOSE,1);
   double rsim30=iRSI(Symbol(),30,RSIperiod,PRICE_CLOSE,1);
   double rsim60=iRSI(Symbol(),60,RSIperiod,PRICE_CLOSE,1);
   double rsid1=iRSI(Symbol(),1440,RSIperiod,PRICE_CLOSE,0);
   double rsid2=iRSI(Symbol(),1440,RSIperiod,PRICE_CLOSE,1);
// double HTb=iCustom(Symbol(),0,"HalfTrend-1.02",0,0); //buy
// double HTs=iCustom(Symbol(),0,"HalfTrend-1.02",1,0); //buy
//--- open position
   int shift=4;
   if(IsTrough(shift) == true) 
   {
    int currentTrough = shift;
    int lastTrough = GetLastTrough(shift);
    if(OpenBUY && OrderBuy<3 && rsi[currentTrough] > rsi[lastTrough] && Low[currentTrough] < Low[lastTrough])OPBUY(); 
   } 
   if(IsPeak(shift) == true)
   {
    int currentPeak = shift;
    int lastPeak = GetLastPeak(shift);
    if(OpenSELL  && OrderSell<3  && rsi[currentPeak] < rsi[lastPeak] && High[currentPeak] > High[lastPeak])OPSELL(); 
   }
//--- close position by signal
   if(CloseBySignal)
     {
      if(OrderSell>0  && rsim30>70 && rsim60>70) CloseSell();
      if(OrderBuy>0 && rsim30<30  && rsim60<30)  CloseBuy();
     }
//---
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OPBUY()
  {
   double StopLossLevel;
   double TakeProfitLevel;
   if(StopLoss>0) StopLossLevel=Bid-StopLoss*Point; else StopLossLevel=0.0;
   if(TakeProfit>0) TakeProfitLevel=Ask+TakeProfit*Point; else TakeProfitLevel=0.0;

   ticket=OrderSend(Symbol(),OP_BUY,LOT(),Ask,Slippage,StopLossLevel,TakeProfitLevel,Koment,MagicNumber,0,DodgerBlue);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OPSELL()
  {
   double StopLossLevel;
   double TakeProfitLevel;
   if(StopLoss>0) StopLossLevel=Ask+StopLoss*Point; else StopLossLevel=0.0;
   if(TakeProfit>0) TakeProfitLevel=Bid-TakeProfit*Point; else TakeProfitLevel=0.0;
//---
   ticket=OrderSend(Symbol(),OP_SELL,LOT(),Bid,Slippage,StopLossLevel,TakeProfitLevel,Koment,MagicNumber,0,DeepPink);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void CloseSell()
  {
   int  total=OrdersTotal();
   for(int y=OrdersTotal()-1; y>=0; y--)
     {
      if(OrderSelect(y,SELECT_BY_POS,MODE_TRADES))
         if(OrderSymbol()==Symbol() && OrderType()==OP_SELL && OrderMagicNumber()==MagicNumber)
           {
            ticket=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),5,Black);
           }
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void CloseBuy()
  {
   int  total=OrdersTotal();
   for(int y=OrdersTotal()-1; y>=0; y--)
     {
      if(OrderSelect(y,SELECT_BY_POS,MODE_TRADES))
         if(OrderSymbol()==Symbol() && OrderType()==OP_BUY && OrderMagicNumber()==MagicNumber)
           {
            ticket=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),5,Black);
           }
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double LOT()
  {
   double lotsi;
   double ilot_max =MarketInfo(Symbol(),MODE_MAXLOT);
   double ilot_min =MarketInfo(Symbol(),MODE_MINLOT);
   double tick=MarketInfo(Symbol(),MODE_TICKVALUE);
//---
   double  myAccount=AccountBalance();
//---
   if(ilot_min==0.01) LotDigits=2;
   if(ilot_min==0.1) LotDigits=1;
   if(ilot_min==1) LotDigits=0;
//---
   if(AutoLot)
     {
      lotsi=NormalizeDouble((myAccount*Risk)/10000,LotDigits);
        } else { lotsi=ManualLots;
     }
//---
   if(lotsi>=ilot_max) { lotsi=ilot_max; }
//---
   return(lotsi);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void CalculateRSI(int x1)
{
    rsi[x1] = iRSI(Symbol(),PERIOD_CURRENT,RSIperiod,RSI_applied_price,x1);             
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool IsPeak(int shift)
{
    
    if(iHigh(NULL,0,shift)>=iHigh(NULL,0,shift+1) && iHigh(NULL,0,shift+1)>=iHigh(NULL,0,shift+2) && iHigh(NULL,0,shift+2)>=iHigh(NULL,0,shift+3)
       && iHigh(NULL,0,shift)>=iHigh(NULL,0,shift-1) && iHigh(NULL,0,shift-1)>=iHigh(NULL,0,shift-2) && iHigh(NULL,0,shift-2)>=iHigh(NULL,0,shift-3))
        return(true);
    else 
        return(false);
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool IsTrough(int shift)
{
    if(iLow(NULL,0,shift)<=iLow(NULL,0,shift+1) && iLow(NULL,0,shift+1)<=iLow(NULL,0,shift+2) && iLow(NULL,0,shift+2)<=iLow(NULL,0,shift+3)
       && iLow(NULL,0,shift)<=iLow(NULL,0,shift-1) && iLow(NULL,0,shift-1)<=iLow(NULL,0,shift-2) && iLow(NULL,0,shift-2)<=iLow(NULL,0,shift-3))
        return(true);
    else 
        return(false);
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int GetLastPeak(int shift)
{
    for(int j = shift + 5; j < Bars; j++)
    {
        if(iHigh(NULL,0,j)>=iHigh(NULL,0,j+1) && iHigh(NULL,0,j+1)>=iHigh(NULL,0,j+2) && iHigh(NULL,0,j+2)>=iHigh(NULL,0,j+3) &&
           iHigh(NULL,0,j)>=iHigh(NULL,0,j-1) && iHigh(NULL,0,j-1)>=iHigh(NULL,0,j-2) && iHigh(NULL,0,j-2)>=iHigh(NULL,0,j-3))
            return(j);
    }
    return(-1);
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int GetLastTrough(int shift)
{
    for(int j = shift + 5; j < Bars; j++)
    {
        if(iLow(NULL,0,j)<=iLow(NULL,0,j+1) && iLow(NULL,0,j+1)<=iLow(NULL,0,j+2) && iLow(NULL,0,j+2)<=iLow(NULL,0,j+3) &&
           iLow(NULL,0,j)<=iLow(NULL,0,j-1) && iLow(NULL,0,j-1)<=iLow(NULL,0,j-2) && iLow(NULL,0,j-2)<=iLow(NULL,0,j-3))
            return(j);
    }
    return(-1);
}

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+


Archivos adjuntos:

Han respondido

1
Desarrollador 1
Evaluación
(365)
Proyectos
412
36%
Arbitraje
35
26% / 57%
Caducado
63
15%
Libre
2
Desarrollador 2
Evaluación
(466)
Proyectos
697
56%
Arbitraje
43
30% / 33%
Caducado
113
16%
Trabaja
3
Desarrollador 3
Evaluación
(119)
Proyectos
127
41%
Arbitraje
3
33% / 67%
Caducado
0
Libre
4
Desarrollador 4
Evaluación
(4)
Proyectos
12
0%
Arbitraje
0
Caducado
3
25%
Libre
5
Desarrollador 5
Evaluación
(49)
Proyectos
134
27%
Arbitraje
62
13% / 53%
Caducado
58
43%
Libre
6
Desarrollador 6
Evaluación
(117)
Proyectos
138
41%
Arbitraje
30
7% / 77%
Caducado
17
12%
Libre
7
Desarrollador 7
Evaluación
(17)
Proyectos
24
33%
Arbitraje
5
20% / 40%
Caducado
8
33%
Libre
Solicitudes similares
I want to make a new dashboard using 3 common indicators and the ADX indicator , which you must supply I have a MA dash which you can strip & reuse if it helps you I tried to cover all questions in the attached but i'm sure there'll be more
I want the script in mql5 language for my martingale strategy. The script should open trades in both directions buy and sell and if any trade closes in loss then open new trade in that direction by using the next volume and when trade closes in profit then reset the volume to first from volume list and also maximum consecutive losses limit will apply. If trades closes consecutively in losses and hits the limit then
Long Position 1. Trend Line: When a Lower High (LH) is formed, draw a trend line from the previous Higher High (HH) to the new LH. 2. Trend Line Adjustment: If a new Lower High (LH) is formed without breaking the trend line, redraw the trend line to the new LH. Draw a trend line between the Higher High (HH) and the Higher Low (HL). If a new Higher High (HH) is formed, remove the previous trend line and draw a new one
I have a custom EA that works fine in the live market trading, but when doing a back test in the strategy tester , it does not open sell orders. There are no errors or warnings; it just doesn't open sell orders. I've checked every possible reason that might be the reason why it does not open sell orders, but I can't find anything, especially since it works fine in the real market and it opens both buys and sells
I'm looking for someone to help me create an arbitrage trading robot that can trade on any decentralized exchange and forex market. I already have some source code to a strategy but would like to enhance it to make it profitable and automated
I installed the E.A. into the Experts folder in MT4. When I double click on it nothing happens. When I right click and "attach to chart" nothing happens. The E.A. is not grayed out, it simply will not attach. Any help would be greatly Appreciated
I have an EA and want to add few new logic to fetch profit taking factors and other values from an external master data and use it in existing EA
I need EA that works on MT5 to be able to do the following: - Can recognize Support/Resistance area - Can recognize VWAP direction. - Can recognize RSI. - Can recognize Double Top/bottom, Bullish/Bearish hammer candle, Bullish/bearish engulfing candle. - Ability to set Stoploss below/above support/resistance, but risk must be fixed at a certain price. - Stoploss
I want a program that will help calculate and enter the market on full margin for me. I just need to put in the price for entry, Stop loss and TP then it will calculate the lot sizes for entering the trade on full margin on Mt5
I am seeking a highly skilled and experienced developer to assist with an important project. I need a development of an automated trading bot for NinjaTrader, utilizing a 4 SMA (Simple Moving Average) crossing strategy, with additional custom diversions for trade entries. The bot needs to be based on a strategy involving the crossing of four different SMAs. The exact periods for these SMAs and the conditions for

Información sobre el proyecto

Presupuesto
35+ USD
Para el ejecutor
31.5 USD
Plazo límite de ejecución
a 3 día(s)