下载MetaTrader 5
要添加评论,请登录注册
如何在MQL5.community获利?快来找出答案!
howii111
6
howii111 2015.08.04 06:43 

我利用分形函数在每个上分形上 画了一条水平线,接下来想删除点差在50点范围内的两根水平线的一根

我编的程序是这样的:

 

#property indicator_chart_window

#property indicator_buffers    2

#property indicator_color1     Red

#property indicator_color2     Yellow

double UpperBuffer[]; //LowerBoffer[];

//+------------------------------------------------------------------+

//| Custom indicator initialization function                         |

//+------------------------------------------------------------------+

int OnInit()

  {

  

    

  

// ---- indicator buffers mapping  

    IndicatorBuffers(2);

    SetIndexBuffer(0,UpperBuffer);

    //SetIndexBuffer(1,LowerBuffer);

//---- drawing settings

    SetIndexStyle(0,DRAW_ARROW);

    SetIndexStyle(1,DRAW_ARROW);

    SetIndexArrow(0,SYMBOL_ARROWUP);

    SetIndexArrow(1,SYMBOL_ARROWDOWN);

//----


//---- name for DataWindow


//---- initialization done   


   return 0;

  }

//+------------------------------------------------------------------+

//| Custom indicator iteration function                              |

//+------------------------------------------------------------------+

int start()

  {

    int i,j,limit;

    int couted_bars=IndicatorCounted();

    if(couted_bars>0)

    couted_bars--;

    limit=Bars-couted_bars;

    for(i=0;i<limit;i++)

    UpperBuffer[i]=iFractals("EURUSD",0,MODE_UPPER,i);

    for(i=120;i>0;i--)

    {

       ObjectCreate("EX_Value_High"+DoubleToStr(i,0),OBJ_HLINE,0,Time[i],UpperBuffer[i]);

       ObjectSet("EX_Value_High"+DoubleToStr(i,0), OBJPROP_STYLE, 0);

       ObjectSet("EX_Value_High"+DoubleToStr(i,0), OBJPROP_WIDTH, 1);

       ObjectSet("EX_Value_High"+DoubleToStr(i,0), OBJPROP_COLOR, clrRed);

    }

    for(i=120;i>0;i--)

  { 

 

       if(Upper_Buffer[i]-UpperBuffer[i-1]<=500*Point)

       ObjectDelete("EX_Value_High"+DoubleToStr(i,0));     

  }

     

   return 0;

  }

但是这样不起作用,问题出在删除求各位大神告诉我正确的编程方法!~最后我想能够将所删选的价位作为返回值,谢谢大神了!!~

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