有您的持续关注
我们会做得更好

MT4货币相对强弱指标



MT4货币相对强弱指标可以实时监测各个货币相对其它货币对强弱情况,做超短选择货币对适用。

新建一个指标文件,路径保存在MT4自定义指标文件里。然后复制下面代码进去。编译后插入图表如下:

a11

MQL4源码如下

//---------------------
 xdqr.mq4
 //--------------------------------------------------
 #property copyright "www.125808047.com"
 #property link      "http://www.125808047.com/"
#property indicator_chart_window
extern bool CalcPannel_Enabled = TRUE;
 extern bool CandleTime_Enabled = TRUE;
 extern bool PriceMeter_Enabled = TRUE;
 extern bool Pannel_On_Right = TRUE;
 extern color Label_Color = SkyBlue;
 extern color Value_Color1 = Orange;
 extern color Value_Color2 = GreenYellow;
 extern color CandleTime_Color = DimGray;
 bool Gloi_108;
 int Gloia_112[18];
 int Gloia_116[18];
 int Gloia_120[18];
 int Gloia_124[8];
 int Gloia_128[8];
 int Gloia_132[9] = {4, 10, 25, 40, 50, 60, 75, 90, 97};
 string Glosa_136[8] = {"NZD", "CAD", "CHF", "AUD", "JPY", "USD", "GBP", "EUR"};
 string Glosa_140[18] = {"EURUSD", "GBPUSD", "AUDUSD", "USDJPY", "USDCHF", "USDCAD", "EURJPY", "EURGBP", "EURCHF", "EURAUD", "GBPJPY", "GBPCHF", "CADJPY", "EURCAD", "AUDCAD", "AUDJPY", "AUDNZD",
      "NZDUSD"};
 int Gloia_144[10] = {10495, 20735, 30975, 41215, 48895, 46280, 51350, 56420, 61490, 65280};
int init() {
   Gloi_108 = TRUE;
   return (0);
 }
int deinit() {
   ObjectsDeleteAll();
   return (0);
 }
int start() {
   CalcPannel();
   PriceMeter();
   if (Gloi_108) Gloi_108 = FALSE;
   return (0);
 }
void SideLabel(string Arg_name_0, int Arg_x_8, int Arg_y_12, int Arg_corner_16 = 0) {
   if (ObjectFind(Arg_name_0) != 0) {
      ObjectCreate(Arg_name_0, OBJ_LABEL, 0, 0, 0);
      if (Pannel_On_Right) Arg_corner_16++;
      ObjectSet(Arg_name_0, OBJPROP_CORNER, Arg_corner_16);
      ObjectSet(Arg_name_0, OBJPROP_XDISTANCE, Arg_x_8);
      ObjectSet(Arg_name_0, OBJPROP_YDISTANCE, Arg_y_12);
   }
 }
