ObjectGetDouble for trend line with ray to right

To add comments, please log in or register
samjesse
643
samjesse  

Hi

I have a trend line on the chart, This mql5 code failed to get the price of the line at the current bar. How can I do it?

I could not find docs for ObjectGetValueByShift either.

Thanks


ObjectGetDouble(0, trendLineName, OBJPROP_PRICE); // modifier 1 gives price of second point but not the far right_ray which is current bar.
Ali Sabbaghi
261
Ali Sabbaghi  
samjesse:

Hi

I have a trend line on the chart, This mql5 code failed to get the price of the line at the current bar. How can I do it?

I could not find docs for ObjectGetValueByShift either.

Thanks


use this code


double GetLinePrice= NormalizeDouble(ObjectGetValueByShift("your_line_name", 0),Digits );
samjesse
643
samjesse  
Ali Sabbaghi:

use this code



function not defined: "ObjectGetValueByShift.

undeclaired identifier: Digits 

this is mql5 not mql4...


The following seams to work, but is it the "right" way to do it?

        datetime currentBarTime = SymbolInfoInteger(_Symbol, SYMBOL_TIME);
        double linePrice = NormalizeDouble(ObjectGetValueByTime(0, name, currentBarTime), _Digits);
To add comments, please log in or register