设为首页 收藏本站 切换语言

太多的参数,如何隐藏?

| 发表于 2022-7-29 12:32:12 | 显示全部楼层 |复制链接
哪位大神知道多余的参数,如何隐藏?



//+------------------------------------------------------------------+
//| macd vs macd[1] |
//+------------------------------------------------------------------+

#property indicator_buffers 6
#property indicator_separate_window
#property indicator_level1 0
#property indicator_color1 White
#property indicator_color2 Red
#property indicator_color3 Red
#property indicator_color4 Lime
#property indicator_color5 Yellow
#property indicator_color6 Blue

//---- buffers
double Buffer1[];
double Buffer2[];
double Buffer3[];
double Buffer4[];
double UP[];
double DO[];

extern int Fast = 12;
extern int Slow = 26;
extern int Signal = 9;
extern bool Alert_Switch=true;
static double SX;


//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   //IndicatorBuffers(3);
   SetIndexStyle(0,DRAW_LINE,0,1);
   SetIndexStyle(1,DRAW_LINE,0,1);
   SetIndexStyle(2,DRAW_HISTOGRAM,0,2);
   SetIndexStyle(3,DRAW_HISTOGRAM,0,2);
   SetIndexStyle(4,DRAW_ARROW);
   SetIndexStyle(5,DRAW_ARROW);
   SetIndexArrow(4,233);
   SetIndexArrow(5,234);

   SetIndexBuffer(0,Buffer1);
   SetIndexBuffer(1,Buffer2);
   SetIndexBuffer(2,Buffer3);
   SetIndexBuffer(3,Buffer4);
   SetIndexBuffer(4,UP);
   SetIndexBuffer(5,DO);


   IndicatorShortName("MACD("+Fast+","+Slow+","+Signal+")");
   SetIndexLabel(0,"MACD_MAIN");
   SetIndexLabel(1,"MACD_SIGNAL");
   SetIndexLabel(2,"MAIN-SIGNAL");
   SetIndexLabel(3,"MAIN-SIGNAL");
   SetIndexLabel(4,"BUY_SIGNAL");
   SetIndexLabel(5,"SELL-SIGNAL");
   IndicatorDigits(Digits+2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int limit,counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   double B_Temp;
  //---- main loop
   for(int i=0; i<limit; i++)
     {
      Buffer1=iMACD(NULL,0,Fast,Slow,Signal,PRICE_CLOSE,MODE_MAIN,i);
      Buffer2=iMACD(NULL,0,Fast,Slow,Signal,PRICE_CLOSE,MODE_SIGNAL,i);
      B_Temp=Buffer1 - Buffer2;
      if (B_Temp>=0)
      {
        Buffer3=B_Temp;
        Buffer4=EMPTY_VALUE;
      }
      else
      {
        Buffer4=B_Temp;
        Buffer3=EMPTY_VALUE;
      }
     }
   for(i=0; i<limit; i++)
     {
      UP=EMPTY_VALUE;
      DO=EMPTY_VALUE;
      if (Buffer1>Buffer2  &&  Buffer1[i+1]<Buffer2[i+1])
      UP=Buffer2;
      if (Buffer1<Buffer2  &&  Buffer1[i+1]>Buffer2[i+1])
      DO=Buffer2;
      if (Buffer1>Buffer2  &&  Buffer1[i+1]==Buffer2[i+1]  &&  Buffer1[i+2]<Buffer2[i+2])
      UP=Buffer2;
      if (Buffer1<Buffer2  &&  Buffer1[i+1]==Buffer2[i+1]  &&  Buffer1[i+2]>Buffer2[i+2])
      DO=Buffer2;
     }
   if (Alert_Switch==true && Buffer1[0]>Buffer2[0]  &&  Buffer1[1]<Buffer2[1] && SX!=Time[0])
   {
     Alert(Symbol(),"  ",Period(),":","MACD金叉");
     SX=Time[0];
   }
   if (Alert_Switch==true && Buffer1[0]<Buffer2[0]  &&  Buffer1[1]>Buffer2[1] && SX!=Time[0])
   {
     SX=Time[0];
     Alert(Symbol(),"  ",Period(),":","MACD死叉");
   }
   if (Alert_Switch==true && Buffer1[0]>Buffer2[0]  &&  Buffer1[1]==Buffer2[1]  &&  Buffer1[2]<Buffer2[2] && SX!=Time[0])
   {
     SX=Time[0];
     Alert(Symbol(),"  ",Period(),":","MACD金叉");
   }
   if (Alert_Switch==true && Buffer1[0]<Buffer2[0]  &&  Buffer1[1]==Buffer2[1]  &&  Buffer1[2]>Buffer2[2] && SX!=Time[0])
   {
     SX=Time[0];
     Alert(Symbol(),"  ",Period(),":","MACD死叉");
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+

image.png
举报

评论 使用道具

精彩评论2

davidwu
DDD
| 发表于 2022-7-29 20:07:44 | 显示全部楼层
IndicatorShortName("MACD("+Fast+","+Slow+","+Signal+")");删了
举报

点赞 评论 使用道具

qwe11
CCC
 楼主 | 发表于 2022-7-29 21:46:27 | 显示全部楼层
谢谢兄弟,我试试
举报

点赞 评论 使用道具

发新帖
EA交易
您需要登录后才可以评论 登录 | 立即注册

简体中文
繁體中文
English(英语)
日本語(日语)
Deutsch(德语)
Русский язык(俄语)
بالعربية(阿拉伯语)
Türkçe(土耳其语)
Português(葡萄牙语)
ภาษาไทย(泰国语)
한어(朝鲜语/韩语)
Français(法语)