double DayRange(bool Argi_0 = TRUE) {
   double Locd_4 = iHigh(NULL, PERIOD_D1, 1) - iLow(NULL, PERIOD_D1, 1);
   double Locd_12 = Locd_4 + iHigh(NULL, PERIOD_D1, 2) - iLow(NULL, PERIOD_D1, 2);
   Locd_12 += iHigh(NULL, PERIOD_D1, 3) - iLow(NULL, PERIOD_D1, 3);
   Locd_12 += iHigh(NULL, PERIOD_D1, 4) - iLow(NULL, PERIOD_D1, 4);
   Locd_12 += iHigh(NULL, PERIOD_D1, 5) - iLow(NULL, PERIOD_D1, 5);
   double Locd_20 = Locd_12 + iHigh(NULL, PERIOD_D1, 6) - iLow(NULL, PERIOD_D1, 6);
   Locd_20 += iHigh(NULL, PERIOD_D1, 7) - iLow(NULL, PERIOD_D1, 7);
   Locd_20 += iHigh(NULL, PERIOD_D1, 8) - iLow(NULL, PERIOD_D1, 8);
   Locd_20 += iHigh(NULL, PERIOD_D1, 9) - iLow(NULL, PERIOD_D1, 9);
   Locd_20 += iHigh(NULL, PERIOD_D1, 10) - iLow(NULL, PERIOD_D1, 10);
   double Locd_28 = Locd_20 + iHigh(NULL, PERIOD_D1, 11) - iLow(NULL, PERIOD_D1, 11);
   Locd_28 += iHigh(NULL, PERIOD_D1, 12) - iLow(NULL, PERIOD_D1, 12);
   Locd_28 += iHigh(NULL, PERIOD_D1, 13) - iLow(NULL, PERIOD_D1, 13);
   Locd_28 += iHigh(NULL, PERIOD_D1, 14) - iLow(NULL, PERIOD_D1, 14);
   Locd_28 += iHigh(NULL, PERIOD_D1, 15) - iLow(NULL, PERIOD_D1, 15);
   Locd_28 += iHigh(NULL, PERIOD_D1, 16) - iLow(NULL, PERIOD_D1, 16);
   Locd_28 += iHigh(NULL, PERIOD_D1, 17) - iLow(NULL, PERIOD_D1, 17);
   Locd_28 += iHigh(NULL, PERIOD_D1, 18) - iLow(NULL, PERIOD_D1, 18);
   Locd_28 += iHigh(NULL, PERIOD_D1, 19) - iLow(NULL, PERIOD_D1, 19);
   Locd_28 += iHigh(NULL, PERIOD_D1, 20) - iLow(NULL, PERIOD_D1, 20);
   Locd_12 = 0.2 * Locd_12;
   Locd_20 /= 10.0;
   Locd_28 = 0.05 * Locd_28;
   if (Argi_0) return ((Locd_4 + Locd_12 + Locd_20 + Locd_28) / 4.0 / Point);
   return ((Locd_4 + Locd_12 + Locd_20 + Locd_28) / 8.0);
 }
void CalcPannel() {
   int Loci_0;
   int Loci_4;
   string Locs_8;
   if (CalcPannel_Enabled != FALSE) {
      if (Gloi_108) {
         SideLabel("labOpen", 73, 15);
         SideLabel("valOpen", 17, 15);
         SideLabel("labMaxP", 73, 30);
         SideLabel("valMaxP", 17, 30);
         SideLabel("labMinP", 73, 45);
         SideLabel("valMinP", 17, 45);
         SideLabel("labPoint", 73, 60);
         SideLabel("valPoint", 17, 60);
         SideLabel("labAV", 73, 75);
         SideLabel("valAV", 17, 75);
         SideLabel("labDV", 73, 90);
         SideLabel("valDV", 17, 90);
         SideLabel("labOffset", 73, 105);
         SideLabel("valOffset", 17, 105);
         SideLabel("valPrice", 17, 127);
         if (CandleTime_Enabled == TRUE) SideLabel("valCTime", 17, 147);
         ObjectSetText("labOpen", "开盘价", 9, "Arial", Label_Color);
         ObjectSetText("labMaxP", "最高价", 9, "Arial", Label_Color);
         ObjectSetText("labMinP", "最低价", 9, "Arial", Label_Color);
         ObjectSetText("labPoint", "交易点差", 9, "Arial", Label_Color);
         ObjectSetText("labAV", "日均波幅", 9, "Arial", Label_Color);
         ObjectSetText("labDV", "当日波幅", 9, "Arial", Label_Color);
         ObjectSetText("labOffset", "开盘涨跌", 9, "Arial", Label_Color);
      }
      ObjectSetText("valOpen", DoubleToStr(iOpen(NULL, PERIOD_D1, 0), Digits), 9, "Arial Black", Value_Color1);
      ObjectSetText("valMaxP", DoubleToStr(iHigh(NULL, PERIOD_D1, 0), Digits), 9, "Arial Black", Value_Color1);
      ObjectSetText("valMinP", DoubleToStr(iLow(NULL, PERIOD_D1, 0), Digits), 9, "Arial Black", Value_Color1);
      ObjectSetText("valPoint", DoubleToStr((Ask - Bid) / Point, 0), 9, "Arial Black", Value_Color2);
      ObjectSetText("valAV", DoubleToStr(DayRange(), 0), 9, "Arial Black", Value_Color2);
      ObjectSetText("valDV", DoubleToStr((iHigh(NULL, PERIOD_D1, 0) - iLow(NULL, PERIOD_D1, 0)) / Point, 0), 9, "Arial Black", Value_Color2);
      ObjectSetText("valOffset", DoubleToStr((iClose(NULL, PERIOD_D1, 0) - iOpen(NULL, PERIOD_D1, 0)) / Point, 0), 9, "Arial Black", Value_Color2);
      ObjectSetText("valPrice", DoubleToStr(Bid, Digits), 14, "Verdana", Value_Color1);
      if (CandleTime_Enabled == TRUE) {
         Loci_0 = Time[0] + 60 * Period() - TimeCurrent();
         Loci_4 = Loci_0 % 60;
         Loci_0 = (Loci_0 - Loci_4) / 60;
         if (Loci_0 >= 0) {
            Locs_8 = Loci_4;
            if (StringLen(Locs_8) == 1) Locs_8 = "0" + Locs_8;
            ObjectSetText("valCTime", Loci_0 + ":" + Locs_8, 14, "Verdana", CandleTime_Color);
         }
      }
   }
 }
