How to Define this function

 
// Input parameters
input int   Period = 14;        // Number of bars to consider
input int   Range  = 20;        // Range of the volume profile in points
input double   SetChartWindow = 0; 


// Global variables
double      VolumeProfile[];    // Array to store volume profile values

// Calculate the volume profile for the given period and range
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[])
{
    // Check if the period is valid
    if (Period < 1 || Period > rates_total)
        return -1;

    // Initialize the volume profile array
    ArraySetAsSeries(VolumeProfile, false);
    ArrayResize(VolumeProfile, Range * 2 + 1);

    // Calculate the volume profile
    for (int i = 0; i < Range * 2 + 1; i++)
    {
        double volumeSum = 0;
        for (int j = 0; j < Period; j++)
        {
            if (low[j] <= (i - Range) && high[j] >= (i - Range))
                volumeSum += volume[j];
        }
        VolumeProfile[i] = volumeSum;
    }

    // Return the number of bars calculated
    return Period;
}

// Plot the volume profile on the chart
void OnDraw()
{
    // Set the chart window and draw the volume profile
    
     
      SetChartWindow(0);
    for (int i = 0; i < Range * 2 + 1; i++)
         Plot(VolumeProfile[i], "Volume Profile", DeepSkyBlue, STYLE_SOLID, 0, i - Range);
}


Error : 

'SetChartWindow' - function not defined VWAP1.mq4 66 7

'Plot' - function not defined VWAP1.mq4 68 10

Code profiling - Developing programs - MetaEditor Help
  • www.metatrader5.com
Profiling means collecting program parameters during its execution. During a profiling, the execution time and the number of calls of individual...
 

Please provide the full code. The snippet you supplied is insufficient to understand the issue.

Also, please edit your post (don't create a new one) and post your code properly ...

 
Hoummad Elkraima: Error : 

'SetChartWindow' - function not defined VWAP1.mq4 66 7

'Plot' - function not defined VWAP1.mq4 68 10

So where do you define those two functions?

 
William Roeder #:

So where do you define those two functions?

Well, where I can define them ?

 
Hoummad Elkraima #: Well, where I can define them ?

Do you know how to code or did you just copy/paste the code from somewhere?