Modification MT4 file accommodate EA LAB requirements

MQL4 Indicatori SQL MySQL

Lavoro terminato

Tempo di esecuzione 53 minuti

Specifiche

i have a simple and specific requirement to modify an indicator. This indicator has 10 buffers for colour as below:


Indicator Buffers currently

i would like to delete the duplicate buffers for use in EA lab which has a maximum of 8 allowed.


The code is below:


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

//|                                                   iRimbab_1.mq4  |

//|                        Copyright 2019, MetaQuotes Software Corp. |

//|                                             https://www.mql5.com |

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

#property copyright "Copyright 2019, MetaQuotes Software Corp."

#property link      "https://www.mql5.com"

#property version   "1.00"

#property strict

#property indicator_separate_window

#property indicator_buffers   10


#property indicator_label1 "Bull Strong"

#property indicator_color1 clrBlue

#property indicator_type1  DRAW_HISTOGRAM

#property indicator_width1 4


#property indicator_label4 "Bull Lite"

#property indicator_color4 clrBlue

#property indicator_type4  DRAW_HISTOGRAM

#property indicator_width4 4


#property indicator_label6 "Neutral"

#property indicator_color6 clrGray

#property indicator_type6  DRAW_HISTOGRAM

#property indicator_width6 4


#property indicator_label7 "Sell Lite"

#property indicator_color7 clrRed

#property indicator_type7  DRAW_HISTOGRAM

#property indicator_width7 4


#property indicator_label9 "Sell Strong"

#property indicator_color9 clrRed

#property indicator_type9  DRAW_HISTOGRAM

#property indicator_width9 4


//---

enum E_MODE

  {

   MOD_RSI  =0,   //RSI

   MOD_STO  =1,   //STOCHASTIC

   MOD_ADX  =2    //ADX

  };

//---

enum E_TYPE

  {

   TYP_ALMA    =0,   //ALMA

   TYP_EMA     =1,   //EMA

   TYP_WMA     =2,   //WMA

   TYP_SMA     =3,   //SMA

   TYP_SMMA    =4,   //SMMA

   TYP_HMA     =5    //HMA

  };

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

//|                                                                  |

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

input    int                  Length      =6;            //Period of Evaluation

input    int                  Smooth      =1;            //Period of Smoothing

input    ENUM_APPLIED_PRICE   Source      =PRICE_CLOSE;  //Source

input    E_MODE               Mode        =MOD_RSI;      //Indicator Method

input    E_TYPE               Type        =TYP_WMA;      //MA

input    double               Offset      =0.85;         //* Arnaud Legoux (ALMA) Only - Offset Value

input    double               Sigma       =6.0;          //* Arnaud Legoux (ALMA) Only - Sigma Value

input    int                  MaxBar      =1000;         //Max Bars

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

//|                                                                  |

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

#include <MovingAverages.mqh>

//---

double   BS[];

double   BSZ[];

double   BL[];

double   BLZ[];

double   Nt[];

double   NtZ[];

double   SL[];

double   SLZ[];

double   SS[];

double   SSZ[];


double   MA[];

double   Bull[];

double   Bear[];

double   Temp[];

double   Price[];

double   AvBull[];

double   AvBear[];

double   SmBull[];

double   SmBear[];


double   W[];

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

//| Custom indicator initialization function                         |

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

