求牛版主帮忙

楼主  收藏   举报   帖子创建时间:  2019-05-05 05:53 回复:0 关注量:70
下面的图形中,后面的八个向上箭头只有最后一个才是正确的,它前面的七个全是由K 线上去后又下来的假信号留下的垃圾,变换一下周期再变回来,那七个就没了;求你解决的问题是:能否让图表自动刷新,使它只有一个箭头,条件变化之后,让不符合条件的箭头自动消失?
  谢谢了!!!


  • #property indicator_chart_window
  • #property indicator_buffers 8
  • #property indicator_color1 Gold
  • #property indicator_color2 Lime
  • #property indicator_color3 Lime
  • #property indicator_color4 Gold

  • extern int 均线周期2 = 2;
  • extern int 均线周期5 = 5;
  • extern int 类型1 = 0;//0-SMA; 1-EMA; 2-SMMA; 3-LWMA
  • extern int 类型2 = 0;//0-SMA; 1-EMA; 2-SMMA; 3-LWMA
  • double ibuf_1[];
  • double ibuf_2[];
  • double ibuf_3[];
  • double ibuf_4[];
  • int gi_1;
  • int gi_2 = 0;
  • datetime time_1;
  • //+------------------------------------------------------------------+
  • int init() {
  •    IndicatorBuffers(8);
  •    SetIndexStyle(0, DRAW_LINE,0,2);
  •    SetIndexStyle(1, DRAW_LINE,0,2);
  •    SetIndexStyle(2, DRAW_ARROW,0,1);
  •    SetIndexStyle(3, DRAW_ARROW,0,1);
  •    SetIndexArrow(2, 233);
  •    SetIndexArrow(3, 234);
  •    SetIndexBuffer(0, ibuf_1);
  •    SetIndexBuffer(1, ibuf_2);
  •    SetIndexBuffer(2, ibuf_3);
  •    SetIndexBuffer(3, ibuf_4);
  •    gi_1 = 0;
  •    return (0);
  • }
  • //+------------------------------------------------------------------+
  • //| Custom indicator deinitialization function                       |
  • //+------------------------------------------------------------------+
  • int deinit() {
  •    return(0); }
  • //+------------------------------------------------------------------+
  • int start() {
  •    int counted_bars = IndicatorCounted();
  •    if (counted_bars < 0) return (-1);
  •    if (counted_bars > 0) counted_bars--;
  •    int limit = Bars - counted_bars;
  •    for (int i = limit; i >= 0; i--) {
  •       ibuf_1 = iMA(NULL, 0, 均线周期2, 0, 类型1, PRICE_CLOSE, i);
  •       ibuf_2 = iMA(NULL, 0, 均线周期5, 0, 类型2, PRICE_CLOSE, i);
  • //+----
  •       if (ibuf_1[i + 1] < ibuf_2[i + 1] && ibuf_1 > ibuf_2) {
  •          ibuf_3 = Low - 5 * Point;
  •       }
  • //+----
  •       if (ibuf_1[i + 1] > ibuf_2[i + 1] && ibuf_1 < ibuf_2) {
  •          ibuf_4 = High + 5 * Point;
  •       } else gi_2 = FALSE;
  •    }
  •    return (0);}

复制代码
打赏