Exceeding of limitation

 
In my terminal I have "Max bar in chart" set to 7200. However, working with onCalculate function I have found that rates_amount sometimes is bigger that this value. Sometimes instead of 7200 there is 150.000 bars (full M1 history). It causes an issue to me because I work with MqlRates instead of open, high, low, close... arrays. Since the function CopyRates can not return bars more than TERMINAL_MAXBARS and indicator buffer size is larger than number of bars I have there is wrong indicator rendering. I can set unlimited amount of bars in chart but I think it is not rational to calculate unused history - I need only one working week.
 
damage220:
In my terminal I have "Max bar in chart" set to 7200. However, working with onCalculate function I have found that rates_amount sometimes is bigger that this value. Sometimes instead of 7200 there is 150.000 bars (full M1 history). It causes an issue to me because I work with MqlRates instead of open, high, low, close... arrays. Since the function CopyRates can not return bars more than TERMINAL_MAXBARS and indicator buffer size is larger than number of bars I have there is wrong indicator rendering. I can set unlimited amount of bars in chart but I think it is not rational to calculate unused history - I need only one working week.

If you are talking about mt5 is a bug. You don't expect solution because I sent ticket and they didn't give any answer

 
Juan Fernandez:

If you are talking about mt5 is a bug. You don't expect solution because I sent ticket and they didn't give any answer


I am. Is there a public link to this ticket? I am not familiar with their bug report system. Anyway, thank you.

 
damage220:

I am. Is there a public link to this ticket? I am not familiar with their bug report system. Anyway, thank you.


Tickets to service desk are private. You can send them one for report bugs

 
damage220:
In my terminal I have "Max bar in chart" set to 7200. However, working with onCalculate function I have found that rates_amount sometimes is bigger that this value. Sometimes instead of 7200 there is 150.000 bars (full M1 history). It causes an issue to me because I work with MqlRates instead of open, high, low, close... arrays. Since the function CopyRates can not return bars more than TERMINAL_MAXBARS and indicator buffer size is larger than number of bars I have there is wrong indicator rendering. I can set unlimited amount of bars in chart but I think it is not rational to calculate unused history - I need only one working week.

There's an easy solution... limit the indicator loop to total rates copied and index your buffers from right to left.

   MqlRates rates[];
   ArrayGetAsSeries(rates,true);
   ArraySetAsSeries(Volume_Buffer,true);
   int limit = CopyRates(Symbol(),Period(),0,Bars(Symbol(),Period()),rates);
   for(int i=limit-1;i>=0;i--)
   {
      Volume_Buffer[i] = rates[i].tick_volume;
   }
 
nicholishen:

There's an easy solution... limit the indicator loop to total rates copied and index your buffers from right to left.


Thank you for idea, I completely forgot about array order. I will try to implement it.

Reason: