huanmei 发表于 2018-12-19 10:18:35

牛版,多空线指标帮忙加个买卖功能好吗

牛版,下面是个多空线指标,帮忙加个买卖功能好吗?就是B金叉D买多,B死叉D卖空,谢谢!
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 White
#property indicator_color2 Yellow

//--- buffers
double a[];
double b[];
double d[];
extern int mx=10;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
   IndicatorBuffers(8);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,b);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,d);
   SetIndexBuffer(2,a);


   IndicatorShortName("DKX");
//----
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                     |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{


   int    counted=IndicatorCounted();
   if(counted<0)return(-1);
   if(counted>0)counted--;
   int i=Bars-counted;
   for(int m=0;m<i;m++)
   {
   a=(3*Close+Low+Open+High)/6;
   }

   for(m=0;m<i;m++)
   {
   b=(20*a+19*a+18*a+17*a+16*a+15*a+14*a
   +13*a+12*a+11*a+10*a+9*a+8*a
   +7*a+6*a+5*a+4*a+3*a+2*a+
   a)/210;
   }


   for(m=0;m<i;m++)
   {
   d=iMAOnArray(b,0,mx,0,MODE_SMA,m);
   }

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

li2816 发表于 2018-12-21 23:52:29

没多大用,浪费时间

laicsh 发表于 2019-1-14 00:22:22

你这个是指标,买卖功能是EA,指标和EA在MT4里面是没法在同一段代码里面实现的

王珊 发表于 2019-2-6 12:14:28

没多大用,浪费时间

349309448 发表于 2019-8-31 16:31:27


谢谢分享
页: [1]
查看完整版本: 牛版,多空线指标帮忙加个买卖功能好吗