void PriceMeter() {
   int Loci_4;
   double point_8;
   double Locd_16;
   double Locd_24;
   double Locd_32;
   double low_40;
   string symbol_48;
   if (PriceMeter_Enabled != FALSE) {
      if (Gloi_108) {
         for (int index_0 = 0; index_0 < 18; index_0++) {
            symbol_48 = Glosa_140[index_0];
            point_8 = MarketInfo(symbol_48, MODE_POINT);
            if (point_8 == 0.0) {
               Gloia_112[index_0] = 0;
               Gloia_116[index_0] = 0;
               Gloia_120[index_0] = 0;
            } else Gloia_120[index_0] = 1;
         }
         Gloia_124[7] = Gloia_120[0] + Gloia_120[6] + Gloia_120[7] + Gloia_120[8] + Gloia_120[9];
         Gloia_124[6] = Gloia_120[1] + Gloia_120[10] + Gloia_120[11] + Gloia_120[7];
         Gloia_124[5] = Gloia_120[3] + Gloia_120[4] + Gloia_120[5] + Gloia_120[0] + Gloia_120[1] + Gloia_120[2] + Gloia_120[17];
         Gloia_124[4] = Gloia_120[3] + Gloia_120[6] + Gloia_120[10] + Gloia_120[12] + Gloia_120[15];
         Gloia_124[3] = Gloia_120[2] + Gloia_120[9] + Gloia_120[14] + Gloia_120[15] + Gloia_120[16];
         Gloia_124[2] = Gloia_120[4] + Gloia_120[8] + Gloia_120[11];
         Gloia_124[1] = Gloia_120[5] + Gloia_120[14] + Gloia_120[13] + Gloia_120[12];
         Gloia_124[0] = Gloia_120[16] + Gloia_120[17];
         Loci_4 = 12;
         for (index_0 = 0; index_0 < 8; index_0++) {
            if (Gloia_124[index_0] > 0) {
               symbol_48 = "lab" + Glosa_136[index_0];
               SideLabel(symbol_48, 73, Loci_4, 2);
               ObjectSetText(symbol_48, Glosa_136[index_0], 9, "Arial", Label_Color);
               Loci_4 += 15;
            }
         }
      }
      for (index_0 = 0; index_0 < 18; index_0++) {
         if (Gloia_120[index_0] != 0) {
            symbol_48 = Glosa_140[index_0];
            point_8 = MarketInfo(symbol_48, MODE_POINT);
            Locd_32 = MarketInfo(symbol_48, MODE_HIGH);
            low_40 = MarketInfo(symbol_48, MODE_LOW);
            Locd_16 = MathMax((Locd_32 - low_40) / point_8, 1);
            Locd_32 = MarketInfo(symbol_48, MODE_BID);
            Locd_24 = (Locd_32 - low_40) / Locd_16 / point_8;
            Gloia_112[index_0] = iLookup(100.0 * Locd_24);
            Gloia_116[index_0] = 9 - Gloia_112[index_0];
         }
      }
      Gloia_128[5] = Gloia_112[3] + Gloia_112[4] + Gloia_112[5] + Gloia_116[0] + Gloia_116[1] + Gloia_116[2] + Gloia_116[17];
      Gloia_128[7] = Gloia_112[0] + Gloia_112[6] + Gloia_112[7] + Gloia_112[8] + Gloia_112[9];
      Gloia_128[6] = Gloia_112[1] + Gloia_112[10] + Gloia_112[11] + Gloia_116[7];
      Gloia_128[2] = Gloia_116[4] + Gloia_116[8] + Gloia_116[11];
      Gloia_128[1] = Gloia_116[5] + Gloia_116[14] + Gloia_116[13] + Gloia_112[12];
      Gloia_128[3] = Gloia_112[2] + Gloia_116[9] + Gloia_112[14] + Gloia_112[15] + Gloia_112[16];
      Gloia_128[4] = Gloia_116[3] + Gloia_116[6] + Gloia_116[10] + Gloia_116[12] + Gloia_116[15];
      Gloia_128[0] = Gloia_116[16] + Gloia_112[17];
      Loci_4 = 12;
      for (index_0 = 0; index_0 < 8; index_0++) {
         if (Gloia_124[index_0] > 0) {
            Locd_32 = Gloia_128[index_0];
            Locd_32 /= Gloia_124[index_0];
            PairBlock(Glosa_136[index_0], Locd_32, Loci_4);
            Loci_4 += 15;
         }
      }
   }
 }
