下载MetaTrader 5
要添加评论,请登录注册
找出社会交易会如何提高您的利润
jinjie_zhu
8
jinjie_zhu 2012.12.31 02:06 

谁能帮我改一下,并告诉我问题出在哪里.

 我邮箱 jingjixuetu37@gmail.com 

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Yellow
extern int Amplutide=150;
extern int Spread=15;
double Signal[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
    IndicatorBuffers(1);
    SetIndexStyle(0,DRAW_ARROW,Yellow);
    SetIndexArrow(0,37);
    SetIndexBuffer(0,Signal);
    IndicatorShortName("Inside Bars" + "("+Period()+")");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {

   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   for(int i=limit-1; i>=0; i++)
   {
     if(High[i+1]+Spread*Point>=High[i] && Low[i+1]-Spread*Point<=Low[i] && High[i+1]-Low[i+1]>Amplutide*Point
     && High[i]-Low[i]<=(High[i+1]-Low[i+1])*2/3)               Signal[i]=Low[i]-8*Point;
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+ 

附加的文件:
BaiChun Li
838
BaiChun Li 2013.01.08 17:38  

怎么个加载有问题,我不知道代码没几行,如果有错误分起来也不是麻烦自己应该能搞定。

不过,这个地方:

   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   for(int i=limit-1; i>=0; i++)

他们联合起来的话,这个for语句就会出现问题,不如把它改成类似:

   for(int i=limit-1; i>=0; i--)

然后在返回到最上面一行,去加载、测试、找问题。

/
要添加评论,请登录注册