万能指标代码

楼主  收藏   举报   帖子创建时间:  2019-05-05 15:13 回复:0 关注量:575
很容易的修改万能指标代码 !
  改变红色代码 您的买入卖出条件
  
  
  #property copyright "SH Lim"
  #property link      "singhooilim@yahoo.com"
  
  #property indicator_chart_window
  #property indicator_color1 White
  #property indicator_color2 Yellow
  extern bool alertbuy = false;
  extern bool alertsell = false;
  extern int distance = 5;
  extern int Symbol_1_Kod=181; // 可以改 100 至 255
  extern string NameFileSound = "alert.wav";
  
  #property indicator_buffers 2
  //---- input parameters
  //---- buffers
  double UpBuffer[];
  double DnBuffer[];
  
  //+------------------------------------------------------------------+
  //| Custom indicator initialization function                         |
  //+------------------------------------------------------------------+
  int init()
    {
  //---- indicators
  
    // IndicatorBuffers(2);
     SetIndexStyle(0,DRAW_ARROW,0,0);
     SetIndexArrow(0,Symbol_1_Kod);
     SetIndexBuffer(0,UpBuffer);
     SetIndexEmptyValue(0,0.0);
     
     SetIndexStyle(1,DRAW_ARROW,0,0);
     SetIndexArrow(1,Symbol_1_Kod);
     SetIndexBuffer(1,DnBuffer);
     SetIndexEmptyValue(1,0.0);
     
     SetIndexLabel(0,"Up Signal");
     SetIndexLabel(1,"Down Signal");
  
  //----
     return(0);
    }
  //+------------------------------------------------------------------+
  //| Custor indicator deinitialization function                       |
  //+------------------------------------------------------------------+
  int deinit()
    {
  //----
     
  //----
     return(0);
    }
  //+------------------------------------------------------------------+
  //| Custom indicator iteration function                              |
  //+------------------------------------------------------------------+
  int start()
    {
   
     int limit;
     int counted_bars=IndicatorCounted();
     if(counted_bars0) counted_bars--;
     limit=Bars-counted_bars;
     
   
     for(int i = 0 ;i < limit ;i++)
     {
     
  //indicators
  
  double m1 = iCustom(NULL,0, "MTF_MACD_inColor", 15, 12, 26, 9, 0, 0, i);
  double m1a = iCustom(NULL,0, "MTF_MACD_inColor", 15, 12, 26, 9, 0, 1, i);
  
  double m2 = iCustom(NULL,0, "MTF_MACD_inColor", 30, 12, 26, 9, 0, 0, i);
  double m2a = iCustom(NULL,0, "MTF_MACD_inColor", 30, 12, 26, 9, 0, 1, i);
  
  double m3 = iCustom(NULL,0, "MTF_MACD_inColor", 240, 12, 26, 9, 0, 0, i);
  double m3a = iCustom(NULL,0, "MTF_MACD_inColor", 240, 12, 26, 9, 0, 1, i);
  

  //end of indicators
  
        if((m1>m1a)&&(m2>m2a)&&(m3>m3a)) // Up Trend Condition 上升趋势条件
        {  
          UpBuffer<i> = iLow(Symbol(),0,i)-(distance*Point); // Signal Location 信号位置
          DnBuffer<i> = EMPTY_VALUE;
        if (alertbuy==1) alert("H4 Buy at Ask=",Ask,", Bid=",Bid," Symbol=",Symbol());
  
        }
         else if(<font color="Red">(m1
打赏