voglio che il mio EA integri lindicatore ZZZZZ senza doverlo richiamare. ecco i codici
//±-----------------------------------------------------------------+
//|                                                     ZZ_EA.mq4   |
//|                              Copyright © 2023, Gabriele Bassi   | CON LOT SIZE
//±-----------------------------------------------------------------+
#property strict

// External input parameters for the EA
input double LotSize = 0.1; // Fixed lot size for each trade
input double TakeProfitPips = 400; // Take profit in pips
input double StopLossPips = 150; // Stop loss in pips
input double TrailingStopPips = 10; // Trailing stop in pips


// External input parameters for the indicator
input int CCI_Period = 12;
input int Momentum_Period = 21;
input int RSI_Period = 14;
input double SAR_Step = 0.01;
input double SAR_Maximum = 0.2;

// OnInit is called when the expert is loaded onto a chart
int OnInit() {
    // Initialization code here
    return INIT_SUCCEEDED;
}

// OnTick is called on every new tick
void OnTick() {
    // Get last bar index in the chart (0 is the currently forming bar, 1 is the last fully formed bar)
    int lastBarIndex = 1;

    // Retrieve the last known values for the indicator signals
    double arrowUp = iCustom(Symbol(), 0, "ZZZZZ", CCI_Period, Momentum_Period, RSI_Period, SAR_Step, SAR_Maximum, 0, lastBarIndex);
    double arrowDown = iCustom(Symbol(), 0, "ZZZZZ", CCI_Period, Momentum_Period, RSI_Period, SAR_Step, SAR_Maximum, 1, lastBarIndex);
    
    // If there are no current orders, check for a buy or sell signal
    if(OrdersTotal() == 0) {
        if(arrowUp != EMPTY_VALUE) {
            // If an up arrow (buy signal) is present, send a buy order
            double sl = NormalizeDouble(Bid - StopLossPips * Point, Digits);
            double tp = NormalizeDouble(Bid + TakeProfitPips * Point, Digits);
            int ticket = OrderSend(Symbol(), OP_BUY, LotSize, Ask, 2, sl, tp, "Buy order based on ZZZZZ", 0, 0, clrGreen);
            if(ticket < 0) {
                Print("An error occurred while sending a buy order: ", GetLastError());
            }
        }
        if(arrowDown != EMPTY_VALUE) {
            // If a down arrow (sell signal) is present, send a sell order
            double sl = NormalizeDouble(Ask + StopLossPips * Point, Digits);
            double tp = NormalizeDouble(Ask - TakeProfitPips * Point, Digits);
            int ticket = OrderSend(Symbol(), OP_SELL, LotSize, Bid, 2, sl, tp, "Sell order based on ZZZZZ", 0, 0, clrRed);
            if(ticket < 0) {
                Print("An error occurred while sending a sell order: ", GetLastError());
            }
        }
    } else {
        // Update the trailing stop for existing orders
        TrailingStopFunc();
    }
}

// TrailingStopFunc adjusts the stop loss to enable a trailing stop
void TrailingStopFunc() {
    for(int i = OrdersTotal() - 1; i >= 0; --i) {
        if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
            // Verify that the selected order is for the current symbol
            if(OrderSymbol() == Symbol() && OrderMagicNumber() == 0) {
                if(OrderType() == OP_BUY) {
                    // Current price is far enough from the opening price to move stop loss
                    if(Bid - OrderOpenPrice() > TrailingStopPips * Point) {
                        double newStopLoss = Bid - TrailingStopPips * Point;
                        // Update the stop loss if it is less than the current stop loss
                        if(newStopLoss > OrderStopLoss()) {
                            OrderModify(OrderTicket(), OrderOpenPrice(), newStopLoss, OrderTakeProfit(), 0, clrGreen);
                        }
                    }
                } else if(OrderType() == OP_SELL) {
                    // Current price is far enough from the opening price to move stop loss
                    if(OrderOpenPrice() - Ask > TrailingStopPips * Point) {
                        double newStopLoss = Ask + TrailingStopPips * Point;
                        // Update the stop loss if it is greater than the current stop loss
                        if(newStopLoss < OrderStopLoss()) {
                            OrderModify(OrderTicket(), OrderOpenPrice(), newStopLoss, OrderTakeProfit(), 0, clrRed);
                        }
                    }
                }
            }
        }
    }
}
//±-----------------------------------------------------------------+

