//+------------------------------------------------------------------+
//|                                           PatienceFX_Volumes.mq4 |
//|                                  Copyright 2025, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2025, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "2.00"
#property strict
#property indicator_separate_window
#property indicator_buffers 1

#property indicator_color1 clrWhite

double v[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,v);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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[])
  {
   ArrayResize(v, rates_total);
   int start = 0;
   if(prev_calculated > 0)
      start = prev_calculated - 1;
   if(start < 0) return rates_total;


   for(int i = start; i < rates_total; i++)
      v[i] = (double)tick_volume[i];

   return(rates_total);
  }
//+------------------------------------------------------------------+