int OnInit()

  {

   Comment("");

   


   IndicatorBuffers(19);

   int   cnt=0;

   SetIndexBuffer(cnt,BS,INDICATOR_DATA);

   SetIndexEmptyValue(cnt,NULL);

   cnt++;

   SetIndexBuffer(cnt,BSZ,INDICATOR_DATA);

   SetIndexEmptyValue(cnt,NULL);

   cnt++;

   SetIndexBuffer(cnt,BL,INDICATOR_DATA);

   SetIndexEmptyValue(cnt,NULL);

   cnt++;

   SetIndexBuffer(cnt,BLZ,INDICATOR_DATA);

   SetIndexEmptyValue(cnt,NULL);

   cnt++;

   SetIndexBuffer(cnt,Nt,INDICATOR_DATA);

   SetIndexEmptyValue(cnt,NULL);

   cnt++;

   SetIndexBuffer(cnt,NtZ,INDICATOR_DATA);

   SetIndexEmptyValue(cnt,NULL);

   cnt++;

   SetIndexBuffer(cnt,SL,INDICATOR_DATA);

   SetIndexEmptyValue(cnt,NULL);

   cnt++;

   SetIndexBuffer(cnt,SLZ,INDICATOR_DATA);

   SetIndexEmptyValue(cnt,NULL);

   cnt++;

   SetIndexBuffer(cnt,SS,INDICATOR_DATA);

   SetIndexEmptyValue(cnt,NULL);

   cnt++;

   SetIndexBuffer(cnt,SSZ,INDICATOR_DATA);

   SetIndexEmptyValue(cnt,NULL);

   cnt++;

   SetIndexBuffer(cnt,MA,INDICATOR_CALCULATIONS);

   SetIndexEmptyValue(cnt,NULL);

   cnt++;

   SetIndexBuffer(cnt,Bull,INDICATOR_CALCULATIONS);

   SetIndexEmptyValue(cnt,NULL);

   cnt++;

   SetIndexBuffer(cnt,Bear,INDICATOR_CALCULATIONS);

   SetIndexEmptyValue(cnt,NULL);

   cnt++;

   SetIndexBuffer(cnt,Temp,INDICATOR_CALCULATIONS);

   SetIndexEmptyValue(cnt,NULL);

   cnt++;

   SetIndexBuffer(cnt,Price,INDICATOR_CALCULATIONS);

   SetIndexEmptyValue(cnt,NULL);

   cnt++;

   SetIndexBuffer(cnt,AvBull,INDICATOR_CALCULATIONS);

   SetIndexEmptyValue(cnt,NULL);

   cnt++;

   SetIndexBuffer(cnt,AvBear,INDICATOR_CALCULATIONS);

   SetIndexEmptyValue(cnt,NULL);

   cnt++;

   SetIndexBuffer(cnt,SmBull,INDICATOR_CALCULATIONS);

   SetIndexEmptyValue(cnt,NULL);

   cnt++;

   SetIndexBuffer(cnt,SmBear,INDICATOR_CALCULATIONS);


   IndicatorSetInteger(INDICATOR_DIGITS,_Digits+1);

   IndicatorSetString(INDICATOR_SHORTNAME,

                      MQLInfoString(MQL_PROGRAM_NAME)+" ("+

                      IntegerToString(Length)+", "+

                      IntegerToString(Smooth)+", "+

                      StringSubstr(EnumToString(Source),StringLen("PRICE_"))+", "+

                      StringSubstr(EnumToString(Mode),StringLen("MOD_"))+", "+

                      StringSubstr(EnumToString(Type),StringLen("TYP_"))+", "+

                      DoubleToString(Offset,2)+", "+

                      DoubleToString(Sigma,2)+")");


   return(INIT_SUCCEEDED);

  }

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

//| Custom indicator iteration function                              |

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