//±-----------------------------------------------------------------+
//|                                                     ZZZZZ.mq4   |
//|                              Copyright © 2023, Gabriele Bassi   |
//±-----------------------------------------------------------------+
#property strict
#property indicator_chart_window
#property indicator_buffers 2

// Define property constants for arrow symbols
#property indicator_type1   DRAW_ARROW
#property indicator_type2   DRAW_ARROW
#property indicator_color1  LimeGreen
#property indicator_color2  Red
#property indicator_width1  1
#property indicator_width2  1
// Indicator arrow codes from the Wingdings font
#define UP_ARROW_SYMBOL   233
#define DOWN_ARROW_SYMBOL 234

// Indicator buffers (arrays) for storing values
double ArrowUpBuffer[];
double ArrowDownBuffer[];

// Input parameters for indicator formula
input int       CCI_Period      = 12;
input int       Momentum_Period = 5;
input int       RSI_Period      = 14;
input double    SAR_Step        = 0.02;
input double    SAR_Maximum     = 0.2;

//±-----------------------------------------------------------------+
//| Custom indicator initialization function                         |
//±-----------------------------------------------------------------+
int OnInit()
  {
    // Set up indicator buffers for storing arrow data
    SetIndexBuffer(0, ArrowUpBuffer);
    SetIndexBuffer(1, ArrowDownBuffer);
    
    // Set up arrow symbols for display
    SetIndexArrow(0, UP_ARROW_SYMBOL);
    SetIndexArrow(1, DOWN_ARROW_SYMBOL);

    // Prepare indicator buffers for data manipulation
    ArraySetAsSeries(ArrowUpBuffer, true);
    ArraySetAsSeries(ArrowDownBuffer, true);

    // Clear all buffers first (initialize with empty values)
    for (int i = 0; i < ArraySize(ArrowUpBuffer); i++)
    {
        ArrowUpBuffer[i] = EMPTY_VALUE;
    }
    for (int i = 0; i < ArraySize(ArrowDownBuffer); i++)
    {
        ArrowDownBuffer[i] = EMPTY_VALUE;
    }

    return(INIT_SUCCEEDED);
  }
//±-----------------------------------------------------------------+
//| Custom indicator iteration function called by the MetaTrader     |
//| platform every tick or price change                              |
//±-----------------------------------------------------------------+
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[])
  {
    // Loop through the bars and calculate the CCI for each
    for (int i = 1; i < rates_total; i++)
    {
        // Do not repaint the last bar
        if(i == rates_total - 1)
        {
            ArrowUpBuffer[i] = EMPTY_VALUE;
            ArrowDownBuffer[i] = EMPTY_VALUE;
            continue;
        }

        // Get the CCI, Momentum, RSI and SAR values
        double cci       = iCCI(NULL, 0, CCI_Period, PRICE_TYPICAL, i);
        double cci_prev  = iCCI(NULL, 0, CCI_Period, PRICE_TYPICAL, i + 1);
        double momentum  = iMomentum(NULL, 0, Momentum_Period, PRICE_CLOSE, i);
        double rsi       = iRSI(NULL, 0, RSI_Period, PRICE_CLOSE, i);
        double sar       = iSAR(NULL, 0, SAR_Step, SAR_Maximum, i);

        // Condition for the up arrow (green): CCI crossover from below
        if (cci >= 100 && cci_prev < 100 && momentum >= 100 && rsi >= 50 && sar < low[i])
        {
            ArrowUpBuffer[i] = low[i] - (4 * _Point);
        }
        else
        {
            ArrowUpBuffer[i] = EMPTY_VALUE;
        }

        // Condition for the down arrow (red): CCI crossover from above
        if (cci <= -100 && cci_prev > -100 && momentum < 100 && rsi < 50 && sar > high[i])
        {
            ArrowDownBuffer[i] = high[i] + (4 * _Point);
        }
        else
        {
            ArrowDownBuffer[i] = EMPTY_VALUE;
        }
    }

    return(rates_total);
  }
//±-----------------------------------------------------------------+

scrivi il codice completo del nuovo EA