SC000合约满足策略平仓条件没有平仓

以SC000合约为例,

Data[0]是30分钟,

Data[1]是1分钟

Data[1]图层2026年4月17日21:48已满足空单出场条件

为什么平仓信号却没有出来,而是往后延迟呢?

代码如下:

Params
    Numeric FastLength(12);       
    Numeric SlowLength(26);      
    Numeric MACDLength(9);        
    Numeric LongMAPeriod(101);    
    Numeric TradeLots(1);         
    Numeric PriceBandPercent(1.9); 
    Numeric DrawdownPercent(1.6); 
    Numeric N(2);    

Vars
    Series<Numeric> MACDDiff; 
    Series<Numeric> MACDDEA; 
    Series<Numeric> MACDValue; 
    Bool MACDDeathCross;  
    Series<Numeric> LongMA; 
    Series<Numeric> LowerPriceLimit;  
    Bool BelowLongMA; 
    Bool InPriceBandShort; 
    Numeric RecentLow; 
    Bool BreakRecentLow;  
    Bool EntryShortSignal; 
    Bool ExitShortSignal; 
    Numeric EntryPrice;  
    Series<Numeric> LowestSinceEntry; 
    Series<Numeric> ShortExitPrice;
    
    Events
    OnBar(ArrayRef<Integer> indexs)
    {
        MACDDiff = XAverage(Close, FastLength) - XAverage(Close, SlowLength);
        MACDDEA = XAverage(MACDDiff, MACDLength);
        MACDValue = 2 * (MACDDiff - MACDDEA);        
        MACDDeathCross = MACDDiff[1]<MACDDEA[1];       
        LongMA = AverageFC(Close, LongMAPeriod);
        PlotNumeric("LongMA", LongMA,LongMA, RGB(255, 0, 0)); 
        LowerPriceLimit = LongMA * (1 - PriceBandPercent / 100);
        PlotNumeric("LowerPriceLimit", LowerPriceLimit,LowerPriceLimit, Yellow);      
        BelowLongMA = Close[1] < LongMA[1];
        InPriceBandShort = BelowLongMA && Close[1] >= LowerPriceLimit[1];
        RecentLow = Lowest(Low[2],N); 
        BreakRecentLow = Close[1] < RecentLow;   
        EntryShortSignal = MACDDeathCross && InPriceBandShort && BreakRecentLow;
        
        If (EntryShortSignal && MarketPosition != -1)
        {           
            EntryPrice = OPEN;            
            SellShort(TradeLots, Open);            
        }
        
        If (MarketPosition == -1)
        {            
         If (BarsSinceEntry==0)
            {
               LowestSinceEntry = LOW;
               Commentary("LowestSinceEntry= "+Text(LowestSinceEntry));
           }
            If (BarsSinceEntry>0)
            {
               LowestSinceEntry =Min(LowestSinceEntry[1],Low); 
               Commentary("LowestSinceEntry= "+Text(LowestSinceEntry));              
           }
            ShortExitPrice = LowestSinceEntry * (1 + DrawdownPercent / 100);
            Commentary("ShortExitPrice= "+Text(ShortExitPrice));                 
            Data[1]. PlotNumeric("ShortExitPrice", Data[0]. ShortExitPrice);      

            If (Data[1]. H>= Data[0]. ShortExitPrice )
            {
               Data[1].Commentary("Data[1]. H= "+Text(Data[1]. H));        
               BuyToCover(TradeLots, ShortExitPrice);           
             }
        }        
           }


交易套利合约,满足平仓条件策略没有平仓且信号消失
满足平仓条件没有平仓信号
满足平仓条件,为什么不平仓呢
由信号闪烁产生的交易,后续满足平仓条件时,可以平仓吗
同一根Bar上即满足买入条件又满足平仓条件
条件满足没有发出平仓的操作 ,老师给看一下问题出在了哪?
多图层期权合约平仓失败
行情没达到公式平仓条件被平仓
sp合约的平仓
多条件开平仓

另外一个帖子应该回复过了。

跨周期的写法应该是信号标记在小周期上。

你这个标记在大周期上,本身就是有问题的。