Code Conversion - MT5 to MT4

MQL4 Indicators

Specification

//+------------------------------------------------------------------+
//|                                             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]);   
}

Responded

1
Developer 1
Rating
(878)
Projects
1391
67%
Arbitration
117
32% / 42%
Overdue
215
15%
Free
2
Developer 2
Rating
(1127)
Projects
1429
62%
Arbitration
21
57% / 10%
Overdue
43
3%
Free
3
Developer 3
Rating
(376)
Projects
398
31%
Arbitration
62
19% / 69%
Overdue
50
13%
Working
4
Developer 4
Rating
(508)
Projects
764
63%
Arbitration
33
27% / 45%
Overdue
23
3%
Free
5
Developer 5
Rating
(21)
Projects
35
54%
Arbitration
8
63% / 38%
Overdue
1
3%
Free
6
Developer 6
Rating
(28)
Projects
47
23%
Arbitration
13
31% / 15%
Overdue
12
26%
Free
7
Developer 7
Rating
(563)
Projects
932
47%
Arbitration
301
59% / 25%
Overdue
124
13%
Working
8
Developer 8
Rating
(69)
Projects
81
21%
Arbitration
6
33% / 17%
Overdue
5
6%
Free
9
Developer 9
Rating
(257)
Projects
341
58%
Arbitration
7
14% / 71%
Overdue
9
3%
Free
10
Developer 10
Rating
(15)
Projects
16
19%
Arbitration
2
0% / 50%
Overdue
1
6%
Free
11
Developer 11
Rating
(328)
Projects
387
33%
Arbitration
2
100% / 0%
Overdue
0
Working
12
Developer 12
Rating
(1090)
Projects
1770
61%
Arbitration
14
64% / 7%
Overdue
84
5%
Free
13
Developer 13
Rating
(8)
Projects
9
22%
Arbitration
0
Overdue
0
Free
14
Developer 14
Rating
(7)
Projects
17
41%
Arbitration
3
0% / 100%
Overdue
3
18%
Free
15
Developer 15
Rating
(5)
Projects
11
18%
Arbitration
0
Overdue
3
27%
Free
16
Developer 16
Rating
(66)
Projects
143
34%
Arbitration
10
10% / 60%
Overdue
26
18%
Free
17
Developer 17
Rating
(96)
Projects
143
76%
Arbitration
0
Overdue
2
1%
Free
18
Developer 18
Rating
(7)
Projects
8
63%
Arbitration
1
0% / 100%
Overdue
1
13%
Free
19
Developer 19
Rating
(26)
Projects
29
45%
Arbitration
0
Overdue
1
3%
Free
Similar orders
Indicator MT5 from Pine Script 5 (TradingView) indicators Request: Develop 1 Indicator mql5 from 2 TV (Pine script 5) indicators Get only basic features, I just need to get values in Copybuffer() for mql5 expert. Total MT5 indicator: 4 levels in the chart + 1 oscillator (line/histogram) =================================== TV Indicator 1: Smart Money Concepts Just get High/low levels from internal/externals (smaller /
I have a full code ,, There are some errors in this.It does not add to the chart, does not show arrow marks, does not alert ,, fix this problem and work properly,, Contact on telegram @Gw_rakib1
Starting from scratch, I need a solution to develop my own crypto trading and exchange platform. This platform should compare prices across various exchanges like Coinbase, Binance, KuCoin, and Unocoin, as well as different cryptocurrencies. The solution must identify opportunities to buy on one platform and sell on another for a profit, transferring funds to my personal wallet instantly for security. The bot should
I am looking for a programmer to do EA trader. If you can understand what I want from the video i do and you can do it, contact me because you will be able to do what I want. https://drive.google.com/file/d/1wbHxbUQQqCkdpr0-pHfIh2b288LzYTV2/view?usp=sharing
I have an indicator i will like to view in form of dashboard across various timeframes, i also will like a push notifications alert feature that will appear on my mt4 mobile to keep track of my trading pairs
Need a dashboard, which can monitor up to 30 selected pairs in selected time frames. It monitors AO, MACD and stochastic. In the cells of dashboard, if AO is positive in the relevant symbol/tf, it writes "UP". When one of AO is above 0 level AND Stochastic is in OS zone it writes "UPUP". When AO is above 0 and when stochastics is oversold minimum of two times,it will alert UPU2 if AO is negative below 0 in the
Looking for custom strength indicators I can add to my EA. An indicator that can measure the strength of buyer and sellers. Please show me what you have, thank you
Modify Indicator 30 - 40 USD
I need an expert who can assist me in modifying an open source PineScript indicator code to add additional features. Only applicants with prove of work should apply for more discussion
Hello i need an expert who can help me modify an open source PineScript indicator code to add additional features. ONLY EXPERT WITH PROVE OF WORK SHOULD CONTACT FOR FURTHER DISCUSSION ON THE PROJECT
احتاج شخص عربي يتكلم ويفهم العربية حتى يسهل شرح المطلوب للمؤشر لدي مؤشر واكسبيرت خاص بي بحاجة إلى تعديل الكود المصدري لدي والفكرة تحتاج فعم من المبرمج باختصار اريد مبرمج عربي يفهم ويتكلم العربية حتى يسهل الشرح وفي نفس الوقت صاحب خبرة وتجربة ومتداول على منصة ميتا تريدر حتى يضفي تحسينات على المؤشر ويستطيع عمل الفكرة بكل سهولة وإعطاء النصائح إذا وجد خطأ

Project information

Budget
30 - 50 USD
For the developer
27 - 45 USD
Deadline
to 10 day(s)