请选择 进入手机版 | 继续访问电脑版

外汇论坛 外兔财经

查看: 5677|回复: 0

【求助】在指标上加上警报程序就卡死?

[复制链接]

2

主题

2

帖子

2

积分

初学乍练

Rank: 1

注册时间
2012-10-26

发表于 2012-11-25 09:51 | 显示全部楼层 |阅读模式
https://www.y2.cn
  1. #property indicator_separate_window
  2. #property indicator_buffers 4
  3. #property indicator_color1 Black
  4. #property indicator_color2 Red
  5. #property indicator_color3 Black
  6. #property indicator_color4 Red


  7. extern bool EmailON=false;
  8. extern int FastEMA = 12;
  9. extern int SlowEMA = 26;
  10. extern int SignalSMA = 9;
  11. double g_ibuf_88[];
  12. double g_ibuf_92[];
  13. double g_ibuf_96[];
  14. double g_ibuf_100[];

  15. int init() {
  16.    SetIndexStyle(0, DRAW_HISTOGRAM);
  17.    SetIndexStyle(1, DRAW_LINE);
  18.    SetIndexDrawBegin(1, SignalSMA);
  19.    IndicatorDigits(Digits + 1);
  20.    SetIndexBuffer(0, g_ibuf_88);
  21.    SetIndexBuffer(1, g_ibuf_92);
  22.    SetIndexBuffer(2, g_ibuf_96);
  23.    SetIndexBuffer(3, g_ibuf_100);
  24.    SetIndexStyle(2, DRAW_ARROW);
  25.    SetIndexStyle(3, DRAW_ARROW);
  26.    SetIndexArrow(2, 233);
  27.    SetIndexArrow(3, 234);
  28.    IndicatorShortName("MACD(" + FastEMA + "," + SlowEMA + "," + SignalSMA + ")");
  29.    SetIndexLabel(0, "MACD");
  30.    SetIndexLabel(1, "Signal");
  31.    return (0);
  32. }

  33. int start() {
  34.    int li_4 = IndicatorCounted();
  35.    if (li_4 > 0) li_4--;
  36.    int li_0 = Bars - li_4;
  37.    for (int li_8 = 0; li_8 < li_0; li_8++) g_ibuf_88[li_8] = iMA(NULL, 0, FastEMA, 0, MODE_EMA, PRICE_CLOSE, li_8) - iMA(NULL, 0, SlowEMA, 0, MODE_EMA, PRICE_CLOSE, li_8);
  38.    for (li_8 = 0; li_8 < li_0; li_8++) g_ibuf_92[li_8] = iMAOnArray(g_ibuf_88, Bars, SignalSMA, 0, MODE_SMA, li_8);
  39.    for (li_8 = 0; li_8 < li_0; li_8++) {
  40.       if (g_ibuf_88[li_8 + 1] < 0.0 && g_ibuf_88[li_8] > 0.0) g_ibuf_96[li_8] = g_ibuf_88[li_8];
  41.      
  42.       Alert(Symbol()+"MACD 上穿0轴");
  43.       
  44.          if (g_ibuf_88[li_8 + 1] > 0.0 && g_ibuf_88[li_8] < 0.0) g_ibuf_100[li_8] = g_ibuf_88[li_8];
  45.         
  46.       Alert(Symbol()+"MACD 下穿0轴");
  47.       
  48.    }
  49.    return (0);
  50. }
复制代码
请问,如题,加载上去就不断提示直至卡死,如何改写才让它只提示一次呢?谢谢!!!

本版积分规则

QQ|手机版 Mobile Version|Archiver|关于我们 About Us|联系我们 Contact Us|Y2外汇论坛 外兔财经 ( 粤ICP备15092430号-3

GMT+8, 2019-10-23 21:30 , Processed in 0.041865 second(s), 34 queries .

Powered by Discuz! X7.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表