为改指标而来 发表于 2013-9-9 20:20:27

求修改下这个指标!

/*
   Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/
#property copyright "GOLDEN"
#property link      "zx815@126.com"

#property indicator_chart_window

extern bool showPriceLabel = TRUE;
double g_ihigh_80;
double g_ilow_88;
double g_iopen_96;
double g_iclose_104;
double gd_112;
double gd_120;
double gd_128;
double gd_136;
double gd_144;
double gd_152;
double gd_160;
double gd_168;
double gd_176;
double gd_184;
double gd_192;

int init() {
   return (0);
}

int deinit() {
   ObjectsDeleteAll(0, OBJ_TREND);
   ObjectsDeleteAll(0, OBJ_TEXT);
   return (0);
}

int start() {
   g_ihigh_80 = iHigh(NULL, PERIOD_D1, 1);
   g_ilow_88 = iLow(NULL, PERIOD_D1, 1);
   g_iopen_96 = iOpen(NULL, PERIOD_D1, 1);
   g_iclose_104 = iClose(NULL, PERIOD_D1, 1);
   gd_112 = NormalizeDouble((g_ihigh_80 + g_ilow_88 + g_iclose_104) / 3.0, Digits);
   gd_120 = NormalizeDouble(gd_112 + 20.0 * Point, Digits);
   gd_128 = NormalizeDouble(gd_112 + 40.0 * Point, Digits);
   gd_160 = NormalizeDouble(gd_112 - 20.0 * Point, Digits);
   gd_168 = NormalizeDouble(gd_112 - 40.0 * Point, Digits);
   gd_152 = NormalizeDouble(2.0 * gd_112 + (g_ihigh_80 - 2.0 * g_ilow_88) + 5.0 * Point, Digits);
   gd_192 = NormalizeDouble(2.0 * gd_112 - (2.0 * g_ihigh_80 - g_ilow_88) - 5.0 * Point, Digits);
   gd_144 = NormalizeDouble(gd_112 + (g_ihigh_80 - g_ilow_88) + 5.0 * Point, Digits);
   gd_184 = NormalizeDouble(gd_112 - (g_ihigh_80 - g_ilow_88) - 5.0 * Point, Digits);
   gd_136 = NormalizeDouble(gd_120 + gd_112 - g_ilow_88 - 5.0 * Point, Digits);
   gd_176 = NormalizeDouble(gd_160 + gd_112 - g_ihigh_80 + 5.0 * Point, Digits);
   int l_datetime_0 = iTime(NULL, PERIOD_D1, 0);
   int l_datetime_4 = iTime(NULL, PERIOD_D1, 1);
   int l_datetime_8 = iTime(NULL, 0, 0);
   creatTrendLineObj2(" Line YH", l_datetime_4, g_ihigh_80, l_datetime_8, g_ihigh_80, Orange, 1, STYLE_DOT);
   createTextObj(" Text YH", l_datetime_4, g_ihigh_80, StringConcatenate(": ", g_ihigh_80));
   creatTrendLineObj2(" Line YL", l_datetime_4, g_ilow_88, l_datetime_8, g_ilow_88, Orange, 1, STYLE_DOT);
   createTextObj(" Text YL", l_datetime_4, g_ilow_88, StringConcatenate(": ", g_ilow_88));
   creatTrendLineObj2(" Line YS", l_datetime_4, 0, l_datetime_4, 1, DarkGray, 1, STYLE_DOT);
   creatTrendLineObj2(" Line YE", l_datetime_0, 0, l_datetime_0, 1, DarkGray, 1, STYLE_DOT);
   creatTrendLineObj(" Line M", l_datetime_0, gd_112, l_datetime_8, Gray, 5);
   creatTrendLineObj(" Line H1", l_datetime_0, gd_120, l_datetime_8, DarkBlue, 5);
   creatTrendLineObj(" Line H2", l_datetime_0, gd_128, l_datetime_8, DarkBlue, 5);
   creatTrendLineObj(" Line H3", l_datetime_0, gd_136, l_datetime_8, DarkBlue, 5);
   creatTrendLineObj(" Line H4", l_datetime_0, gd_144, l_datetime_8, DarkBlue, 5);
   creatTrendLineObj(" Line H5", l_datetime_0, gd_152, l_datetime_8, DarkBlue, 5);
   creatTrendLineObj(" Line L1", l_datetime_0, gd_160, l_datetime_8, Maroon, 5);
   creatTrendLineObj(" Line L2", l_datetime_0, gd_168, l_datetime_8, Maroon, 5);
   creatTrendLineObj(" Line L3", l_datetime_0, gd_176, l_datetime_8, Maroon, 5);
   creatTrendLineObj(" Line L4", l_datetime_0, gd_184, l_datetime_8, Maroon, 5);
   creatTrendLineObj(" Line L5", l_datetime_0, gd_192, l_datetime_8, Maroon, 5);
   if (showPriceLabel) {
      createTextObj(" Text M", l_datetime_0, gd_112, StringConcatenate(": ", gd_112));
      createTextObj(" Text H1", l_datetime_0, gd_120, StringConcatenate(" Start: ", gd_120));
      createTextObj(" Text H2", l_datetime_0, gd_128, StringConcatenate(" End: ", gd_128));
      createTextObj(" Text H3", l_datetime_0, gd_136, StringConcatenate(": ", gd_136));
      createTextObj(" Text H4", l_datetime_0, gd_144, StringConcatenate(": ", gd_144));
      createTextObj(" Text H5", l_datetime_0, gd_152, StringConcatenate(": ", gd_152));
      createTextObj(" Text L1", l_datetime_0, gd_160, StringConcatenate(" Start: ", gd_160));
      createTextObj(" Text L2", l_datetime_0, gd_168, StringConcatenate(" End: ", gd_168));
      createTextObj(" Text L3", l_datetime_0, gd_176, StringConcatenate(": ", gd_176));
      createTextObj(" Text L4", l_datetime_0, gd_184, StringConcatenate(": ", gd_184));
      createTextObj(" Text L5", l_datetime_0, gd_192, StringConcatenate(": ", gd_192));
   }
   for (int li_12 = 1; li_12 < 20; li_12++) {
      creatTrendLineObj(StringConcatenate(" Line HH", li_12), l_datetime_0, gd_120 + li_12 * Point, l_datetime_8, DarkBlue, 1);
      creatTrendLineObj(StringConcatenate(" Line LL", li_12), l_datetime_0, gd_168 + li_12 * Point, l_datetime_8, Maroon, 1);
      creatTrendLineObj(StringConcatenate(" Line MH", li_12), l_datetime_0, gd_112 + li_12 * Point, l_datetime_8, Gray, 1);
      creatTrendLineObj(StringConcatenate(" Line ML", li_12), l_datetime_0, gd_112 - li_12 * Point, l_datetime_8, Gray, 1);
   }
   return (0);
}

void creatTrendLineObj(string a_name_0, int a_datetime_8, double a_price_12, int a_datetime_20, color a_color_24, int a_width_28) {
   ObjectDelete(a_name_0);
   ObjectCreate(a_name_0, OBJ_TREND, 0, a_datetime_8, a_price_12, a_datetime_20, a_price_12);
   ObjectSet(a_name_0, OBJPROP_BACK, TRUE);
   ObjectSet(a_name_0, OBJPROP_COLOR, a_color_24);
   ObjectSet(a_name_0, OBJPROP_WIDTH, a_width_28);
}

void creatTrendLineObj2(string a_name_0, int a_datetime_8, double a_price_12, int a_datetime_20, double a_price_24, color a_color_32, int a_width_36, int a_style_40) {
   ObjectDelete(a_name_0);
   ObjectCreate(a_name_0, OBJ_TREND, 0, a_datetime_8, a_price_12, a_datetime_20, a_price_24);
   ObjectSet(a_name_0, OBJPROP_BACK, TRUE);
   ObjectSet(a_name_0, OBJPROP_COLOR, a_color_32);
   ObjectSet(a_name_0, OBJPROP_WIDTH, a_width_36);
   ObjectSet(a_name_0, OBJPROP_STYLE, a_style_40);
}

void createTextObj(string a_name_0, int a_datetime_8, double a_price_12, string a_text_20) {
   ObjectDelete(a_name_0);
   ObjectCreate(a_name_0, OBJ_TEXT, 0, a_datetime_8, a_price_12);
   ObjectSetText(a_name_0, a_text_20, 8, "Arial", White);
}

修改为5位数报价平台,修改成周线的周期,就是现在的计算方法是每天改为周,从周一开始一直显示一周的压力支撑,原指标是每天都不同


为改指标而来 发表于 2013-9-9 20:21:59

很简单的修改可惜难着不会会者不难,哪位大大帮个忙,感激不尽。

jia 发表于 2013-9-9 21:39:21

看日志里的错误代码是多少

523934532 发表于 2014-12-21 17:02:04

nice!!!!!!!!!!!!

yhpeqhlc 发表于 2014-12-25 18:06:23

★西狂 发表于 2015-1-4 01:13:51

想学EA,拜师,谁收了我吧

winterlight 发表于 2015-1-14 05:01:34

研究研究

君伊理财 发表于 2015-1-29 13:51:01

今天黄金怎么操作

风清云淡 发表于 2018-8-26 10:55:36

谢谢分享
页: [1]
查看完整版本: 求修改下这个指标!