int iLookup(double Argd_0) {
   for (int index_8 = 0; index_8 < 9; index_8++)
      if (Argd_0 < Gloia_132[index_8]) break;
   return (index_8);
 }
void PairDelete(string Args_0) {
   string name_8;
   for (int Loci_16 = 1; Loci_16 <= 30; Loci_16++) {
      name_8 = Args_0 + Loci_16;
      if (ObjectFind(name_8) < 0) break;
      ObjectDelete(name_8);
   }
 }
void PairBlock(string Args_0, double Argd_8, int Argi_16) {
   int Loci_20;
   string name_32;
   PairDelete(Args_0);
   if (Argd_8 >= 9.0) Loci_20 = 9;
   else {
      if (Argd_8 >= 8.0) Loci_20 = 8;
      else {
         if (Argd_8 >= 7.0) Loci_20 = 7;
         else {
            if (Argd_8 >= 6.0) Loci_20 = 6;
            else {
               if (Argd_8 >= 5.0) Loci_20 = 5;
               else {
                  if (Argd_8 >= 4.0) Loci_20 = 4;
                  else {
                     if (Argd_8 >= 3.0) Loci_20 = 3;
                     else {
                        if (Argd_8 >= 2.0) Loci_20 = 2;
                        else {
                           if (Argd_8 >= 1.0) Loci_20 = 1;
                           else Loci_20 = 0;
                        }
                     }
                  }
               }
            }
         }
      }
   }
   int Loci_24 = 58;
   Argi_16 += 3;
   for (int index_40 = 0; index_40 < Loci_20; index_40++) {
      name_32 = Args_0 + ((3 * index_40 + 1));
      SideLabel(name_32, Loci_24, Argi_16, 2);
      ObjectSetText(name_32, "|", 6, "Arial Black", Gloia_144[index_40]);
      name_32 = Args_0 + ((3 * index_40 + 2));
      SideLabel(name_32, Loci_24 - 1, Argi_16, 2);
      ObjectSetText(name_32, "|", 6, "Arial Black", Gloia_144[index_40]);
      name_32 = Args_0 + ((3 * index_40 + 3));
      SideLabel(name_32, Loci_24 - 2, Argi_16, 2);
      ObjectSetText(name_32, "|", 6, "Arial Black", Gloia_144[index_40]);
      Loci_24 -= 5;
   }
   name_32 = Args_0 + ((3 * Loci_20 + 1));
   SideLabel(name_32, Loci_24, Argi_16, 2);
   ObjectSetText(name_32, "|", 6, "Arial Black", Gloia_144[Loci_20]);
   name_32 = Args_0 + ((3 * Loci_20 + 2));
   SideLabel(name_32, Loci_24 - 1, Argi_16, 2);
   ObjectSetText(name_32, "|", 6, "Arial Black", Gloia_144[Loci_20]);
   Argd_8 -= Loci_20;
   if (Argd_8 >= 0.5) {
      name_32 = Args_0 + ((3 * Loci_20 + 3));
      SideLabel(name_32, Loci_24 - 2, Argi_16, 2);
      ObjectSetText(name_32, "|", 6, "Arial Black", Gloia_144[Loci_20]);
   }
 }

如您喜欢此文章请点下面分享按钮↴峰汇在线 » MT4货币相对强弱指标
上一篇:
下一篇:
分享到:更多 ()

评论 抢沙发

评论前必须登录!