4赞

346评论

29收藏

分享两个缠论指标

 

评论|共 346 个

baobao1834

发表于 2020-12-1 08:53:57 | 显示全部楼层

稳定盈利123

发表于 2020-12-1 10:12:48 | 显示全部楼层

123

zlchina

发表于 2020-12-6 21:04:04 | 显示全部楼层

多级别均线
    wilder · 2018-11-7 21:53:30 · 540 次点击        举报   收藏

#property indicator_chart_window    //指标放在主图; indicator_separate_window 附图
#property indicator_buffers 2        //设置指标线数组1条

#property indicator_color1  BlueViolet      //第一条指标线为白色;
#property indicator_color2  Magenta

#property indicator_style1 STYLE_SOLID //线为实体的
#property indicator_width1 2           //宽度为1
#property indicator_width2 1           //宽度为1


extern int MA1=160;                    //设立二个整数型变量,默认值为12和26,允许外部修改值
extern int MA2=20;

double     buf1[];                     //创建一个数组
double     buf2[];  

int init()                            //初始化函数,该函数进在指标加载时只运行一次。init是系统默认的函数名
  {
   SetIndexBuffer(0,buf1);             //设置数组buf1为第一条指标线
   SetIndexStyle(0,DRAW_LINE);        // 设置第一条指标线线型为连续型曲线
   SetIndexBuffer(1,buf2);             //设置数组buf1为第一条指标线
   SetIndexStyle(1,DRAW_LINE);        // 设置第一条指标线线型为连续型曲线
   IndicatorDigits(Digits);          //设置指标精确到小数位数
   return(0);
  }

//指标触发函数。与init函数相区别,该函数在有行情数据变化时被触发,
//如果数据被不断更新,则该函数则将被不断执行。

int start()      
  {
   int limit=Bars-IndicatorCounted();     //自定义了一个变量limit,并对其赋值;ars是图表中的柱数(K线数)
                                         //IndicatorCounted()函数调用的是缓存中的柱数,就是已经计算过的有值的柱数。
   if(Period()==PERIOD_M1)                 //判断当前为什么周期图 PERIOD_M1,PERIOD_M5,PERIOD_M15,PERIOD_M30,PERIOD_H1,PERIOD_H4,PERIOD_D1,PERIOD_W1,PERIOD_MN1
   {  MA1=100;   }
   if(Period()==PERIOD_M5)               
   {  MA1=120;   }
   if(Period()==PERIOD_M15 || Period()==PERIOD_H1)               
   {  MA1=80;   }
    if(Period()==PERIOD_M30)               
   {  MA1=160;   }
    if(Period()==PERIOD_H4 || Period()==PERIOD_D1 )               
   {  MA1=110;   }
  
   for(int i=0; i<limit;i++)
    {
//给数组buf赋值,其值分别为相应位置上两条均线计算出的差
//i是水平位置索引值,即烛柱从右到左的序号,右边第一个烛柱序号为0

    buf1[i]= iMA(NULL,0,MA1,0,1,0,i);
    buf2[i]= iMA(NULL,0,MA2,0,1,0,i);
       }
   return(0);
  }

阿泉

发表于 2020-12-26 14:40:56 | 显示全部楼层

88888888888888

seolyy

发表于 2020-12-26 15:10:24 | 显示全部楼层

谢谢分享

MAXIANSHENG

发表于 2021-1-16 01:30:19 | 显示全部楼层

活着真好

发表于 2021-1-16 09:02:20 | 显示全部楼层

楼主,你是一个大好人!!

kingking13

发表于 2021-2-2 14:12:40 | 显示全部楼层

试试看

415083286

发表于 2021-3-3 08:11:59 | 显示全部楼层

tudao111

发表于 2021-3-3 08:54:10 | 显示全部楼层

谢谢

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

EA之家评论守则