Use of ObjectGetValueByTime

 

I'm trying to get values on lines of an OBJ_CHANNEL created on chart.

As far as I understand it, I would be able to get them with ObjectGetValueByTime 

However, I'm nor figuring how to... 

This is what I'm using for

...
   Upper = ObjectGetValueByTime(0,trend,i1,0);
   Lower = ObjectGetValueByTime(0,trend,i1,1);
//--- Output values in three lines
   Comment(StringFormat("Show Trend Channel Values\nUpper = %G\nLower = %G\nSpread = %d",Upper,Lower,Spread));

 where trend is the string with channel name and i1 is the time I want to get line values.

The values I get for Upper value is ok, but not for Lower value. This last one comes with 6 digits and no decimal place

Thank you for the help you can provide me.

Best regards.

--- Version 4, Build 910 (Broker did not updated yet?)

 
Same problem, It not work. I'm trying to use ObjectGetValueByTime  with OBJ_CHANNEL but it don't give correct value on second line.



DoubleToStr(ObjectGetValueByTime(0,TLineName,Time[0],0),3) it work fine with first line and give me 63.144 (correct value)

but with second line


DoubleToStr(ObjectGetValueByTime(0,TLineName,Time[0],1),3) it give me -25198877.873 

why this???

 
I solved but it's crazy that with channel i must interpolate by myself and with other objects not.
 

Don't double post! You already had another thread open.

          General rules and best pratices of the Forum. - General - MQL5 programming forum
Reason: