Why Indicator values count and it's corresponding dates count aren't equal?

 

Hi Every One

Simply Speaking, I need to get Indicator value and it's corresponding dates, I do this by the following lines of codes:

Handle_ZigZag        = iCustom(S,TimeFrame,Indicator_1_Name, Depth, Deviation, BackSteps) ;

int count_of_indVal              = CopyBuffer(Handle_ZigZag, IndexZigZag, StartDate, StopDate, BufferZigZag); 

int count_of_indDats              = CopyTime(_Symbol, TimeFrame, StartDate, StopDate, time) ;

i.e I get indicator values by CopyBuffer(), and get it's corresponding dates by CopyTime() function. according to the MQL5 references, the output of this two functions should be the number of data. So, I expected

these two be the same, i.e have the equal value (or: count_of_indVal ==  count_of_indDats ). But this is not the case!! , I mean the amount of count_of_indVal variable aren't equal to  count_of_indDats variable!!

- Why Is this So ???

- So, How can I get [ indicator_date, indicator_value] pairs?

 
MTirex:

- So, How can I get [ indicator_date, indicator_value] pairs?

This is not how CopyBuffer works. You have to use bar indices and number of indicator values you need. Dates are not allowed.

CopyBuffer(Handle_ZigZag, IndexZigZag, start_index, count, BufferZigZag); 

 
Yashar Seyyedin #:

This is not how CopyBuffer works. You have to use bar indices and number of indicator values you need. Dates are not allowed.

I Appreciate You, My friend.

I think this is the best solution for me. But CopyBuffer() should work with start- end date according to: https://www.mql5.com/en/docs/series/copybuffer 

Documentation on MQL5: Timeseries and Indicators Access / CopyBuffer
Documentation on MQL5: Timeseries and Indicators Access / CopyBuffer
  • www.mql5.com
CopyBuffer - Timeseries and Indicators Access - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
MTirex #:

I Appreciate You, My friend.

I think this is the best solution for me. But CopyBuffer() should work with start- end date according to: https://www.mql5.com/en/docs/series/copybuffer 

İ didn't know. Thanks for enlightening.
 
Handle_ZigZag        = iCustom(S,TimeFrame,Indicator_1_Name, Depth, Deviation, BackSteps) ;

int count_of_indVal              = CopyBuffer(Handle_ZigZag, IndexZigZag, StartDate, StopDate, BufferZigZag); 

int count_of_indDats              = CopyTime(_Symbol, TimeFrame, StartDate, StopDate, time) ;
  1. Please edit your (original) post and use the CODE button (or Alt+S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
              Messages Editor

  2. Your posted code is without context. Are those lines together, or is the iMA/iCustom call in OnInit? Always post all relevant code (using Code button) or attach the source file.
         How To Ask Questions The Smart Way. (2004)
              Be precise and informative about your problem

Reason: