you can only get objects from the same chart where expert is working.
you can only get objects from the same chart where expert is working.
thank you, irusoh1.
besides using ObjectGet(), isn't there another way to get this done? the task looks so basic. it would surprise me if there is no mql4 work-around.
See object visibility; Also need to consider the property when using ObjectSet & ObjectGet.
OBJPROP_TIMEFRAMES | 15 | int | Value can be one or combination (bitwise addition) of object visibility constants to set/get timeframe object property. |
workaround : when you draw/redraw the object(s) save the latest parameter to GlobalVariable & have the EA/Indicator read from that. Good luck.
See object visibility; Also need to consider the property when using ObjectSet & ObjectGet.
OBJPROP_TIMEFRAMES | 15 | int | Value can be one or combination (bitwise addition) of object visibility constants to set/get timeframe object property. |
workaround : when you draw/redraw the object(s) save the latest parameter to GlobalVariable & have the EA/Indicator read from that. Good luck.
thanks cameofx. i read that GlobalVariables can only be of type "double". it happens that the object parameter i am interested in is of type "datetime" as you may notice in the code above.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello mql4 experts,
I am trying to put a rectangle on a 5 min chart based on the start and end times of a 15min chart trend line. The code used is shown below. The active chart when the indicator is inserted is the 5min. Based on my understanding that object names are unique, I try to get the time parameters of the 15 min object with the ObjectGet() functions, but this fails. The date and time returned are always Jan 1, 1970 at 0:00:00 (i.e. the metatrader time origin).
I suspect this is because when I use ObjectGet, the 15 min chart is not the active chart. I have researched importing user32.dll GetParent() and SendMessageA() to make the 15min chart active. Apparently, I am not getting it right. Can you put me through please.
int start(){
datetime myStart, myEnd;
myStart=ObjectGet("Old Trend",OBJPROP_TIME1);
myEnd=ObjectGet("Old Trend",OBJPROP_TIME2);
if(!ObjectCreate("New Trend",OBJ_RECTANGLE,0,myStart,134.00,myEnd,134.05))
{
return(0);
}
else
{
ObjectSet("New Trend",6,Yellow); //6 represents colour property
ObjectSetText("New Trend","New",10,"Arial",Ivory);
}
return(0);