Code help

 
//+------------------------------------------------------------------+
//|                        SpikeDetection.mq5   |
//|                        Advanced Spike Detection System          |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots   2
#property indicator_type1   DRAW_ARROW
#property indicator_color1  clrDodgerBlue
#property indicator_width1  2
#property indicator_type2   DRAW_ARROW
#property indicator_color2  clrRed
#property indicator_width2  2

input double TrapZone_VolatilitySensitivity = 0.5; //TrapZone Volatility Sensitivity
input int TrapZone_ATR_Period = 20;
input int TrapZone_BB_Period = 20;
input int LiquidityPool_Tolerance_Points = 10; //LiquidityPool Tolerance (Points)
input int VolumeAnomaly_Period = 10; //VolumeAnomaly Period
input double VolumeAnomaly_Multiplier = 2.0; // Volume anomaly multiplier
input string TimeFilter_CheckMinutes_str = "5, 20, 45"; // TimeFilter CheckMinutes

int spikeCheckMinutes[];
int spikeCheckMinutes_size;

double BuySignal[], SellSignal[];

bool isTrapZone(int i) {
    double bb_upper, bb_lower;
    double atr_value;
    
    bb_upper = GetBufferValue(TrapZone_BB_Handle, UPPER_BAND, i);
    bb_lower = GetBufferValue(TrapZone_BB_Handle, LOWER_BAND, i);
    atr_value = GetBufferValue(TrapZone_ATR_Handle, 0, i);
        
    if ((bb_upper - bb_lower) < atr_value * TrapZone_VolatilitySensitivity) {
        return true; 
    }
    return false;
}

bool isLiquidityPool(int BuyOrSell, int i) {
    double high1 = iHigh(NULL,0,i), high2 = iHigh(NULL,0,i+1), high3 = iHigh(NULL,0,i+2);
    double low1 = iLow(NULL,0,i), low2 = iLow(NULL,0,i+1), low3 = iLow(NULL,0,i+2);
    
    double tolerance = LiquidityPool_Tolerance_Points*_Point;
    
    if (BuyOrSell == 1 && MathAbs(high1 - high2) < tolerance && MathAbs(high2 - high3) < tolerance) {
        return true; 
    }
    
    if (BuyOrSell == 0 && MathAbs(low1 - low2) < tolerance && MathAbs(low2 - low3) < tolerance) {
        return true;
    }
    
    return false;
}

bool isCandlestickPattern(int BuyOrSell, int i) {
    double open3 = iOpen(NULL,0,i+2), open2 = iOpen(NULL,0,i+1), open1 = iOpen(NULL,0,i);
    double close3 = iClose(NULL,0,i+2), close2 = iClose(NULL,0,i+1), close1 = iClose(NULL,0,i);
   
    if (BuyOrSell == 0 && close3 < open3 && close2 < open2 && close1 > open1 && close1 > open2) {
        return true; 
    }
    
    if (BuyOrSell == 1 && close3 > open3 && close2 > open2 && close1 < open1 && close1 < open2) {
        return true; 
    }
    
    return false;
}

bool isVolumeAnomaly(int i) {
    double avg_volume = 0;
    
    for (int j = i+1; j <= i+VolumeAnomaly_Period; j++) {
        avg_volume += (double)iVolume(NULL,0,j);
    }
    avg_volume /= VolumeAnomaly_Period;
    
    if (iVolume(NULL,0,i) > VolumeAnomaly_Multiplier * avg_volume) {
        return true; 
    }
    
    return false;
}

bool isSpikeTimeAdaptive(int i) {
    MqlDateTime t;
    TimeToStruct(iTime(NULL,0,i), t);
    int minute = t.min;
    
    for (int j = 0; j < spikeCheckMinutes_size; j++) {
        if (minute == spikeCheckMinutes[j]) {
            return true; 
        }
    }
    
    return false; 
}

void triggerSpikeAlert(bool isBuySignal) {
    string alertMessage = isBuySignal ? "Buy Spike Signal Detected" : "Sell Spike Signal Detected";
    
    PlaySound("alert.wav");
    
    SendNotification(alertMessage);
    
    SendMail("Spike Signal Alert", alertMessage);
    
    Print(alertMessage);
}

