how can I find index when out of range occured in in an indicator

 

Hi 

in an indicator that I have written , array out of range error occures, without removing the  indicator from chart

I whant to printf the index amount for my debug 

something like this :

if( _LastError>0) printf(" i is : ", i , "  during error" );//==4002

please some one guide me how is it possible ?

 
  1. Mehrdad Sarrafi: please some one guide me how is it possible ?
    if( _LastError>0) printf(" i is : ", i , "  during error" );//==4002

    Perhaps you should read the manual. PrintFormat - Common Functions - MQL4 Reference
       How To Ask Questions The Smart Way. (2004)
          How To Interpret Answers.
             RTFM and STFW: How To Tell You've Seriously Screwed Up.

    if( _LastError>0) printf(" i is : %d  during error", i );//==4002

  2. Mehrdad Sarrafi: , array out of range error occures, without removing the  indicator from chart

    Your code has already been removed from the chart.

  3. Check your return codes, and report your errors (including market prices and your variables). Don't look at GLE/LE unless you have an error. Don't just silence the compiler (MT5 / MT4+strict), it is trying to help you.
              What are Function return values ? How do I use them ? - MQL4 programming forum (2012)

 
William Roeder #:
  1. Perhaps you should read the manual. PrintFormat - Common Functions - MQL4 Reference

thanks for the reply

as it is clear my problem is not using printformat  or printf .

and surely I can read the manual to learn the correct syntax of printf or printformat.


my question is how can I find out , what is the index amount that cause array out of range error .

i mean how can I print the index amount that is out of array.

for example in OnDeinit or  somewhere else that I do not know?


also despide showing error in experts tab but I still see indicator on my chart

 
  1. Mehrdad Sarrafi #:

    as it is clear my problem is not using printformat  or printf .

    and surely I can read the manual to learn the correct syntax of printf or printformat.

    It is clear that your trouble was exactly the opposite. The printf code you posted was garbage.

  2. Mehrdad Sarrafi #: my question is how can I find out , what is the index amount that cause array out of range error .

    You can't. Your indicator has already crashed. Print before the crash.

  3. If you need help with your code, post your code.


 
William Roeder #:
It is clear that your trouble was exactly the opposite. The printf code you posted was garbage

I donot know if you always copy   RTFM and STFW  or not.

I said something like printf  and the code was correct ! 

if you think my problem was working with printf function , it is your problem. please read the topic and question one more time.


====>>>  I want print the exact number of index that cause , array out of range <<<=====

do you have any idea about that ?

something like printing error description


  William Roeder #:  Don't just silence the compiler (MT5 / MT4+strict), it is trying to help you.

 thanks

this help me to solve the problem by silencing !!!

but my question still remain for my curiousity  and

because when I use #property strict , again show me  array , out of range in expert tab in metatrader , and one of the buffer in my indicator isnot drawn

Reason: