idk 发表于 2014-11-3 19:40:23

大神求助代码

哪位大神帮忙看一下,代码有问题,看不懂,不知道怎么破。。

idk 发表于 2014-11-3 19:42:19

//+------------------------------------------------------------------+
//|                                              BIAS-乖离率指标.mq4 |
//|                                                 FXLong技术部编写 |
//|                                           http://www.fxlong.com/ |
//+------------------------------------------------------------------+
#property copyright"一条龙外汇网:www.fxlong.com"
#propertylink      "http://www.fxlong.com/"

//---- indicator settings
#propertyindicator_separate_window
#propertyindicator_buffers 1
#propertyindicator_color1DarkViolet


//---- Level Lines
#property indicator_level1 0

//---- indicator parameters
extern int MA1=20;


//---- indicator buffers
double   MA1Buffer[];



//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{

   
//---- indicator buffers mapping
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexBuffer(0,AtrBuffer);
   SetIndexBuffer(1,TempBuffer);

   
   
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("偏离度("+MA1+")");
   SetIndexLabel(0,"偏离度");

   
   
//---- initialization done
   return(0);
}
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
int start()
{
   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;

//---- bias counted in the 1-st buffer
   for(int i=0; i<limit; i++)
   {   
   if(Close> iMA(NULL,0,MA1,0,MODE_SMA,PRICE_CLOSE,i))
   
   { MA1Buffer= 10000*(High- iMA(NULL,0,MA1,0,MODE_SMA,PRICE_CLOSE,i));

   }
   else
   
   { MA1Buffer= 10000*(Low- iMA(NULL,0,MA1,0,MODE_SMA,PRICE_CLOSE,i));

   }

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

bb2260 发表于 2014-11-3 20:00:47

都有代碼了 還要破什麼:L

idk 发表于 2014-11-3 21:37:28

bb2260 发表于 2014-11-3 20:00
都有代碼了 還要破什麼

这个代码有问题,运行不了{:soso_e154:}

idk 发表于 2014-11-3 21:41:40

:({:soso_e106:}不要沉,希望大神出来解救一下

wlwhy 发表于 2014-11-3 21:59:04

找版主吧

翻开一页 发表于 2014-11-4 06:53:02

这是植入广告的小技巧,有意把某一两行写错

翻开一页 发表于 2014-11-4 06:57:36

//---- indicator buffers mapping
   IndicatorBuffers(1);
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(0,MA1Buffer);
   //SetIndexBuffer(0,AtrBuffer);
   //SetIndexBuffer(1,TempBuffer);
//---- name for DataWindow and indicator subwindow label

KSXJM 发表于 2014-11-4 09:13:02

gert12 发表于 2014-11-4 09:15:44

给你修改了

//+------------------------------------------------------------------+
//|                                              BIAS-乖离率指标.mq4 |
//|                                                 FXLong技术部编写 |
//|                                           http://www.fxlong.com/ |
//+------------------------------------------------------------------+
#property copyright"一条龙外汇网:www.fxlong.com"
#propertylink      "http://www.fxlong.com/"

//---- indicator settings
#propertyindicator_separate_window
#propertyindicator_buffers 1
#propertyindicator_color1DarkViolet


//---- Level Lines
#property indicator_level1 0

//---- indicator parameters
extern int MA1=20;


//---- indicator buffers
double   MA1Buffer[];



//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{

   
//---- indicator buffers mapping
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(0,MA1Buffer);

   
   
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("偏离度("+MA1+")");
   SetIndexLabel(0,"偏离度");

   
   
//---- initialization done
   return(0);
}
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
int start()
{
   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;

//---- bias counted in the 1-st buffer
   for(int i=0; i<limit; i++)
   {   
   if(Close> iMA(NULL,0,MA1,0,MODE_SMA,PRICE_CLOSE,i))
   
   { MA1Buffer= 10000*(High- iMA(NULL,0,MA1,0,MODE_SMA,PRICE_CLOSE,i));

   }
   else
   
   { MA1Buffer= 10000*(Low- iMA(NULL,0,MA1,0,MODE_SMA,PRICE_CLOSE,i));

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

wlwhy 发表于 2014-11-4 11:51:01

学习学习
页: [1]
查看完整版本: 大神求助代码