9评论

0收藏

变色均线指标

avatar zzhhanngg12345 | 1576 人阅读 | 9 人评论 | 2019-08-29

//+------------------------------------------------------------------+
//|                                                   Vinin-LRMA.mq4 |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 Red
#property indicator_color3 Green

extern int period=250;
extern int price=0;
extern int Shift=0;

//---- buffers
double BufferGreen[];
double BufferYellow[];
double BufferRed[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   int i;
   for(i=0;i<3;i++)
     {
      SetIndexStyle(i,DRAW_LINE);
      SetIndexDrawBegin(i,period);
      SetIndexShift(i,Shift);
     }
   SetIndexBuffer(0,BufferYellow);
   SetIndexBuffer(1,BufferGreen);
   SetIndexBuffer(2,BufferRed);

   return(0);
  }//int init()
//+------------------------------------------------------------------+
int start()
  {
   double tmp1,tmp2,tmp3;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   if(counted_bars==0) limit-=1+1;
   for(int i=limit;i>=0;i--)
     {
      tmp1=iMA(Symbol(),0,period,0,MODE_SMA,price,i);
      tmp2=iMA(Symbol(),0,period,0,MODE_LWMA,price,i);
      tmp3=3.0*tmp2-2.0*tmp1;
      BufferGreen[i] =tmp3;
      BufferYellow[i]=tmp3;
      BufferRed[i]   =tmp3;
      if(BufferYellow[i]>BufferYellow[i+1])
        {
         BufferRed[i]=EMPTY_VALUE;
           } else if(BufferYellow[i]<BufferYellow[i+1]){
         BufferGreen[i]=EMPTY_VALUE;
           } else {
         BufferRed[i]=EMPTY_VALUE;
         BufferGreen[i]=EMPTY_VALUE;
        }
     }
   return(0);
  }
//+------------------------------------------------------------------+


""
还没有人打赏,支持一下

评论|共 9 个

riidtf

发表于 2019-12-11 15:48:03 | 显示全部楼层

不错,谢了!

衣冠禽兽

发表于 2020-2-21 21:43:30 | 显示全部楼层

我是来刷分的,嘿嘿

娜娜世界

发表于 2020-7-16 17:59:31 | 显示全部楼层

学习了,不错

外汇比赛网

发表于 2020-7-25 11:49:46 | 显示全部楼层

学习了,不错

shuibushiguoke

发表于 2020-7-26 16:38:54 | 显示全部楼层

学习了,不错

omelan

发表于 2020-8-3 13:31:34 | 显示全部楼层

学习了,不错

慕容長季

发表于 2020-8-18 18:04:07 | 显示全部楼层

谢谢楼主分享

免费喊单

发表于 2020-8-21 18:36:03 | 显示全部楼层

学习了,不错

素颜。

发表于 2020-9-1 10:00:10 | 显示全部楼层

谢谢楼主分享

您需要登录后才可以回帖 登录 | 注册 微信登录

EA之家评论守则