Modification MT4 file accommodate EA LAB requirements

MQL4 Indicateurs SQL MySQL

Tâche terminée

Temps d'exécution 53 minutes

Spécifications

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;

  }

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

//---

//---

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

//|                                                                  |

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

//---




Répondu

1
Développeur 1
Évaluation
(171)
Projets
194
11%
Arbitrage
37
38% / 35%
En retard
5
3%
Chargé
2
Développeur 2
Évaluation
(15)
Projets
21
38%
Arbitrage
3
33% / 33%
En retard
4
19%
Gratuit
3
Développeur 3
Évaluation
(236)
Projets
440
26%
Arbitrage
125
21% / 57%
En retard
96
22%
Travail
Commandes similaires
Build this Expert Advisor (EA) 1. Risk Management Risk per Trade : The EA will calculate the lot size based on the risk percentage (1-2% of the account balance). This will be a customizable input. Stop Loss & Trailing Stop : The EA will place a stop loss at a defined level (based on strategy parameters like ATR, recent support/resistance, etc.) and will implement a trailing stop to lock in profits as the trade moves
Hello, I have a physically trading keyboard and i want to connect it with tradelocker, mt4,mt5 and ctrader. People need to be able to open and close a position with the keyboard really fast. i need it on macos, windows and linux. (desktop) My competition is: www.magickeys.trade My goal is to be the number 1 to sell the keyboards + software. When people order a tradingkeyboard they will get a mail after the purchase
I need an expert advisor based on MACD and MA signals. It must have check and handling of trade operations errors. The main criteria for opening and closing positions: ◇Both Main and Signal direction must be shown by Arrows which is going to be for buy and sell positions
I need an expert to help me with adding more features to my existing mt4 EA I think the addition I want added to this EA is fairly simple--but I don't really understand how programming works, Contact me for a long term work, This is not the only project, I will explain the features in the inbox, Let me know if you can do it
Hft live account 30 - 200 USD
i need a high frequency trading (hft) expert advisor, that can be used to trade on demo and live accounts icmarket and 8cap. The EA has to be highly profitable, giving daily profit. If a test version is available, please send, to foster a faster transaction. like the ones that pass prop firm and demo but adjustment where it work on live with low latency
CPI ROBOKING 30+ USD
*Strategy: CPI-Based Trading* *Instruments:* XAUUSD (Gold), UsTech100 (Nasdaq 100), USDJPY *CPI Release:* 1. *Higher-than-expected CPI:* - XAUUSD: SELL (Gold prices may drop due to potential rate hike) - UsTech100: SELL (Tech stocks may drop due to potential rate hike) - USDJPY: BUY (USD may strengthen due to potential rate hike) 2. *Meets or lower-than-expected CPI:* - XAUUSD: BUY (Gold prices may rise due
I want to create an EA that can take bids according to information of a logic I have developed to give indication of a BUY or SELL opportunity. The EA will then be able to activate the BUY at the lowest possible position once the indicator clears it for a BUY and take bid upwards or identify the highest point and clears it for a SELL and take bids downwards. As you can see from example of JULY 2024 data to see how
Hello, i need a good programmer; to code an EA to trade the most productive forex pairs (mainly 2 for the day, and 2 for the night+gold), the strategy is based on the use of one moving average and the rsi, thank you in advance
Hi, i will provide a dll .use it's functions develop a backend code copy trading .it should a master accounts and slave accounts based of the mapping with the copy parametsrs it should start copy trades between the master and slave .one slave should be able to copy from Mutiple master and some basic fronted access to be created using the angular js
i want a forex robot that will read chats and enter trades on its oown. i want it to be able to use all trading strategies and partterns. good risky manegmemt, i want it to forcuse on Gold and and all major forex pairs. i want it to use stop loses and take profits as the market might change direction anytime. i want to work on both mt5 and mt4

Informations sur le projet

Budget
30+ USD
Pour le développeur
27 USD
Délais
à 2 jour(s)