Question for coders. Please help..

 

HI can anyone help with this. I have an ea that gets a price value from a horizontal line or trendline. However i have the code as follows but it will not pick up either value. If i remove the Objectgetvaluebyshift it will pick up the Horizontal line price and vice versa. But i need it to recognise both and get the value from which ever line i have on my chart(either a trand or h_line).

thanks.

tp =(ObjectGetValueByShift( TP_P, OBJPROP_PRICE1)) || (ObjectGet( TP_P, OBJPROP_PRICE1));

 

hi

|| is used to compare boolean variables, but ObjectGetValue returns a double. How should || compare this results?

Solution i quite easy, you should be able to figure it out yourself.

i assume ObjectGetValueByShift and ObjectGet returns -1 if the object does not exist, so use this information to identify which one of the lines is drawn on the chart

 
zzuegg:

hi

|| is used to compare boolean variables, but ObjectGetValue returns a double. How should || compare this results?

Solution i quite easy, you should be able to figure it out yourself.

i assume ObjectGetValueByShift and ObjectGet returns -1 if the object does not exist, so use this information to identify which one of the lines is drawn on the chart



I can try figure it out. But i am only starting out learning to code. I am self learning so i dnt understand how alot of the code works or what it means. Just learning bit by bit. If you have a few minutes could you write what you explained there in code.

thanks

 
gavin:


I can try figure it out. But i am only starting out learning to code. I am self learning so i dnt understand how alot of the code works or what it means. Just learning bit by bit. If you have a few minutes could you write what you explained there in code.

thanks


can you post a bit of code so i understand what to do please
Reason: