first value i can read with ObjectGet(name,OBJPROP_PRICE1), but when i try ObjectGet(name,OBJPROP_PRICE2) then i always receive 0 value. Do you have any hints for that?
I suggest you read the https://docs.mql4.com/constants/objects . . .
OBJ_TRENDBYANGLE | 3 | Trend by angle. Uses 1 coordinate. To set angle of line use ObjectSet() function. |
You might be able to get the other value by using ObjectGetValueByShift()
hi
i wanted to ask about angled lines, because i cannot get value of 2nd point from such line. When i use "Trend by Angle" properties window then i see that there is are two point values listed:
first value i can read with ObjectGet(name,OBJPROP_PRICE1), but when i try ObjectGet(name,OBJPROP_PRICE2) then i always receive 0 value. Do you have any hints for that?
Well you seem to be doing something wrong. It works for me.
And here is the script code ...
int start(){ double result= ObjectGet("dog",OBJPROP_TIME1); Print( "Time 1= " + TimeToStr(result)); result= ObjectGet("dog",OBJPROP_PRICE1); Print( "Price 1= " + DoubleToStr(result, Digits+1)); result= ObjectGet("dog",OBJPROP_TIME2); Print( "Time 2= " + TimeToStr(result)); result= ObjectGet("dog",OBJPROP_PRICE2); Print( "Price 2= " + DoubleToStr(result, Digits+1)); return(0); }
The trend line was drawn on the chart and I changed its name to "dog" for no particular reason.
Hi Guys,
I came across the same problem, that ObjectGet function is not returning proper values for Time2 and Price2 when applied for a trend line by angle , if the code is run as EA or Indicator.
If the code is run as Scrip, will work! In my opinion Dabbler, run his code as script, but the same code copied into a EA or Indicator will not deliver proper Time2 and Price2 values.....
Unfortunately is not possible to call/run a script within an EA or Indicator....
If anybody has got a solution, do not hesitate to let me know :-)
Regards
twoci
Hi Guys,
I came across the same problem, that ObjectGet function is not returning proper values for Time2 and Price2 when applied for a trend line by angle , if the code is run as EA or Indicator.
If the code is run as Scrip, will work! In my opinion Dabbler, run his code as script, but the same code copied into a EA or Indicator will not deliver proper Time2 and Price2 values.....
Unfortunately is not possible to call/run a script within an EA or Indicator....
If anybody has got a solution, do not hesitate to let me know :-)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi
i wanted to ask about angled lines, because i cannot get value of 2nd point from such line. When i use "Trend by Angle" properties window then i see that there is are two point values listed:
first value i can read with ObjectGet(name,OBJPROP_PRICE1), but when i try ObjectGet(name,OBJPROP_PRICE2) then i always receive 0 value. Do you have any hints for that?
regards
Romek