int OnInit()
{
   SetIndexBuffer(0,BuySignal);
   SetIndexBuffer(1,SellSignal);
   PlotIndexSetInteger(0,PLOT_ARROW,233);
   PlotIndexSetInteger(1,PLOT_ARROW,234);
   IndicatorSetInteger(INDICATOR_DIGITS,_Digits);
   
   //spikeCheckMinutes
   {
   string result[];
   int splits = StringSplit(TimeFilter_CheckMinutes_str, ',', result);
   if (splits < 1) {Alert("Wrong value for Spike-prone minutes");}
   ArrayResize(spikeCheckMinutes, splits);
   spikeCheckMinutes_size = 0;
   for (int i = 0; i < splits; i++)
   {
      int min = int(result[i]);
      if (min < 0) continue;
      spikeCheckMinutes[spikeCheckMinutes_size] = min;
      spikeCheckMinutes_size++;
   }
   if (spikeCheckMinutes_size < 1) {Alert("Wrong value for Spike-prone minutes");}
   ArrayResize(spikeCheckMinutes, spikeCheckMinutes_size);
   }
   
   if (!CreateIndicatorsHandles()) return(INIT_FAILED);
   
   return(INIT_SUCCEEDED);
}

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
   if(rates_total<3)
      return(0);

   int pos=prev_calculated-1;

   if(pos<1)
     {
      pos=1;
     }

   for(int i=pos; i<rates_total-1 && !IsStopped(); i++)
   {
      bool isBuySignal = false;
      bool isSellSignal = false;
      int index = rates_total-1-i;
      
        if (isTrapZone(index+1) && isLiquidityPool(0, index) && isCandlestickPattern(0, index) && isVolumeAnomaly(index) && isSpikeTimeAdaptive(index)) {
            isBuySignal = true; 
        }
        if (isTrapZone(index+1) && isLiquidityPool(1, index) && isCandlestickPattern(1, index) && isVolumeAnomaly(index) && isSpikeTimeAdaptive(index)) {
            isSellSignal = true;
        }
        
        if (isBuySignal) {
            if (index == 0) triggerSpikeAlert(true); 
            BuySignal[i] = low[i]; 
        }
        if (isSellSignal) {
            if (index == 0) triggerSpikeAlert(false); 
            SellSignal[i] = low[i]; 
        }
   }
   return(rates_total);
}

int TrapZone_ATR_Handle, TrapZone_BB_Handle;
bool CreateIndicatorsHandles()
{
   TrapZone_ATR_Handle = iATR(Symbol(), 0, TrapZone_ATR_Period);
   if(TrapZone_ATR_Handle==INVALID_HANDLE) 
   {
      PrintFormat("Failed to create handle of the %s indicator for the symbol %s/%s, error code %d", 
                  "TrapZone_ATR",
                  _Symbol, 
                  EnumToString(_Period), 
                  GetLastError()); 
      return(false); 
   } 
   
   TrapZone_BB_Handle = iBands(Symbol(), 0, TrapZone_BB_Period, 0, 2, PRICE_CLOSE);
   if(TrapZone_BB_Handle==INVALID_HANDLE) 
   {
      PrintFormat("Failed to create handle of the %s indicator for the symbol %s/%s, error code %d", 
                  "TrapZone_BB",
                  _Symbol, 
                  EnumToString(_Period), 
                  GetLastError()); 
      return(false); 
   }    
   return(true); 
}

double GetBufferValue(int handle, int Buffer, int shift)
{
   double buffer[];
   CopyBuffer(handle, Buffer, shift, 1, buffer);
   if(ArraySize(buffer) != 1) 
   {
      return(EMPTY_VALUE); 
   }
   
   return (buffer[0]);
}

That's the code of an mt5 indicator 


Wich work to analyze this 5 core analysis startgy 

Trap Zone Detection (via stddev + Bollinger + ATR)


Liquidity Sweep Zones (Equal Highs/Lows logic)


Candle Pattern Recognition (3-candle spike structure)


Volume Anomaly Filter (custom volume surge)


Time Filter (uses broker timing edge)


Unified Spike Entry Logic (Buy/Sell conditions)


Spike Drawing Engine (arrows on chart with price offset)


This is a proprietary spike detection system for Boom & Crash indices on MT5, designed to detect institutional-style manipulations, not just standard retail indicators. It uses five layered conditions to filter out false signals and only highlight high-probability spike opportunities.

I just need professional coders to point out mistakes thanks for your time please I posted this code just for learning