Code Conversion - MT5 to MT4

MQL4 Indicateurs

Spécifications

//+------------------------------------------------------------------+
//|                                             Daily Highs-Lows.mq5 |
//|                                                 Copyright mladen |
//|                                               mladenfx@gmail.com |
//+------------------------------------------------------------------+
#property copyright "mladen"
#property link      "mladenfx@gmail.com"
#property version   "1.00"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots   2

//
//
//
//
//

#property indicator_label1  "High"
#property indicator_type1   DRAW_LINE
#property indicator_color1  Green
#property indicator_style1  STYLE_DOT
#property indicator_width1  1

#property indicator_label2  "Low"
#property indicator_type2   DRAW_LINE
#property indicator_color2  FireBrick
#property indicator_style2  STYLE_DOT
#property indicator_width2  1


//
//
//
//
//

input ENUM_TIMEFRAMES inpPeriod      = PERIOD_D1; // Time frame for highs/lows
input int             inpPeriodsBack = 0;         // Look back periods (enter 0 or less than zero for all)

//
//
//
//
//

double HiBuffer[];
double LoBuffer[];

int             iPeriodsBack;
ENUM_TIMEFRAMES iPeriod;

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

int OnInit()
{
   SetIndexBuffer(0,HiBuffer,INDICATOR_DATA); ArraySetAsSeries(HiBuffer,true);
   SetIndexBuffer(1,LoBuffer,INDICATOR_DATA); ArraySetAsSeries(LoBuffer,true);

   //
   //
   //
   //
   //
   
   iPeriodsBack = (inpPeriodsBack>0) ? inpPeriodsBack : 999999;      
   iPeriod      = (inpPeriod>=Period()) ? inpPeriod : Period();
      string timeFrameName = periodToString(iPeriod);
         IndicatorSetString(INDICATOR_SHORTNAME,timeFrameName+" highs/lows");
         PlotIndexSetString(0,PLOT_LABEL,timeFrameName+" high");
         PlotIndexSetString(1,PLOT_LABEL,timeFrameName+" low");
   return(0);
}

//
//
//
//
//

#define numRetries 5

//
//
//
//
//

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[])
{

   //
   //
   //
   //
   //

   if (!ArrayGetAsSeries(time)) ArraySetAsSeries(time,true);
         MqlRates ratesArray[]; ArraySetAsSeries(ratesArray,true);
         
         int copiedRates;
         for (int i=0; i<numRetries;i++)
            if((copiedRates = CopyRates(Symbol(),iPeriod,time[rates_total-1],time[0],ratesArray))>0) break;
            if (copiedRates <= 0)
            {
               Print("not all rates copied. Will try on next tick");
               return(prev_calculated);
            }

      //
      //
      //
      //
      //

         int limit = rates_total-prev_calculated;
            if (prev_calculated > 0) limit++;
            if (prev_calculated ==0) limit--;

            int minutesPeriod = periodToMinutes(Period());
            int minutesChosen = periodToMinutes(iPeriod);

         limit = (limit>(minutesChosen/minutesPeriod)) ? limit : (minutesChosen/minutesPeriod);

      //
      //
      //
      //
      //
            
      for (int i=limit; i>=0; i--)
      {
         int d = dateArrayBsearch(ratesArray,time[i],copiedRates);
         if (d >= 0 && d < iPeriodsBack)
            {
               HiBuffer[i] = ratesArray[d].high;
               LoBuffer[i] = ratesArray[d].low;
            }
         else
            {
               HiBuffer[i] = EMPTY_VALUE;
               LoBuffer[i] = EMPTY_VALUE;
            }
      }
   
   //
   //
   //
   //
   //

   return(rates_total);
}



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

int dateArrayBsearch(MqlRates& rates[], datetime toFind, int total)
{
   int mid   = 0;
   int first = 0;
   int last  = total-1;
   
   while (last >= first)
   {
      mid = (first + last) >> 1;
      if (toFind == rates[mid].time || (mid > 0 && (toFind > rates[mid].time) && (toFind < rates[mid-1].time))) break;
      if (toFind >  rates[mid].time)
            last  = mid - 1;
      else  first = mid + 1;
   }
   return (mid);
}


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

int periodToMinutes(int period)
{
   int i;
   static int _per[]={1,2,3,4,5,6,10,12,15,20,30,0x4001,0x4002,0x4003,0x4004,0x4006,0x4008,0x400c,0x4018,0x8001,0xc001};
   static int _min[]={1,2,3,4,5,6,10,12,15,20,30,60,120,180,240,360,480,720,1440,10080,43200};

   if (period==PERIOD_CURRENT) 
       period = Period();   
            for(i=0;i<20;i++) if(period==_per[i]) break;
   return(_min[i]);   
}

//
//
//
//
//

string periodToString(int period)
{
   int i;
   static int    _per[]={1,2,3,4,5,6,10,12,15,20,30,0x4001,0x4002,0x4003,0x4004,0x4006,0x4008,0x400c,0x4018,0x8001,0xc001};
   static string _tfs[]={"1 minute","2 minutes","3 minutes","4 minutes","5 minutes","6 minutes","10 minutes","12 minutes",
                         "15 minutes","20 minutes","30 minutes","1 hour","2 hours","3 hours","4 hours","6 hours","8 hours",
                         "12 hours","daily","weekly","monthly"};
   
   if (period==PERIOD_CURRENT) 
       period = Period();   
            for(i=0;i<20;i++) if(period==_per[i]) break;
   return(_tfs[i]);   
}

Répondu

