找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
首页论坛EAHub 外汇论坛
查看: 13|回复: 0

多空线,金叉做多,死叉做空

[复制链接]

4万

主题

54

回帖

4万

积分

管理员

积分
45954
发表于 2026-8-25 07:24:00 | 显示全部楼层 |阅读模式
#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 clrMagenta

#property indicator_width1 2

#property indicator_color2 clrYellow

#property indicator_width2 2

//--- buffers

double a[];

double b[];

double d[];

extern int mx=10;  


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

//| Custom indicator initialization function                         |

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

int init()

  {

//---- indicators

   IndicatorBuffers(8);

   SetIndexStyle(0,DRAW_LINE);

   SetIndexBuffer(0,b);

   SetIndexStyle(1,DRAW_LINE);

   SetIndexBuffer(1,d);

   SetIndexBuffer(2,a);


   IndicatorShortName("DKX");

//----

   return(0);

  }

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

//| Custom indicator deinitialization function                       |

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

int deinit()

  {

//----


//----

   return(0);

  }

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

//| Custom indicator iteration function                              |

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

int start()

  {


   int    counted=IndicatorCounted();

   if(counted<0)return(-1);




   if(counted>0)counted--;

   int i=Bars-counted;

   for(int m=0;m<i;m++)

   {

   a[m]=(3*Close[m]+Low[m]+Open[m]+High[m])/6;

   }


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

   {

   b[m]=(20*a[m]+19*a[m+1]+18*a[m+2]+17*a[m+3]+16*a[m+4]+15*a[m+5]+14*a[m+6]

   +13*a[m+7]+12*a[m+8]+11*a[m+9]+10*a[m+10]+9*a[m+11]+8*a[m+12]

   +7*a[m+13]+6*a[m+14]+5*a[m+15]+4*a[m+16]+3*a[m+17]+2*a[m+18]+

   a[m+20])/210;  

   }


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

   {

   d[m]=iMAOnArray(b,0,mx,0,MODE_SMA,m);

   }


   return(0);

  }
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|EAHub外汇论坛

GMT+8, 2026-10-12 03:38 , Processed in 0.103421 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表