IndexMeter_MT5

MQL5 转化中

工作已完成

执行时间3 小时
客户反馈
great job!
员工反馈
Thank you for the project. It was a pleasure working with you.

指定

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);

}


附加的文件:

JPG
Capture.JPG
30.5 Kb

反馈

1
开发者 1
等级
(40)
项目
57
21%
仲裁
3
67% / 0%
逾期
9
16%
已载入
2
开发者 2
等级
(283)
项目
289
70%
仲裁
2
100% / 0%
逾期
0
空闲
发布者: 1 代码
3
开发者 3
等级
(8)
项目
11
0%
仲裁
3
67% / 33%
逾期
2
18%
空闲
4
开发者 4
等级
项目
0
0%
仲裁
0
逾期
0
空闲
5
开发者 5
等级
(31)
项目
35
46%
仲裁
0
逾期
0
空闲
发布者: 3 代码
6
开发者 6
等级
(173)
项目
201
49%
仲裁
18
11% / 44%
逾期
1
0%
空闲
7
开发者 7
等级
(29)
项目
49
22%
仲裁
13
31% / 15%
逾期
13
27%
工作中
8
开发者 8
等级
(8)
项目
10
10%
仲裁
0
逾期
4
40%
工作中
9
开发者 9
等级
(240)
项目
255
52%
仲裁
0
逾期
5
2%
空闲
10
开发者 10
等级
(7)
项目
11
0%
仲裁
4
0% / 75%
逾期
2
18%
工作中
11
开发者 11
等级
(434)
项目
461
69%
仲裁
6
67% / 0%
逾期
2
0%
工作中
12
开发者 12
等级
(77)
项目
231
73%
仲裁
6
100% / 0%
逾期
1
0%
空闲

项目信息

预算
30 USD
VAT (21%): 6.3 - 6.3 USD
总计: 36.3 - 36.3 USD
开发人员
27 - 27 USD
截止日期
 1  3 天