int OnCalculate(const int rates_total,

                const int prev_calculated,

                const datetime &time[],

                const double &open[],

                const double &high[],

                const double &low[],

                const double &close[],

                const long &tick_volume[],

                const long &volume[],

                const int &spread[])

  {

   int   limit=rates_total-prev_calculated;

   if(limit>1)

     {

      limit=fmin(MaxBar,rates_total)-Length-2;


      for(int i=0; i<rates_total; i++)

         PlotZ(i);


      if(Type==TYP_ALMA)

        {

         ArrayResize(W,Length);

         double   m=floor(Offset*(Length-1));

         double   s=Length/Sigma;

         double   wSum=0;

         double   t=(2*s*s);

         for(int i=0; i<Length; i++)

           {

            W[i]=exp(-((i-m)*(i-m))/((t==NULL) ?1.0 :t));

            wSum+= W[i];

           }

         for(int i=0; i<Length; i++)

            W[i]=W[i]/wSum;

        }

     }

   else

      limit++;


   for(int i=limit; i>=0; i--)

     {

      PlotZ(i);

      Price[i]=Price(Source,i,open[i],high[i],low[i],close[i]);

      switch(Type)

        {

         case TYP_HMA:

            Temp[i]=iMA(_Symbol,PERIOD_CURRENT,(int)floor(Length/2),0,MODE_LWMA,Source,i)*2-iMA(_Symbol,PERIOD_CURRENT,Length,0,MODE_LWMA,Source,i);

            break;

        }

     }

   for(int i=limit; i>=0; i--)

     {

      MA[i]=iMA(_Symbol,PERIOD_CURRENT,1,0,MODE_SMA,Source,i);

      switch(Mode)

        {

         case MOD_STO:

            Bull[i]=MA[i]-MA[ArrayMinimum(MA,Length,i)];

            Bear[i]=MA[ArrayMaximum(MA,Length,i)]-MA[i];

            break;

         case MOD_RSI:

            Bull[i]=0.5*(fabs(MA[i]-MA[i+1])+(MA[i]-MA[i+1]));

            Bear[i]=0.5*(fabs(MA[i]-MA[i+1])-(MA[i]-MA[i+1]));

            break;

         case MOD_ADX:

            Bull[i]=0.5*(fabs(high[i]-high[i+1])+(high[i]-high[i+1]));

            Bear[i]=0.5*(fabs(low[i+1]-low[i])+(low[i+1]-low[i]));

            break;

        }

      AvBull[i]=MA(Bull,Length,i);

      AvBear[i]=MA(Bear,Length,i);

     }


   for(int i=limit; i>=0; i--)

     {

      SmBull[i]=MA(AvBull,Smooth,i);

      SmBear[i]=MA(AvBear,Smooth,i);

      double   dif=fabs(SmBull[i]-SmBear[i]);

      if(dif>SmBull[i])

        {

         if(SmBear[i]<SmBear[i+1])

            SS[i]=dif;

         else

            SL[i]=dif;

         continue;

        }

      if(dif>SmBear[i])

        {

         if(SmBull[i]<SmBull[i+1])

            BS[i]=dif;

         else

            BL[i]=dif;

         continue;

        }

      Nt[i]=dif;

     }


   return(rates_total);

  }

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

//|                                                                  |

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

double MA(double &vBuf[],const int vLen,const int vxPos)

  {

   double   sum=0.0;

   switch(Type)

     {

      case TYP_SMA:

         return(iMAOnArray(vBuf,0,vLen,0,MODE_SMA,vxPos));

      case TYP_EMA:

         return(iMAOnArray(vBuf,0,vLen,0,MODE_EMA,vxPos));

      case TYP_SMMA:

         return(iMAOnArray(vBuf,0,vLen,0,MODE_SMMA,vxPos));

      case TYP_WMA:

         return(iMAOnArray(vBuf,0,vLen,0,MODE_LWMA,vxPos));

      case TYP_HMA:

         return(iMAOnArray(vBuf,0,(int)floor(sqrt(vLen)),0,MODE_LWMA,vxPos));

      case TYP_ALMA:

         for(int i=0; i<vLen; i++)

            sum+=vBuf[vxPos+(vLen-1-i)]*W[i];

         return(sum);

     }

   return(NULL);

  }

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

//|                                                                  |

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

double Price(const ENUM_APPLIED_PRICE vApp,const int vxPos,const double vOp,const double vHi,const double vLo,const double vCl)

  {

   switch(vApp)

     {

      case PRICE_CLOSE:

         return(vCl);

      case PRICE_HIGH:

         return(vHi);

      case PRICE_LOW:

         return(vLo);

      case PRICE_OPEN:

         return(vOp);

      case PRICE_MEDIAN:

         return((vHi+vLo)/2.0);

      case PRICE_TYPICAL:

         return((vHi+vLo+vCl)/3.0);

      case PRICE_WEIGHTED:

         return((vHi+vLo+vCl+vCl)/4.0);

     }

   return(NULL);

  }

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

//|                                                                  |

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

void  PlotZ(int vxPos)

  {

   BS[vxPos]=NULL;

   BSZ[vxPos]=NULL;

   BL[vxPos]=NULL;

   BLZ[vxPos]=NULL;

   Nt[vxPos]=NULL;

   NtZ[vxPos]=NULL;

   SL[vxPos]=NULL;

   SLZ[vxPos]=NULL;

   SS[vxPos]=NULL;

   SSZ[vxPos]=NULL;

   MA[vxPos]=NULL;

   Bull[vxPos]=NULL;

   Bear[vxPos]=NULL;

   Temp[vxPos]=NULL;

   Price[vxPos]=NULL;

   AvBull[vxPos]=NULL;

   AvBear[vxPos]=NULL;

   SmBull[vxPos]=NULL;

   SmBear[vxPos]=NULL;

  }

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

