顶背离

如果macd发生顶背离本次死叉不进行后续操作或者在下次死叉前不尽兴后续操作。有没有大神帮一下啊,想不出来怎么写

跪求分时图中MACD双底背离的代码,多谢!
请教老师,我写一个MACD的背离买入法,为什么软件一直识别不出
【智大领峰-K线图-指标】手动MACD背离工具
易语言指标精度问题
利用MACD顶底背离结合反向区间突破抓住反转点
【求助】MACD反转表达
macd背离指标 为何主图中 这个线条重叠了?

Params

Numeric FastLength(12);

Numeric SlowLength(26);

Numeric MACDLength(9);

Vars

Series<Numeric> fast;

Series<Numeric> slow;  //这3个是

Series<Numeric> MACDValue;

Series<bool> con1;

Series<bool> con2;

      Natural bool con_dbl_ding;

     

Natural bool con_dbl_di;

Natural bool con_buy;

Natural bool con_sicha;

   Natural bool con_jincha;

   Series<Numeric> macd_low;

Series<Numeric> macd_high;

Series<Numeric> highx;

Series<Numeric> lowx;

Series<Numeric> my_macd_high;

Series<Numeric> my_macd_highx;

Series<Numeric> my_high;

Series<Numeric> my_highx;

Series<Numeric> my_macd_low;

Series<Numeric> my_macd_lowx;

Series<Numeric> my_low;

Series<Numeric> my_lowx;

Events

OnBar(ArrayRef<Integer> indexs)

{

Range[0:DataSourceSize() - 1]

{

fast = XAverage( Close, FastLength ) - XAverage( Close, SlowLength ) ;

slow = XAverage(fast,MACDLength);

MACDValue = fast - slow;

}

con1 = CrossOver(fast,slow);//金叉

   con2 = CrossUnder(fast,slow);//死叉

           Numeric a;

   //Numeric macdx;

   Numeric b;

   //Numeric macdxx;

   a = NthCon(con2,1);

   b = NthCon(con1,1);

   highx = highest(high,b+1);

   lowx = Lowest(low,a+1);

   macd_low = Lowest(fast,a+1);

   macd_high = highest(fast,b+1);

   Commentary(\"a=\"+Text(a));

   Commentary(\"macdx:\"+Text(macd_low));

   Commentary(\"highx:\"+Text(highx));

   Commentary(\"lowx:\"+Text(lowx));

   if(con2)//求死叉下的最大值

   {

    my_high = highx;

    my_highx = my_high[1];

    my_macd_high = macd_high;

    my_macd_highx = my_macd_high[1];

   }

con_dbl_ding = my_high>my_highx and my_macd_high<my_macd_highx and con2;

if(con_dbl_ding) PlotBool(\"11\",true);

}



这 con_dbl_ding  是顶背离 如何在下一次死叉前代码不进行后续运行

关键是顶背离怎么用数学去描述

先把这个确定才行

Params

Numeric FastLength(12);

Numeric SlowLength(26);

Numeric MACDLength(9);

Vars

Series<Numeric> fast;

Series<Numeric> slow;  //这3个是

Series<Numeric> MACDValue;

Series<bool> con1;

Series<bool> con2;

     Natural bool con_dbl_ding;

   

Natural bool con_dbl_di;

Natural bool con_buy;


Natural bool con_sicha;

  Natural bool con_jincha;

  Series<Numeric> macd_low;

Series<Numeric> macd_high;

Series<Numeric> highx;

Series<Numeric> lowx;

Series<Numeric> my_macd_high;

Series<Numeric> my_macd_highx;

Series<Numeric> my_high;

Series<Numeric> my_highx;

Series<Numeric> my_macd_low;

Series<Numeric> my_macd_lowx;

Series<Numeric> my_low;

Series<Numeric> my_lowx;

Events

OnBar(ArrayRef<Integer> indexs)

{

Range[0:DataSourceSize() - 1]

{

fast = XAverage( Close, FastLength ) - XAverage( Close, SlowLength ) ;

slow = XAverage(fast,MACDLength);

MACDValue = fast - slow;


}

con1 = CrossOver(fast,slow);//金叉

  con2 = CrossUnder(fast,slow);//死叉

          Numeric a;

  //Numeric macdx;

  Numeric b;

  //Numeric macdxx;

  a = NthCon(con2,1);

  b = NthCon(con1,1);

  highx = highest(high,b+1);

  lowx = Lowest(low,a+1);

  macd_low = Lowest(fast,a+1);

  macd_high = highest(fast,b+1);

  Commentary(\"a=\"+Text(a));

  Commentary(\"macdx:\"+Text(macd_low));

  Commentary(\"highx:\"+Text(highx));

  Commentary(\"lowx:\"+Text(lowx));

  if(con2)//求死叉下的最大值

  {

   my_high = highx;

   my_highx = my_high[1];

   my_macd_high = macd_high;

   my_macd_highx = my_macd_high[1];

  }

con_dbl_ding = my_high>my_highx and my_macd_high<my_macd_highx and con2;

if(con_dbl_ding) PlotBool(\"11\",true);

}



这 con_dbl_ding  是顶背离 如何在下一次死叉前代码不进行后续运行