求条件成立的最低和最高值

{MACDDiff = XAverage( Close, FastLength ) - XAverage( Close, SlowLength ) ;    
            MACDdea = XAverage(MACDDiff,MACDLength);
            
    
    up0=NthCon (crossover(MACDDiff,MACDdea),1)+1;        
    
    dn0=NthCon (CrossUnder(MACDDiff,MACDdea),1)+1;
    
    if (crossover(MACDDiff,MACDdea))
     {
       up_low =lowest(low, dn0);//MACD两条线金叉时求Diff与Dea死叉以来的最低值
    
    }
     if (crossover(MACDdea,MACDDiff))
      {
     dn_high =Highest(High, up0);//MACD两条线死叉时求Diff与Dea金叉以来的最低值
    }

    PlotNumeric("H1", dn_high);
    
    PlotNumeric("L1", up_low);

}

老师好,请问我求两条注释的值,这样写哪里不对,我加载了看画线数值不对

上次条件成立时的BAR
求最高值错误
求10个周期内的最高价和最低价
求当条件成立时K线的收盘价
求最高最低价
TBQ有没判断周期内是否存在条件成立的函数
怎么求最低价的最小值
求8天内的最低价
如何在当前bar条件成立时立即触发
建仓后的最高价和最低价

    {MACDDiff = XAverage( Close, FastLength ) - XAverage( Close, SlowLength ) ;    
            
    MACDdea = XAverage(MACDDiff,MACDLength);            
    
    up0=NthCon (crossover(MACDDiff,MACDdea)&&CountIf(MACDdiff[1]<MACDdea[1],10)>=10,1)+1;//上升条件:金叉时,距离死叉10周期以上        
    
    dn0=NthCon (CrossUnder(MACDDiff,MACDdea)&&CountIf(MACDdiff[1]>MACDdea[1],10)>=10,1)+1;//下降条件:死叉时,距离金叉10周期以上    
    
    ll=lowest(low,dn0);
    
    if (crossover(MACDDiff,MACDdea)&&CountIf(MACDdiff[1]<MACDdea[1],10)>=10)//上升条件:金叉时,距离死叉10周期以上
     {
       up_low =ll;//MACD两条线金叉时求Diff与Dea死叉以来的最低值
    
    }
    hh=Highest(High,up0) ;
     if (crossover(MACDdea,MACDDiff)&&CountIf(MACDdiff[1]>MACDdea[1],10)>=10)//下降条件:死叉时,距离金叉10周期以上
      {
     dn_high =hh;//MACD两条线死叉时求Diff与Dea金叉以来的最低值
    }
    
    if (Low[1]>dn_high[1]-(dn_high-up_low)*0.25 && marketposition <=0)
     {
        Buy(1,open);
    }
    if (High[1]<up_low[1]+(dn_high-up_low)*0.25 && marketposition >=0) 
    {
        SellShort(1,open);
    }
    PlotNumeric("Hh", dn_high);
    
    PlotNumeric("Ll", up_low);

    }
老师您好,我上面备注,上升条件和下降条件中,之前满足金叉或死叉10K线以上才有效,加这个条件为什么没效果呢?CountIf(MACDdiff[1]<MACDdea[1],10)>=10

CountIf(MACDdiff[1]>MACDdea[1],10)>=10

在 if 之前,计算 lowest 赋值给一个临时变量 LL,计算 highest 赋值给一个临时变量 HH;

在 if 里面, up_low = LL; dn_high = HH;