IndexMeter_MT5

MQL5 Conversión

Trabajo finalizado

Plazo de ejecución 3 horas
Comentario del Cliente
great job!
Comentario del Ejecutor
Thank you for the project. It was a pleasure working with you.

Tarea técnica

Please can anyone help me convert this simple Indicator from MT4
to MT5. 

Please its really a very few lines of codes, and I will appreciate the MT5 to be a as much lines of code.

I do not like complicated and unnecessary lines of code. Kindly delete any useful codes. Thanks



#property indicator_separate_window

#property indicator_buffers 1

#property indicator_level1 0 //middle line

#property indicator_color1  Blue


// ==== External / Internal Input ======= //

int InpFastEMA = 10;

int InpSlowEMA = 20;

int hist = 1000;  //to reduce the number of candles to compute for


// ==== Declaring the arrays

double Meter[];


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

//| Custom indicator initialization function                         |

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

int OnInit()

  {

   IndicatorBuffers(1);

   //--- indicator buffers mapping

   SetIndexBuffer(0,Meter);

   SetIndexStyle(0,DRAW_HISTOGRAM);

   

   //--- indicator name / Labels

   IndicatorShortName("Index Meter "); 

   SetIndexLabel(0,"Index Meter"); // name on Data window 

   

   //---

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

  {

//---


// === Calculate the Meter values

   MeterCalc();

               

//--- return value of prev_calculated for next call

   return(rates_total);

  }

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



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

//| Calculating the Meter for Any Currency pair                      |

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

int MeterCalc()

 {

  // double rsi,macd;

  

  //Locally find your own tickers, and compare with what is in IndexArray

  string ccu1 = StringSubstr(_Symbol,0,3);

  string ccu2 = StringSubstr(_Symbol,3,3);

    

  int countB = IndicatorCounted();

  int limitt = Bars - countB;

  if(limitt>hist)limitt=hist;

  for(int i=0;i<limitt;i++) // iterating backwards

    {    

        int count=0;   


     // ==== Next, focus on this chart, and calculate "count"

     double fma1=NormalizeDouble(iMA(_Symbol,0,InpFastEMA,0,MODE_EMA,PRICE_CLOSE,i),Digits);

     double sma1=NormalizeDouble(iMA(_Symbol,0,InpSlowEMA,0,MODE_EMA,PRICE_CLOSE,i),Digits);

     double Macd1=NormalizeDouble(iMACD(NULL,0,12,26,9,0,MODE_MAIN,i),6);

     double rsi1=iRSI(_Symbol,0,14,0,i);

     if(fma1>sma1)count+=10;

     else if(fma1<sma1) count-=10;

     if(Macd1>0) count+=10;

     else if(Macd1<0) count-=10;

     if(rsi1>50) count+=10;

     else if(rsi1<50) count-=10;

      

    // ===== sum all the count

      Meter[i]=count;

    }

 return(0);

}


Archivos adjuntos:

JPG
Capture.JPG
30.5 Kb

Han respondido

1
Desarrollador 1
Evaluación
(40)
Proyectos
57
21%
Arbitraje
3
67% / 0%
Caducado
9
16%
Trabajando
2
Desarrollador 2
Evaluación
(283)
Proyectos
289
70%
Arbitraje
2
100% / 0%
Caducado
0
Libre
Ha publicado: 1 ejemplo
3
Desarrollador 3
Evaluación
(8)
Proyectos
11
0%
Arbitraje
3
67% / 33%
Caducado
2
18%
Libre
4
Desarrollador 4
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
5
Desarrollador 5
Evaluación
(31)
Proyectos
35
46%
Arbitraje
0
Caducado
0
Libre
Ha publicado: 3 ejemplos
6
Desarrollador 6
Evaluación
(173)
Proyectos
201
49%
Arbitraje
18
11% / 44%
Caducado
1
0%
Libre
7
Desarrollador 7
Evaluación
(29)
Proyectos
49
22%
Arbitraje
13
31% / 15%
Caducado
13
27%
Trabaja
8
Desarrollador 8
Evaluación
(8)
Proyectos
10
10%
Arbitraje
0
Caducado
4
40%
Trabaja
9
Desarrollador 9
Evaluación
(240)
Proyectos
255
52%
Arbitraje
0
Caducado
5
2%
Libre
10
Desarrollador 10
Evaluación
(7)
Proyectos
11
0%
Arbitraje
4
0% / 75%
Caducado
2
18%
Trabaja
11
Desarrollador 11
Evaluación
(434)
Proyectos
461
69%
Arbitraje
6
67% / 0%
Caducado
2
0%
Trabaja
12
Desarrollador 12
Evaluación
(77)
Proyectos
231
73%
Arbitraje
6
100% / 0%
Caducado
1
0%
Libre

Información sobre el proyecto

Presupuesto
30 USD
IVA (21%): 6.3 - 6.3 USD
Total: 36.3 - 36.3 USD
Para el ejecutor
27 - 27 USD
Plazo límite de ejecución
de 1 a 3 día(s)