8评论

0收藏

求修改下这个指标!

avatar 为改指标而来 | 4338 人阅读 | 8 人评论 | 2013-09-09

/*
   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("[Golden MA] Line YH", l_datetime_4, g_ihigh_80, l_datetime_8, g_ihigh_80, Orange, 1, STYLE_DOT);
   createTextObj("[Golden MA] Text YH", l_datetime_4, g_ihigh_80, StringConcatenate("[Yesterday High]: ", g_ihigh_80));
   creatTrendLineObj2("[Golden MA] Line YL", l_datetime_4, g_ilow_88, l_datetime_8, g_ilow_88, Orange, 1, STYLE_DOT);
   createTextObj("[Golden MA] Text YL", l_datetime_4, g_ilow_88, StringConcatenate("[Yesterday Low]: ", g_ilow_88));
   creatTrendLineObj2("[Golden MA] Line YS", l_datetime_4, 0, l_datetime_4, 1, DarkGray, 1, STYLE_DOT);
   creatTrendLineObj2("[Golden MA] Line YE", l_datetime_0, 0, l_datetime_0, 1, DarkGray, 1, STYLE_DOT);
   creatTrendLineObj("[Golden MA] Line M", l_datetime_0, gd_112, l_datetime_8, Gray, 5);
   creatTrendLineObj("[Golden MA] Line H1", l_datetime_0, gd_120, l_datetime_8, DarkBlue, 5);
   creatTrendLineObj("[Golden MA] Line H2", l_datetime_0, gd_128, l_datetime_8, DarkBlue, 5);
   creatTrendLineObj("[Golden MA] Line H3", l_datetime_0, gd_136, l_datetime_8, DarkBlue, 5);
   creatTrendLineObj("[Golden MA] Line H4", l_datetime_0, gd_144, l_datetime_8, DarkBlue, 5);
   creatTrendLineObj("[Golden MA] Line H5", l_datetime_0, gd_152, l_datetime_8, DarkBlue, 5);
   creatTrendLineObj("[Golden MA] Line L1", l_datetime_0, gd_160, l_datetime_8, Maroon, 5);
   creatTrendLineObj("[Golden MA] Line L2", l_datetime_0, gd_168, l_datetime_8, Maroon, 5);
   creatTrendLineObj("[Golden MA] Line L3", l_datetime_0, gd_176, l_datetime_8, Maroon, 5);
   creatTrendLineObj("[Golden MA] Line L4", l_datetime_0, gd_184, l_datetime_8, Maroon, 5);
   creatTrendLineObj("[Golden MA] Line L5", l_datetime_0, gd_192, l_datetime_8, Maroon, 5);
   if (showPriceLabel) {
      createTextObj("[Golden MA] Text M", l_datetime_0, gd_112, StringConcatenate("[Middle Area]: ", gd_112));
      createTextObj("[Golden MA] Text H1", l_datetime_0, gd_120, StringConcatenate("[Buy Area] Start: ", gd_120));
      createTextObj("[Golden MA] Text H2", l_datetime_0, gd_128, StringConcatenate("[Buy Area] End: ", gd_128));
      createTextObj("[Golden MA] Text H3", l_datetime_0, gd_136, StringConcatenate("[Reversal High]: ", gd_136));
      createTextObj("[Golden MA] Text H4", l_datetime_0, gd_144, StringConcatenate("[WARNING! OVERBOUGHT]: ", gd_144));
      createTextObj("[Golden MA] Text H5", l_datetime_0, gd_152, StringConcatenate("[DANGER! STOP BUY HERE!]: ", gd_152));
      createTextObj("[Golden MA] Text L1", l_datetime_0, gd_160, StringConcatenate("[Sell Area] Start: ", gd_160));
      createTextObj("[Golden MA] Text L2", l_datetime_0, gd_168, StringConcatenate("[Sell Area] End: ", gd_168));
      createTextObj("[Golden MA] Text L3", l_datetime_0, gd_176, StringConcatenate("[Reversal Low]: ", gd_176));
      createTextObj("[Golden MA] Text L4", l_datetime_0, gd_184, StringConcatenate("[WARNING! OVERSOLD]: ", gd_184));
      createTextObj("[Golden MA] Text L5", l_datetime_0, gd_192, StringConcatenate("[DANGER! STOP SELL HERE!]: ", gd_192));
   }
   for (int li_12 = 1; li_12 < 20; li_12++) {
      creatTrendLineObj(StringConcatenate("[Golden MA] Line HH", li_12), l_datetime_0, gd_120 + li_12 * Point, l_datetime_8, DarkBlue, 1);
      creatTrendLineObj(StringConcatenate("[Golden MA] Line LL", li_12), l_datetime_0, gd_168 + li_12 * Point, l_datetime_8, Maroon, 1);
      creatTrendLineObj(StringConcatenate("[Golden MA] Line MH", li_12), l_datetime_0, gd_112 + li_12 * Point, l_datetime_8, Gray, 1);
      creatTrendLineObj(StringConcatenate("[Golden MA] 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位数报价平台,修改成周线的周期,就是现在的计算方法是每天改为周,从周一开始一直显示一周的压力支撑,原指标是每天都不同


""
还没有人打赏,支持一下

评论|共 8 个

为改指标而来

发表于 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 | 显示全部楼层

[s:136]

★西狂

发表于 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 | 显示全部楼层

谢谢分享

您需要登录后才可以回帖 登录 | 注册 微信登录

EA之家评论守则