ObjectGetValueByTime() returns wrong results

 

Each time I call ObjectGetValueByTime(), NO MATTER what datetime parameter I pass to it, it ALWAYS returns the same value:

 

      datetime valleyArray[];

      CopyTime(Symbol(), Period(), 0, 40, valleyArray);

      ObjectCreate(0, valleyObjName, OBJ_STDDEVCHANNEL, 0, valleyArray [0], 0, valleyArray [arraySize-1], 0);

      

     double bottomPrice = ObjectGetValueByTime(0, valleyObjName, valleyArray[0], 2); // returns 4501

     double bottomPrice = ObjectGetValueByTime(0, valleyObjName, valleyArray[1], 2); // returns 4501

     double bottomPrice = ObjectGetValueByTime(0, valleyObjName, valleyArray[2], 2); // returns 4501

     double bottomPrice = ObjectGetValueByTime(0, valleyObjName, valleyArray[...], 2); // returns 4501

 

Any idea or similar experience?    

 

4501 means "ERR_GLOBALVARIABLE_NOT_FOUND"

Very strange !

Did you reset the error before?

void  ResetLastError();

Did you check your CopyTime ?

if(CopyTime(      ,40,vallyArray) != 40)     Error !!!


Willbur




 
Yes, I did. It drove me crazy so that I decided to do the math myself and calculate what I need. However, I'm still looking forward to your suggestions and ideas. Also, if required, I can provide the whole code for you to take a look at.
 

I made some tests with trend line.

Is working fine and all I can get is error "4205 - ERR_OBJECT_GETVALUE_FAILED" - when I use wrong values in order to force errors. 

Maybe you should post a part of the code.

Willbur

 

Thank you, I finally got through a mini course on "Standard Deviation" and "Linear Regression" and wrote my own code. Now it's working like a charm...

 
A good occasion to refresh old math skills   ;-)