`
walksing
  • 浏览: 211991 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

简单的KD交叉标计箭头

 
阅读更多
.[i] 简单的KD交叉标计箭头  2012-01-19 10:46:26|  分类: 好指标 |  标签: |字号大中小 订阅 .




//[i] 简单的KD交叉标计箭头

#property  indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 White
#property indicator_color2 Yellow
#property indicator_color3 Red
#property indicator_color4 LightSeaGreen

extern int RSV周期= 90;
extern int K周期= 5;
extern int D周期= 3;
extern int 时框= 0;

double K值[];
double D值[];
double 涨箭[];
double 跌箭[];

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

int init()
  {
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, K值);
 
   SetIndexStyle(1, DRAW_LINE);
   SetIndexBuffer(1, D值);
 
   SetIndexStyle(2, DRAW_ARROW);
   SetIndexBuffer(2, 涨箭);
   SetIndexArrow(2, 233);
  
   SetIndexStyle(3, DRAW_ARROW);
   SetIndexBuffer(3, 跌箭);
   SetIndexArrow(3, 234);
  
   return(0);
  }
 
//---------------------------------------------+
 
int start()
  {
   int 序列组[];
   int j= 0;
  
   ArrayCopySeries(序列组, 5, Symbol(), 时框);   // 5:时间
  
   int 已计= IndicatorCounted();
   int 最少计= Bars-已计-1;
   int i= 0;
  
   while(i<最少计){
      if(Time[i]<序列组[j])
         j++;
  
      K值[i]= iStochastic(NULL, 时框, RSV周期, K周期, D周期, MODE_SMA, 0, MODE_MAIN,   j);
      D值[i]= iStochastic(NULL, 时框, RSV周期, K周期, D周期, MODE_SMA, 0, MODE_SIGNAL, j);
  
      if(K值[i]>D值[i] && K值[i+1]<D值[i+1])
        涨箭[i]= D值[i];
     
      if(K值[i]<D值[i] && K值[i+1]>D值[i+1])
        跌箭[i]= D值[i];
     
      i++;
     }
   return(0);
  }
 
//---------------------------------------------+
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics