和其正 发表于 2017-6-23 13:59:58

高低价突破选择极端条件均线值后分色



#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 Silver

extern int 基周期= 10;
extern int 显棒数= 10000;

double 红跌线[];
double 蓝涨线[];
double 银中线[];

//------------初始化-------——+

void init()
{
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexBuffer(0, 红跌线);
   SetIndexLabel(0, "????í?? ??àíè?à");
   SetIndexDrawBegin(0, 0);

   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexBuffer(1, 蓝涨线);
   SetIndexLabel(1, "?è?í?? ??àíè?à");
   SetIndexDrawBegin(1, 0);

   SetIndexStyle(2, DRAW_LINE, STYLE_DOT, 1);
   SetIndexBuffer(2, 银中线);
   SetIndexLabel(2, "???èàíà");
   SetIndexDrawBegin(2, 0);

   IndicatorShortName("?è?à ò??í?à (?ò?? ????) ("+基周期+")");
}

//-----------反初始化------——+

void deinit()
{
   Comment("");
}

//-----------主函数--------——+

void start()
{
   int 周期步幅= 1;
   if(基周期>1)
      周期步幅= 基周期;

   int 方向= 0;
   double 极高均, 极低均, x1, x2, x3, x4, x5, x6;
   for(int i=显棒数-1; i>=0; i--){
      x1= iMA(NULL,0,1*周期步幅,0,MODE_SMA,PRICE_CLOSE,i);
      x2= iMA(NULL,0,2*周期步幅,0,MODE_SMA,PRICE_CLOSE,i);
      x3= iMA(NULL,0,3*周期步幅,0,MODE_SMA,PRICE_CLOSE,i);
      x4= iMA(NULL,0,4*周期步幅,0,MODE_SMA,PRICE_CLOSE,i);
      x5= iMA(NULL,0,5*周期步幅,0,MODE_SMA,PRICE_CLOSE,i);
      x6= iMA(NULL,0,6*周期步幅,0,MODE_SMA,PRICE_CLOSE,i);

      //--选择极端条件均线值(按递增周期顺序)
      极高均= x1;
      极低均= x1;
      if(极高均<x2)极高均= x2;
      if(极高均<x3)极高均= x3;
      if(极高均<x4)极高均= x4;
      if(极高均<x5)极高均= x5;
      if(极高均<x6)极高均= x6;

      if(极低均>x2)极低均= x2;
      if(极低均>x3)极低均= x3;
      if(极低均>x4)极低均= x4;
      if(极低均>x5)极低均= x5;
      if(极低均>x6)极低均= x6;

      //--确定方向
      if(High>极高均)
         方向= 1;
      if(Low <极低均)
         方向=-1;
      if(High>极高均 && Low<极低均)
         方向=0;

      //--赋值
      红跌线= EMPTY_VALUE;
      蓝涨线= EMPTY_VALUE;
      if(方向<0)
         红跌线= 极高均;
      if(方向>0)
         蓝涨线= 极低均;

      银中线= (极高均+极低均)/2;
   }

   if(红跌线!=EMPTY_VALUE)
      Comment("SELL; ?ò?? ????: "+DoubleToStr(红跌线,Digits));
   if(蓝涨线!=EMPTY_VALUE)
      Comment("BUY; ?ò?? ????: "+DoubleToStr(蓝涨线,Digits));
}

//-------------------——+

**** Hidden Message *****

selangli2008 发表于 2017-6-23 14:27:56

谢谢分享谢谢

冯新华_wXhA4 发表于 2017-6-23 14:28:16

破选择极端条件均线破选择极端条件均线破选择极端条件均线破选择极端条件均线

发财妹 发表于 2017-6-23 14:36:53

高低价突破选择极端条件均线值后分色

三羊开泰 发表于 2017-6-23 14:38:17

顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶

jingcai868 发表于 2017-6-23 17:22:14

7777777777777777777777777777777

沛之 发表于 2017-6-23 22:05:07

高低价突破选择极端条件均线值后分色

yjl8787 发表于 2017-6-24 21:26:46

什么鬼

清静 发表于 2017-10-17 14:39:40

谢谢分享,学习下

qdxzhy126 发表于 2017-10-17 18:03:13

滚滚滚滚滚滚滚滚滚
页: [1] 2 3 4 5 6
查看完整版本: 高低价突破选择极端条件均线值后分色