Help with Indicator code

 

Hello im new to code , so can someone help me out to solve the errors given by the code bellow?

Thanks.

//+------------------------------------------------------------------+
//|                                        CumulativeDeltaVolume.mq5 |
//|                   Copyright 2021, Your Name Here                 |
//|                          https://www.example.com                 |
//+------------------------------------------------------------------+

#property copyright "Copyright 2021, Your Name Here"
#property link      "https://www.example.com"
#property version   "1.00"
#property description "Calculates cumulative delta based on volume for a given symbol and timeframe."

input ENUM_TIMEFRAMES Timeframe = PERIOD_CURRENT;
input int BarsToCount = 1000;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
    return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
void OnCalculate(const int rates_total,
                 const int prev_calculated,
                 const int begin,
                 const double& price[],
                 const long& volume[])
{
    // Calculate cumulative delta
    double delta = 0.0;
    double cumDelta[rates_total];
    ArrayInitialize(cumDelta, 0.0);
    for (int i = rates_total - 1; i >= 0; i--)
    {
        delta += volume[i] * ((price[i] > price[i+1]) ? 1 : ((price[i] < price[i+1]) ? -1 : 0));
        cumDelta[i] = delta;
    }

    // Plot cumulative delta
    PlotIndicator(
        _Symbol,
        Timeframe,
        "Cumulative Delta (Volume)",
        cumDelta,
        MODE_LINE,
        clrRed
    );
}
 
em07189: Hello im new to code , so can someone help me out to solve the errors given by the code bellow? Thanks.

You need to define the properties and buffers of the indicator, which means where you will store the data to be able to draw on the chart.

 
em07189: Hello im new to code , so can someone help me out to solve the errors given by the code bellow?

Please always use the CODE button (Alt-S) when inserting code.

Code button in editor