//---

//---

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

//|                                                                  |

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

//---




Con risposta

1
Sviluppatore 1
Valutazioni
(174)
Progetti
199
12%
Arbitraggio
38
37% / 34%
In ritardo
5
3%
In elaborazione
Pubblicati: 2 codici
2
Sviluppatore 2
Valutazioni
(15)
Progetti
21
38%
Arbitraggio
3
33% / 33%
In ritardo
4
19%
Gratuito
3
Sviluppatore 3
Valutazioni
(250)
Progetti
460
26%
Arbitraggio
140
20% / 59%
In ritardo
100
22%
In elaborazione
Ordini simili
1.Sinyal Perdagangan : Sinyal beli: garis MACD utama memotong garis sinyal ke atas (macd_current>signal_current && macd_previous<signal_previous). Sinyal jual: garis MACD utama memotong garis sinyal ke bawah (macd_current<signal_current && macd_previous>signal_previous). Gambar di bawah menunjukkan kasus beli dan jual. 2. Posisi ditutup pada sinyal yang berlawanan: Posisi beli ditutup pada sinyal jual, dan posisi
can anyone help me with building a complete automated pine code strategy and indicator that work for both FXs & CFDs and have a high winning rate proved through back testing. I have a very complex current code that developed mostly using AI but lots of gaps are there although it translate exactly what I have in my mind. So, you are free to decide whether wo build a complete new code or fix my current working code ( i
Hello. I am finding an experienced python developer who can implement my trading strategies into robots. I like trend-following swing trading strategies and am going to automate my idea. More details can be discussed by chatting. If you have similar working experience it can be a plus. Thanks
Ones EA start just buy at market order with input varibale "initial lot size",, example 0.01 lot,, and immedetely put target and stoploss by "input varible "distance points",, example 1000 points,,, if target hit then immediately take another buy order at market price with same points"distance points",, if tp hit this process keep on goes,, But if sl hit then immediately take sell order with lot size 0.03 with sl
Signal Logic - Swing points detected correctly (Fractals or N-bar) - BOS triggers only on bar close beyond swing level (+ optional min break distance) - FVG zones detected correctly (3-candle gap) and stored with clear boundaries - FVG invalidation works as configured (full fill / partial fill / timeout) Entry & Execution - Entry only after BOS (if enabled) and on return to active FVG zone - Bar-close confirmation
Need a HFT scalping EA 30 - 100 USD
Require the development of a high-speed HFT, fully automated trading Expert Advisor (EA) for MetaTrader 5 , optimized for live trading on both Deriv and Exness . The EA must be designed for fast execution, low latency, and reliability on real-money accounts , with full compatibility across broker-specific contract specifications, tick sizes, tick values, pricing formats, and volume rules. It should automatically
I have created a bot based on my logic and requirements. But some of the logics are not working as not expected I want you to analyze the existing code and modify or create a new EA for MT5 as per my requirements I want you to modify MQL5 and Set files code for the Buy and Sell Consecutive orders in this way Symbol = XAUUSD, Time Frame = 1 min / 5 mins This is an example for placing the orders First Order should
require the development of a high-speed, fully automated trading Expert Advisor (EA) for MetaTrader 5 , optimized for live trading on both Deriv and Exness . The EA must be designed for fast execution, low latency, and reliability on real-money accounts , with full compatibility across broker-specific contract specifications, tick sizes, tick values, pricing formats, and volume rules. It should automatically detect
Pazuzu 30+ USD
generate or create me a python coded file that has mql5 language requirements for a trading bot under the following instructions. the bot must execute trades if necessary the bot must trade 24/7 the bot must trade gold and currency the bot must make unlimited profit hourly the bot must enter market with caution after market analysis of 98 percent of clear trade

Informazioni sul progetto

Budget
30+ USD
Scadenze
a 2 giorno(i)