1
Développeur 1
Évaluation
(879)
Projets
1392
67%
Arbitrage
117
32% / 42%
En retard
215
15%
Gratuit
2
Développeur 2
Évaluation
(1134)
Projets
1436
62%
Arbitrage
21
57% / 10%
En retard
43
3%
Gratuit
3
Développeur 3
Évaluation
(378)
Projets
401
31%
Arbitrage
63
19% / 70%
En retard
51
13%
Chargé
4
Développeur 4
Évaluation
(513)
Projets
775
63%
Arbitrage
33
27% / 45%
En retard
23
3%
Gratuit
5
Développeur 5
Évaluation
(21)
Projets
35
54%
Arbitrage
8
63% / 38%
En retard
1
3%
Gratuit
6
Développeur 6
Évaluation
(28)
Projets
47
23%
Arbitrage
13
31% / 15%
En retard
12
26%
Gratuit
7
Développeur 7
Évaluation
(564)
Projets
933
47%
Arbitrage
302
59% / 25%
En retard
125
13%
Chargé
8
Développeur 8
Évaluation
(69)
Projets
81
21%
Arbitrage
6
33% / 17%
En retard
5
6%
Gratuit
9
Développeur 9
Évaluation
(257)
Projets
341
58%
Arbitrage
7
14% / 71%
En retard
9
3%
Gratuit
10
Développeur 10
Évaluation
(15)
Projets
16
19%
Arbitrage
2
0% / 50%
En retard
1
6%
Gratuit
11
Développeur 11
Évaluation
(355)
Projets
417
34%
Arbitrage
2
100% / 0%
En retard
0
Gratuit
12
Développeur 12
Évaluation
(1098)
Projets
1779
61%
Arbitrage
14
64% / 7%
En retard
84
5%
Travail
13
Développeur 13
Évaluation
(8)
Projets
9
22%
Arbitrage
0
En retard
0
Gratuit
14
Développeur 14
Évaluation
(7)
Projets
17
41%
Arbitrage
3
0% / 100%
En retard
3
18%
Gratuit
15
Développeur 15
Évaluation
(5)
Projets
11
18%
Arbitrage
0
En retard
3
27%
Gratuit
16
Développeur 16
Évaluation
(66)
Projets
143
34%
Arbitrage
10
10% / 60%
En retard
26
18%
Gratuit
17
Développeur 17
Évaluation
(96)
Projets
143
76%
Arbitrage
0
En retard
2
1%
Gratuit
18
Développeur 18
Évaluation
(7)
Projets
8
63%
Arbitrage
1
0% / 100%
En retard
1
13%
Gratuit
19
Développeur 19
Évaluation
(26)
Projets
29
45%
Arbitrage
0
En retard
1
3%
Gratuit
Commandes similaires
Hello, is it possible to be made accommodation of provided signal for Forex for mt4? I bought a signal for multiple pairs. it is executing all pair.I want to use it on couple of pairs.Is it possible to be made some modifications?I do not have codes for the signal
I have an MT4 indicator, I want to receive an alert on WhatsApp when the indicator gives a buy or sell signal, I already have an API that will send the message, just send the json with the content, I will pass the API link when I have the proposal: { "symbol": "xauusd", "cellphonenumber": "00000000", "message": "test" }
KILL MODE 30 - 60 USD
i Need an expert advisor that trade by signal moving average indictors.it must check and correct the process of possible errors in trading operations. The main criteria of opening and closing positions direction of average moving,price of last bar and set the number of lots to trade as an input parameter
Creating a chart composed of different assets, weighted by their trading lot size & quantity. Using this chart to trade the assets in those lot sizes &quantity (by hand or with an EA ) In other words: composing a private index or pair, plotting that as a chart and have the ability to trade it directly with an EA and/or one order click. Inspired by Basket Chart Creator
Hello, I am highly in need of a professional and expert developer who is capable to convert my tradingview indicator to MT5, if you can perfectly do this project kindly meet me at the comment section to proceed
You must have knowledge of forex tester. Don't bother unless you do The indicator to convert from trading view to FOREX TESTER 5 -- wave trend 3d by JDEHORTY Please note this is a multi time frame indicator. Im not interested in any other wave trend indicator. It has to be a conversion of this indicator. Forex tester conversion https://www.youtube.com/watch?v=S64LjZVr9jE code python
Craet and indicator which has 15 price source and set a T/F tick for each price source then make Bollinger bands and Rsi with BollingerBands just for true sorces and plot buy and sell signals on main chart based on some conditions and strategy.... i explained every thing clear in the zip file ... theres no need to display those indicators i just need to see their value for testing how indicator works inside chart
I have one expert advisor. I optimized it and generated 3 optimized set files. As each EA can run only single set file, I need my EA to run with the parametrization from 3 set files at the same time because trade conditions those are defined by the set files are not same
THE IDEA OF THE INDICATOR Create A Standard ZigZag Auto Fibo Indicator Combined With A ZigZag Fibonacci Time Zone Indicator Which Has The Specified Levels Written In The Indicator Strategy TEXT FILE/DOCUMENT HOW DOES THE INDICATOR KNOW AN UPTREND MOVEMENT? If Price Hasn't Touched The 123.6% Level Of The Recent Static Uptrend Zig Zag Fibo Retracement Tool Then The Indicator Knows That The Market Is In An Uptrend And
Hi, To help with algorithm development, I need an experienced PineScript and TRADELOCKER coder to convert an indicator from TradingView to Tradelocker, then create an expert advisor (EA) with the same logic as the indicator and the features I want in the expert advisor (Rules & Conditions). Please only apply if you have experience converting scripts from TradingView to Tradelocker. I also need to make sure that the

Informations sur le projet

Budget
30 - 50 USD
Pour le développeur
27 - 45 USD
Délais
à 10 jour(s)