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

MT4自定义指标 支撑线指标



支撑线指标是以最近的两个低点为标准画线。

插入图表效果如下:

MT4自定义指标支撑线MQL4源码如下:

//+------------------------------------------------------------------+
//|                                                       支撑线.mq4 |
//|                                     Copyright 2014, QQ:125808047 |
//+------------------------------------------------------------------+
#property copyright "www.125808047.com"
#property link      "http://www.125808047.com/"

#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
    ObjectCreate("Saport", OBJ_TREND, 0,0,0,0,0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
  ObjectDelete("Saport");   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   
//----
  double F1=0, F3=0, F13;    
  int    B1, B3, SR=2;             
  
  while(F3==0)                      
  {
    F13=iFractals(NULL,0,MODE_LOWER,SR);
    if (F13!=0) 
    {
      if      (F1==0){B1=SR; F1=F13;}
      else if (F3==0){B3=SR; F3=F13;}
    }
    SR++; 
  }
    ObjectSet("Saport", OBJPROP_TIME1 ,iTime(NULL,0,B3));
    ObjectSet("Saport", OBJPROP_TIME2 ,iTime(NULL,0,B1));
    ObjectSet("Saport", OBJPROP_PRICE1,iLow(NULL,0,B3));
    ObjectSet("Saport", OBJPROP_PRICE2,iLow(NULL,0,B1));
    ObjectSet("Saport", OBJPROP_RAY   , True);

  
//----
   return(0);
  }
//+------------------------------------------------------------------+

如您喜欢此文章请点下面分享按钮↴峰汇在线 » MT4自定义指标 支撑线指标
上一篇:
下一篇:
分享到:更多 ()